목차

grive2

pacstall 설치

pacstall -I grive2-git

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++-9-dev
# 특히 libstdc++-9-dev 주의! 문서에는 안나오는 의존성임. 또한 Ubuntu 22.04 이전 버전에서는 ''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 형태이다.

사용

동기화

time based

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

change based

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
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