Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
Merge branch 'add-filesync-fix' into add-filesync
Browse files Browse the repository at this point in the history
  • Loading branch information
thatonedude3470 committed Oct 2, 2020
2 parents e7af522 + 9ac2398 commit f2fb2a6
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions install-raspbian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,42 @@ dtoverlay=gpio-no-irq
EOF

echo -e "\033[0;33m### You'd probably like to use the file backup feature."
read -p "### Would you like to add a cronjob for file backup? [y/N] " -n 1 -r
read -p "### Would you like to enable the file backup? [y/N] " -n 1 -r
echo -e "\033[0m"
if [[ $REPLY =~ ^[Yy]$ ]]
then
info "### Disabling automount for pi user"

mkdir -p /home/pi/.config/pcmanfm/LXDE-pi/
cat >> /home/pi/.config/pcmanfm/LXDE-pi/pcmanfm.conf <<EOF
[volume]
mount_on_startup=0
mount_removable=0
autorun=0
EOF

chown -R pi:pi /home/pi/.config/pcmanfm

info "### Adding polkit rule so www-data can (un)mount drives"

cat >> /etc/polkit-1/localauthority/50-local.d/udisks2.pkla <<EOF
[Allow www-data to mount drives with udisks2]
Identity=unix-user:www-data
Action=org.freedesktop.udisks2.filesystem-mount*;org.freedesktop.udisks2.filesystem-unmount*
ResultAny=yes
ResultInactive=yes
ResultActive=yes
EOF


info "### Creating and chowning log folder for cronjob log"
mkdir /var/log/photoboothsync/
chown www-data:www-data /var/log/photoboothsync/

info "### Adding rsync cronjob for file backup"

crontab -l | { cat; echo "*/5 * * * * cd ${INSTALLFOLDERPATH} && ./sync-to-drive.js"; } | crontab -
sudo -u www-data crontab -l | { cat; echo 'MAILTO=""'; } | sudo -u www-data crontab -
sudo -u www-data crontab -l | { cat; echo "*/5 * * * * (cd ${INSTALLFOLDERPATH} && ./sync-to-drive.js) >> /var/log/photoboothsync/synclog.txt 2>&1"; } | sudo -u www-data crontab -
fi

info "### Congratulations you finished the install process."
Expand Down

0 comments on commit f2fb2a6

Please sign in to comment.