-
Notifications
You must be signed in to change notification settings - Fork 9
Gdrive installation
👉 If you use our image it's already installed.
Gdrive is a command-line tool for managing your Google Gdrive from the Raspberry Pi.
It is already installed. Please continue with the Google authorization.
If you want to install Gdrive on another RPi, follow the steps below.
Start with the installation of Rust.
$ curl https://sh.rustup.rs -sSf | sh
Select the default option 1 and once completed, check the installation.
$ rustc --version
$ cargo --version
The next step is building gdrive.
Start by checking the size of swap memory ($ free -m
). It needs to be 2 GByte or more.
If required, enlarge the space by the the following commands.
$ sudo nano /etc/dphys-swapfile
# set CONF_SWAPSIZE=2048
# save with <Ctrl><X>, <Y>, <Enter>
Now, with sufficient memory available, build the gdrive executable.
$ git clone https://github.com/glotlabs/gdrive.git
$ cd ~/gdrive
$ cargo build --release
$ sudo cp ./target/release/gdrive /usr/local/bin
The next step is getting the authorization key from Google. With the key in place, you can access your Gdrive.
The key is only valid for the current Raspberry Pi and will be stored at /home/pi/.config/gdrive3
Note that everyone with access to this file has access to your Gdrive. Be careful.
👉The whole procedure involves many steps. Follow the guide carefully.
Of course, you need a Google account to access Google Drive.
It is best to create a new account. You don't want your personal information exposed as the access keys are not that well protected in the Raspberry Pi.
You must activate your account with the so-called 2-step verification, otherwise, Google will not allow access to the content.
See also the email wiki.
2 Start with making a new project in Google Cloud Console.
Or
Wait a few second until the project is created by Google.
The first email address is always your Gmail. Other addresses are not possible.
The second one can be any valid email address. Google notifies you when the project changes.
If you want, you can upload a logo, it's not required.
Click menu item Credentials
- Create credentials
- OAuth client ID
Copy-paste the client ID and secret, or download the JSON file. You will need them soon.
Click the OAuth Consent Screen
menu option and publish the app to prevent it from expiring in 7 days.
The Gdrive software works perfectly without verifying the app.
In the Raspberry Pi terminal, issue the command gdrive account add
.
You prompted to provide the client ID and client secret. Enter those received at step 16.
Then right-click on the URL and select Open URL
from the context menu. Chromium opens.
After the 2-step verification of your Google account, you will see a screen warning that the app is not verified.
Click on the "Advanced" section and activate the app.
Grant your app to access the two Google Drive services you selected in step 10.
If your Raspberry Pi does not have a desktop (OS Lite), you can not access your Google account via a browser.
The workaround is to use another Raspberry Pi with a browser first and then transfer the OAuth information to your desktop-less Rpi.
$ gdrive account list
$ gdrive account export <YourAccountName>
# on the other Raspberry Pi without browser capacities.
$ gdrive account import <gdrive_export-YourAccountName.tar>
Now your gdrive is up and running. You can test it with the $ gdrive files list
command.
Credentials: Petter Rasmussen