사용자 도구

사이트 도구


linux:grive2

문서의 이전 판입니다!


grive2

pacstall 설치

  • 현재 작동안함.
pacstall -I grive2

Debian Build Package

sudo apt-get install git cmake build-essential libgcrypt20-dev \
    libyajl-dev libboost-all-dev libcurl4-openssl-dev libexpat1-dev \
    libcppunit-dev binutils-dev debhelper zlib1g-dev dpkg-dev \
    pkg-config libstdc++-7-dev
# 특히 libstdc++-7-dev 주의! 문서에는 안나오는 의존성임.
 
cd /tmp
git clone https://github.com/vitalif/grive2.git
 
# 소스 압축푼 디렉토리로 이동(ext 파티션이어야 한다)
cd grive2
 
dpkg-buildpackage -j4
 
# 상위디렉토리에 deb 패키지 생성됨
sudo dpkg -i <filename.deb>
 
# 마지막에 오류 발생하는 것은 무시
dpkg-buildpackage: info: full upload; Debian-native package (full source is included)
 signfile grive2_0.5.2+git20210315.dsc
gpg: skipped "Vitaliy Filippov <vitalif@yourcmc.ru>": No secret key
gpg: dpkg-sign.v7YLDLyX/grive2_0.5.2+git20210315.dsc: clear-sign failed: No secret key
 
dpkg-buildpackage: error: failed to sign .dsc file

API 인증

  1. Go to https://console.developers.google.com/apis/library. Login with your Google account and create a new project on Google Cloud Platform. You can also use an existing one.
  2. Search for Google Drive API and enable it.
  3. Create a new OAuth Client credential. You will be provided with a id and a secret. Save both because you gonna need it for grive2.
  4. Then you need to follow this repo README, download grive2, build and install. Then run
grive -a --id [client id] --secret [client secret]
# id 는 긴코드값.apps.googleusercontent.com 형태이다.

사용

  • 신규 동기화
    mkdir SyncDir # 신규 동기화 디렉토리 생성
    cd SyncDir
    grive -a # 신규 동기화 시작
  • 일단 디렉토리 동기화를 한 번 지정하면 해당 디렉토리에 인증 정보가 저장되어 grive 명령만으로 동기화를 수행한다.
  • 동기화
    # 동기화 대상 디렉토리에서
    cd SyncDir
    grive
     
    # 혹은
    grive -p /path/to/SyncDir
  • Options
    • -V : verbose
    • -l [/path/to/logfile.log] : 로깅
    • -a : 신규 동기화 인증
    • -p [/path/to/sync] : 동기화할 디렉토리 지정.
  • NTFS 파티션에서 오류가 발생했다. Linux Partition을 참조하여 /etc/fstab/의 해당 파티션 옵션에 fmask=111,uid=1000을 추가했더니 잘 작동했다.

동기화

  • systemd 서비스를 제공해주는데, 시간 기반과 파일 변경기반 두가지를 제공해준다.
  • 하나의 구글 드라이브에 대해서 둘 중의 하나만 적용해야 한다.
  • 아래 예에서 google-drive$HOME 에 있는 구글 드라이브 디렉토리이다.

time based

systemctl --user enable grive-timer@$(systemd-escape google-drive).timer
systemctl --user start grive-timer@$(systemd-escape google-drive).timer

change based

  • inotify-tools, inotifywait 명령으로 변경 감지 동기화
systemctl --user enable grive-changes@$(systemd-escape google-drive).service
systemctl --user start grive-changes@$(systemd-escape google-drive).service

log

journalctl -f --user-unit=grive-timer@$(systemd-escape google-drive).timer
journalctl -f --user-unit=grive-changes@$(systemd-escape google-drive).service
  • 만약 systemd 서비스가 작동하지 않는다면 grive-sync.sh 파일의 경로가 잘못됐을 수 있다.
  • /usr/lib/systemd/user/grive-timer@.service 혹은 /usr/lib/systemd/user/grive-changes@.service 파일에서 grive-sync.sh 파일 경로 확인.
  • 현재 해당 파일이 /lib/x86_64-linux-gnu/grive/grive-sync.sh로 설치 됐는데, /usr/libexec/grive에서 찾는 현상 발생
cd /usr/libexec
sudo mkdir -p /usr/libexec/grive
cd /usr/libexec/grive
sudo ln -s /lib/x86_64-linux-gnu/grive/grive-sync.sh
linux/grive2.1634173785.txt.gz · 마지막으로 수정됨: 2021/10/14 10:09 저자 kwon37xi