사용자 도구

사이트 도구


linux:grive2

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
linux:grive2 [2019/11/20 22:38]
kwon37xi 만듦
linux:grive2 [2022/07/19 16:38] (현재)
kwon37xi [Debian Build Package]
줄 5: 줄 5:
   * [[http://dothisbest.com/how-to/install-google-drive-grive2-on-ubuntu/|How to install Google Drive Grive2 on Ubuntu]]   * [[http://dothisbest.com/how-to/install-google-drive-grive2-on-ubuntu/|How to install Google Drive Grive2 on Ubuntu]]
   * [[http://www.webupd8.org/2015/05/grive2-grive-fork-with-google-drive.html|Grive2: Grive Fork With Google Drive REST API And Partial Sync Support [PPA] ~ Web Upd8: Ubuntu / Linux blog]]   * [[http://www.webupd8.org/2015/05/grive2-grive-fork-with-google-drive.html|Grive2: Grive Fork With Google Drive REST API And Partial Sync Support [PPA] ~ Web Upd8: Ubuntu / Linux blog]]
-  * PPA 설치<code sh> + 
-sudo add-apt-repository ppa:nilarimogard/webupd8 +===== pacstall 설치 ===== 
-sudo apt-get update +<code sh> 
-sudo apt-get install grive+pacstall -I grive2-git
 </code> </code>
 +
 +
 +===== Debian Build Package =====
 +  * https://github.com/vitalif/grive2/releases 에서 소스 다운로드
 +
 +<code sh>
 +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
 +
 +</code>
 +
 +===== API 인증 =====
 +  * 2019년 11월 부터 Google Drive API 를 사용자가 작접 id와 secret 을 받아서 지정해줘야만 하게 되었다.(추후 바뀔 수 있음)
 +  * https://github.com/vitalif/grive2/issues/287#issuecomment-557704687
 +
 +  - 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.
 +  - Search for Google Drive API and enable it.
 +  - Go to API Credentials page (https://console.developers.google.com/apis/credentials)
 +  - 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.
 +  - Then you need to follow this repo README, download grive2, build and install. Then run
 +
 +<code sh>
 +grive -a --id [client id] --secret [client secret]
 +# id 는 긴코드값.apps.googleusercontent.com 형태이다.
 +</code>
 +
 +
 +===== 사용 =====
   * 신규 동기화<code sh>   * 신규 동기화<code sh>
 mkdir SyncDir # 신규 동기화 디렉토리 생성 mkdir SyncDir # 신규 동기화 디렉토리 생성
줄 23: 줄 73:
 # 혹은 # 혹은
 grive -p /path/to/SyncDir grive -p /path/to/SyncDir
-</code> 
-  * 지속적 동기화 <code sh> 
-# /home/myhome/GoogleDrive 디렉토리를 매시 15분, 45분마다 동기화하고 로그를 /tmp/grivesync.log로 남긴다. 
-15,45 * * * * /usr/bin/grive -p '/home/myhome/GoogleDrive' -V -l /tmp/grivesync.log 
 </code> </code>
  
줄 36: 줄 82:
   * **NTFS 파티션**에서 오류가 발생했다. [[linux:partition|Linux Partition]]을 참조하여 ''/etc/fstab/''의 해당 파티션 옵션에 ''fmask=111,uid=1000''을 추가했더니 잘 작동했다.   * **NTFS 파티션**에서 오류가 발생했다. [[linux:partition|Linux Partition]]을 참조하여 ''/etc/fstab/''의 해당 파티션 옵션에 ''fmask=111,uid=1000''을 추가했더니 잘 작동했다.
  
 +===== 동기화 =====
 +  * [[linux:systemd|systemd]] 서비스를 제공해주는데, 시간 기반과 파일 변경기반 두가지를 제공해준다.
 +  * 하나의 구글 드라이브에 대해서 둘 중의 하나만 적용해야 한다.
 +  * 아래 예에서 ''google-drive'' 는 ''$HOME'' 에 있는 구글 드라이브 디렉토리이다.
 +
 +==== time based ====
 +<code sh>
 +systemctl --user enable grive-timer@$(systemd-escape google-drive).timer
 +systemctl --user start grive-timer@$(systemd-escape google-drive).timer
 +</code>
 +
 +==== change based ====
 +  * ''inotify-tools'', ''inotifywait'' 명령으로 변경 감지 동기화
 +
 +<code sh>
 +systemctl --user enable grive-changes@$(systemd-escape google-drive).service
 +systemctl --user start grive-changes@$(systemd-escape google-drive).service
 +</code>
 +
 +==== log ====
 +<code sh>
 +journalctl -f --user-unit=grive-timer@$(systemd-escape google-drive).timer
 +journalctl -f --user-unit=grive-changes@$(systemd-escape google-drive).service
 +</code>
 +  * 만약 systemd 서비스가 작동하지 않는다면 ''grive-sync.sh'' 파일의 경로가 잘못됐을 수 있다.
 +  * ''/usr/[local/]lib/systemd/user/grive-timer@.service'' 혹은 ''/usr/[local/]lib/systemd/user/grive-changes@.service'' 파일에서 ''grive-sync.sh'' 파일 경로 확인.
 +  * 현재 해당 파일이 ''/lib/x86_64-linux-gnu/grive/grive-sync.sh''로 설치 됐는데, ''/usr/libexec/grive''에서 찾는 현상 발생
 +  * pacstall로 설치시에는 ''/usr/local/libexec/grive/grive-sync.sh''
 +
 +<code sh>
 +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
 +</code>
  
linux/grive2.1574257119.txt.gz · 마지막으로 수정됨: 2019/11/20 22:38 저자 kwon37xi