1 <?xml version=
"1.0" encoding=
"ISO-8859-1"?>
2 <rss version='
2.0' xmlns:lj='http://www.livejournal.org/rss/lj/
1.0/'
>
4 <title>Petter Reinholdtsen - Entries from October
2018</title>
5 <description>Entries from October
2018</description>
6 <link>http://people.skolelinux.org/pere/blog/
</link>
10 <title>Automatic Google Drive sync using grive in Debian
</title>
11 <link>http://people.skolelinux.org/pere/blog/Automatic_Google_Drive_sync_using_grive_in_Debian.html
</link>
12 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Automatic_Google_Drive_sync_using_grive_in_Debian.html
</guid>
13 <pubDate>Thu,
4 Oct
2018 15:
20:
00 +
0200</pubDate>
14 <description><p
>A few days, I rescued a Windows victim over to Debian. To try to
15 rescue the remains, I helped set up automatic sync with Google Drive.
16 I did not find any sensible Debian package handling this
17 automatically, so I rebuild the grive2 source from
18 <a href=
"http://www.webupd8.org/
">the Ubuntu UPD8 PPA
</a
> to do the
19 task and added a autostart desktop entry and a small shell script to
20 run in the background while the user is logged in to do the sync.
21 Here is a sketch of the setup for future reference.
</p
>
23 <p
>I first created
<tt
>~/googledrive
</tt
>, entered the directory and
24 ran
'<tt
>grive -a
</tt
>' to authenticate the machine/user. Next, I
25 created a autostart hook in
<tt
>~/.config/autostart/grive.desktop
</tt
>
26 to start the sync when the user log in:
</p
>
28 <p
><blockquote
><pre
>
30 Name=Google drive autosync
32 Exec=/home/user/bin/grive-sync
33 </pre
></blockquote
></p
>
35 <p
>Finally, I wrote the
<tt
>~/bin/grive-sync
</tt
> script to sync
36 ~/googledrive/ with the files in Google Drive.
</p
>
38 <p
><blockquote
><pre
>
43 if [
"$syncpid
" ] ; then
47 trap cleanup EXIT INT QUIT
48 /usr/lib/grive/grive-sync.sh listen googledrive
2>&1 | sed
"s%^%$
0:%
" &
51 if ! xhost
>/dev/null
2>&1 ; then
52 echo
"no DISPLAY, exiting as the user probably logged out
"
55 if [ ! -e /run/user/
1000/grive-sync.sh_googledrive ] ; then
56 /usr/lib/grive/grive-sync.sh sync googledrive
59 done
2>&1 | sed
"s%^%$
0:%
"
60 </pre
></blockquote
></p
>
62 <p
>Feel free to use the setup if you want. It can be assumed to be
63 GNU GPL v2 licensed (or any later version, at your leisure), but I
64 doubt this code is possible to claim copyright on.
</p
>
66 <p
>As usual, if you use Bitcoin and want to show your support of my
67 activities, please send Bitcoin donations to my address
68 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>