Script to set up Google Drive stuff for saltbox/cloudbox
- You have created a google project as described here: https://docs.saltbox.dev/reference/google-project-setup/
- You have the credential JSON to hand
- You have created a google group as described here: https://docs.saltbox.dev/reference/google-group-setup/
- You have that group address to hand
- You have rclone installed
- You are running python 3.8 and have run
sudo apt install python3.8-venv -y
. Probably other python3 works [this was built on a new saltbox install, so the version is whatever that left me with]. The assumption is that I can create a Python virtual env /opt
is owned by you and writeable without sudo
This script is a two-stage thing.
First run will clone and set up safire
.
Second run will authenticate safire
, then:
-
Create shared drives if needed
Default is three, "Movies", "Music", "TV"
-
Create projects
Default is three.
-
Create service accounts
Default is 100 per project
-
Add service accounts to the google group you specify
-
Add Google group to shared drives as Manager
-
Download service account JSON files
-
Sync service account JSON files to /opt/sa/all
-
Create rclone remotes for the shared drives
These are authenticated with a service account file, all using
/opt/sa/all/000150.json
-
Create standard file systems on the shared drives
Media ├── Movies ├── Music └── TV
-
Create rclone union remote combining the shared drives
The script generates and uses a random six-character prefix to use with all the stuff it creates, so for example the default shared drives will be something like:
MWxlw9_Movies
MWxlw9_Music
MWxlw9_TV
This means everything is away from stuff you created and can be cleaned up easily if need be.
That prefix is saved in ~/safire/prefix_file
If you want to define the shared drives and paths for yourself, create a file ~/safire/list_drives
where each line is DRIVENAME|PATH
. The default used in the absence of that file is:
Movies|/Media/Movies
Music|/Media/Music
TV|/Media/TV