update.sh: remove special content

This commit is contained in:
Romain Bazile 2021-01-14 17:04:02 +01:00
parent 2f39b3fa06
commit 3d1c13a70e

View file

@ -14,32 +14,12 @@ function update(){
} }
function special(){ function special(){
if [[ -f "/etc/systemd/system/usb-mount@.service" ]]; then ${log} "Nothing special to do!"
sudo rm /etc/systemd/system/usb-mount@.service
fi
if [[ -f "/etc/udev/rules.d/99-local.rules" ]]; then
sudo rm /etc/udev/rules.d/99-local.rules
fi
if [[ -f "/etc/nginx/sites-available/img.conf" ]]; then
${log} "Getting rid of the old nginx config"
sudo rm /etc/nginx/sites-available/img.conf
sudo rm /etc/nginx/sites-enabled/img.conf
fi
if ! [[ -f "/etc/nginx/sites-enabled/gallery.conf" ]]; then
${log} "Nginx config is not installed, doing that now"
sudo ln -s /home/pi/PlanktonScope/scripts/gallery/gallery.conf /etc/nginx/sites-enabled/gallery.conf
fi
if [[ -f "/etc/nginx/sites-available/gallery.conf" ]]; then
${log} "Nginx config is installed, changing the links now"
sudo rm /etc/nginx/sites-enabled/gallery.conf /etc/nginx/sites-available/gallery.conf
sudo ln -s /home/pi/PlanktonScope/scripts/gallery/gallery.conf /etc/nginx/sites-enabled/gallery.conf
fi
} }
${log} "Updating the main repository" ${log} "Updating the main repository"
cd /home/pi/PlanktonScope || { echo "/home/pi/PlanktonScope does not exist"; exit 1; } cd /home/pi/PlanktonScope || { echo "/home/pi/PlanktonScope does not exist"; exit 1; }
# TODO We need to add here a way to load the latest version of this script and execute it again
remote=$(git ls-remote -h origin master | awk '{print $1}') remote=$(git ls-remote -h origin master | awk '{print $1}')
local=$(git rev-parse HEAD) local=$(git rev-parse HEAD)
if [[ "$local" == "$remote" ]]; then if [[ "$local" == "$remote" ]]; then