Skip to content

Instantly share code, notes, and snippets.

@syaifulnizamyahya
Created June 18, 2017 15:12
Show Gist options
  • Select an option

  • Save syaifulnizamyahya/8c4adf42cc52926bde97525fdd15aa96 to your computer and use it in GitHub Desktop.

Select an option

Save syaifulnizamyahya/8c4adf42cc52926bde97525fdd15aa96 to your computer and use it in GitHub Desktop.
Google Drive mounting command
#!/usr/bin/bash
echo Mount log $(date) $'\r'$'\r'
echo "Starting Cloud Mounts" $'\r'
#mongodb and unionfs must be installed first
#get client id and secret
#client id .apps.googleusercontent.com
#client secret _iu1
#create mongodb db directory /mnt/user/appdata/plexdrive/data/db if its still not created
echo Start mongodb service in a screen
screen -S mongodb -d -m /usr/bin/mongod --dbpath /mnt/user/appdata/plexdrive/data/db
#screen -S mongodb -X quit
# plexdrive reference
#-root-node-id to specify remote folder to mount
#read_only to specify the mount is read only as plexdrive cannot write, only read and delete
# screen -S plexdrive -d -m plexdrive \
# --root-node-id=encfs
# --fuse-options=\
#allow_other\
#,read_only\
# \
# --verbosity=3 \
# /mnt/user/Amazon/.plexdrive/
echo Mount google drive using plexdrive in a screen
screen -S plexdrive -d -m plexdrive \
--fuse-options=\
allow_other\
,read_only\
\
--verbosity=3 \
/mnt/user/Cloud/skygmail/skygmail/
#screen -S plexdrive -d -m plexdrive --fuse-options=allow_other,read_only --verbosity=3 /mnt/user/Cloud/skygmail/skygmail/
#unmount
#fusermount -u /mnt/user/Cloud/skygmail/skygmail/
echo Mount skygmail encrypted subdirectory to a folder
mount --bind /mnt/user/Cloud/skygmail/skygmail/encfs /mnt/user/Cloud/skygmail/.remote
#unmount
#fusermount -u /mnt/user/Cloud/skygmail/.remote
echo Install encfs
upgradepkg --install-new /mnt/user/Cloud/skygmail/encfs/encfs-1.9.1-x86_64-1cf.txz
echo Mount and decrypt encrypted folders
echo password | ENCFS6_CONFIG='/mnt/user/Cloud/skygmail/encfs/.encfs6.xml' encfs \
-S -o ro -o allow_other -o uid=99 -o gid=100 \
/mnt/user/Cloud/skygmail/.remote/ \
/mnt/user/Cloud/skygmail/remote/
#unmount
#fusermount -u /mnt/user/Cloud/skygmail/remote/
#- safe for when encrypted folders contains encrypted files - unable to unmount
echo Mount Encrypted view of Local Media
echo password | ENCFS6_CONFIG='/mnt/user/Cloud/skygmail/encfs/.encfs6.xml' encfs \
-S -o nonempty -o rw -o allow_other -o uid=99 -o gid=100 \
/mnt/user/Cloud/skygmail/.local/ \
/mnt/user/Cloud/skygmail/local/
#unmount
#fusermount -u /mnt/user/Cloud/skygmail/local/
echo Mount with Local Data taking preference. (Read Only)
unionfs -o cow -o allow_other -o uid=99 -o gid=100 \
/mnt/user/Cloud/skygmail/local=RW:/mnt/user/Cloud/skygmail/remote=RO \
/mnt/user/Cloud/skygmail/merged/
#unmount
#fusermount -u /mnt/user/Cloud/skygmail/merged/
#unmount all
#fusermount -u /mnt/user/Cloud/skygmail/merged/
#fusermount -u /mnt/user/Cloud/skygmail/local/
#fusermount -u /mnt/user/Cloud/skygmail/remote/
#fusermount -u /mnt/user/Cloud/skygmail/.remote
#fusermount -u /mnt/user/Cloud/skygmail/skygmail/
echo Mounting Movie
unionfs -o cow -o allow_other -o uid=99 -o gid=100 \
/mnt/user/Movie/=RW:/mnt/user/MovieSucks/=RW:\
/mnt/user/Cloud/skygmail/local/Movie/=RW:/mnt/user/Cloud/skygmail/local/MovieSucks/=RW:\
/mnt/user/Cloud/skygmail/uploaded/Movie/=RO:/mnt/user/Cloud/skygmail/uploaded/MovieSucks/=RO:\
/mnt/user/Cloud/skygmail/remote/Movie/=RO:/mnt/user/Cloud/skygmail/remote/MovieSucks/=RO:\
\
/mnt/user/Media/Movies/
echo Mounting MovieKids
unionfs -o cow -o allow_other -o uid=99 -o gid=100 \
/mnt/user/MovieKids/=RW:/mnt/user/MovieKidsSucks/=RW:\
/mnt/user/Cloud/skygmail/local/MovieKids/=RW:/mnt/user/Cloud/skygmail/local/MovieKidsSucks/=RW:\
/mnt/user/Cloud/skygmail/uploaded/MovieKids/=RO:/mnt/user/Cloud/skygmail/uploaded/MovieKidsSucks/=RO:\
/mnt/user/Cloud/skygmail/remote/MovieKids/=RO:/mnt/user/Cloud/skygmail/remote/MovieKidsSucks/=RO:\
\
/mnt/user/Media/MoviesKids/
echo Mounting MovieOffensive
unionfs -o cow -o allow_other -o uid=99 -o gid=100 \
/mnt/user/MovieOffensive/=RW:/mnt/user/MovieOffensiveSucks/=RW:\
/mnt/user/Cloud/skygmail/local/MovieOffensive/=RW:/mnt/user/Cloud/skygmail/local/MovieOffensiveSucks/=RW:\
/mnt/user/Cloud/skygmail/uploaded/MovieOffensive/=RO:/mnt/user/Cloud/skygmail/uploaded/MovieOffensiveSucks/=RO:\
/mnt/user/Cloud/skygmail/remote/MovieOffensive/=RO:/mnt/user/Cloud/skygmail/remote/MovieOffensiveSucks/=RO:\
\
/mnt/user/Media/MoviesOffensive/
echo Mounting AllMovies
unionfs -o cow -o allow_other -o uid=99 -o gid=100 \
/mnt/user/Media/Movies/=RW:\
/mnt/user/Media/MoviesKids/=RW:\
/mnt/user/Media/MoviesOffensive/=RW:\
\
/mnt/user/Media/AllMovies/
echo Mounting TvShows
unionfs -o cow -o allow_other -o uid=99 -o gid=100 \
/mnt/user/TvShows/=RW:/mnt/user/TvShowsSucks/=RW:\
/mnt/user/Cloud/skygmail/local/TvShows/=RW:/mnt/user/Cloud/skygmail/local/TvShowsSucks/=RW:\
/mnt/user/Cloud/skygmail/uploaded/TvShows/=RO:/mnt/user/Cloud/skygmail/uploaded/TvShowsSucks/=RO:\
/mnt/user/Cloud/skygmail/remote/TvShows/=RO:/mnt/user/Cloud/skygmail/remote/TvShowsSucks/=RO:\
\
/mnt/user/Media/TvShows/
echo Mounting TvShowsKids
unionfs -o cow -o allow_other -o uid=99 -o gid=100 \
/mnt/user/TvShowsKids/=RW:/mnt/user/TvShowsKidsSucks/=RW:\
/mnt/user/Cloud/skygmail/local/TvShowsKids/=RW:/mnt/user/Cloud/skygmail/local/TvShowsKidsSucks/=RW:\
/mnt/user/Cloud/skygmail/uploaded/TvShowsKids/=RO:/mnt/user/Cloud/skygmail/uploaded/TvShowsKidsSucks/=RO:\
/mnt/user/Cloud/skygmail/remote/TvShowsKids/=RO:/mnt/user/Cloud/skygmail/remote/TvShowsKidsSucks/=RO:\
\
/mnt/user/Media/TvShowsKids/
echo Mounting TvShowsOffensive
unionfs -o cow -o allow_other -o uid=99 -o gid=100 \
/mnt/user/TvShowsOffensive/=RW:/mnt/user/TvShowsOffensiveSucks/=RW:\
/mnt/user/Cloud/skygmail/local/TvShowsOffensive/=RW:/mnt/user/Cloud/skygmail/local/TvShowsOffensiveSucks/=RW:\
/mnt/user/Cloud/skygmail/uploaded/TvShowsOffensive/=RO:/mnt/user/Cloud/skygmail/uploaded/TvShowsOffensiveSucks/=RO:\
/mnt/user/Cloud/skygmail/remote/TvShowsOffensive/=RO:/mnt/user/Cloud/skygmail/remote/TvShowsOffensiveSucks/=RO:\
\
/mnt/user/Media/TvShowsOffensive/
echo Mounting AllTvShows
unionfs -o cow -o allow_other -o uid=99 -o gid=100 \
/mnt/user/Media/TvShows/=RW:\
/mnt/user/Media/TvShowsKids/=RW:\
/mnt/user/Media/TvShowsOffensive/=RW:\
\
/mnt/user/Media/AllTvShows/
echo Mounting Music
unionfs -o cow -o allow_other -o uid=99 -o gid=100 \
/mnt/user/Music/=RW:\
/mnt/user/MusicMp3/=RW:\
\
/mnt/user/Media/Music/
#unmount all
#fusermount -u /mnt/user/Media/Movies/
#fusermount -u /mnt/user/Media/MoviesKids/
#fusermount -u /mnt/user/Media/MoviesOffensive/
#fusermount -u /mnt/user/Media/TvShows/
#fusermount -u /mnt/user/Media/TvShowsKids/
#fusermount -u /mnt/user/Media/TvShowsOffensive/
#force unmount
#umount -l /mnt/user/Media/Movies/
#umount -l /mnt/user/Media/MoviesKids/
#umount -l /mnt/user/Media/TvShows/
#umount -l /mnt/user/Media/TvShowsKids/
#umount -l /mnt/user/Media/MoviesOffensive/
#umount -l /mnt/user/Media/TvShowsOffensive/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment