Skip to content

Gdrive installation

Q-engineering edited this page Apr 30, 2023 · 17 revisions

output image


👉 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 ./gdrive /usr/local/bin

Authorization key

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
output image
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.

1 Start with making a new project in Google Cloud Console.

output image

output image

Or
output image

2 Give the project a name, like YoloCam.

output image
Wait a few second until the project is created by Google.

3 Select your project.

output image

4 Go to Google Drive Api under marketplace.

output image

5 Enable the Google Drive Api.

output image

6 Select the menu option credentials and click configure consent screen.

output image

7 Select external and click create.

output image

8 Give a name and email adresses.

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.
output image

9 Add a scope.

output image

10 Select ..auth/drive and ..auth/drive.metadata.readonly.

output image
output image

11 Save and continue.

output image

12 Give the user email address.

output image

13 Save and continue.

output image

14 Select OAuth client ID.

Click menu item Credentials - Create credentials - OAuth client ID
output image

Give the command $ gdrive about and copy-paste the URL in your browser.
output image

After logging into your Google account, you will be asked if you want to give your project access to the gdrive.
output image
output image
Once allowed, you get a unique code that can be copy-pasted back to the terminal screen.
output image

Now your gdrive is up and running. You can test it with the $ gdrive list command.

Clone this wiki locally