-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathupdate.sh
executable file
·39 lines (35 loc) · 936 Bytes
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -uo pipefail
IFS=$'\n\t'
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# Navigate to the repository directory
cd /opt/lalubuntu
# Check for updates
git fetch
# Compare the local and remote versions
LOCAL=$(git rev-parse HEAD)
REMOTE=$(git rev-parse @{u})
# If updates are available, prompt the user
if [ "$LOCAL" != "$REMOTE" ]; then
echo "Update available for Lalubuntu."
while true; do
read -p "Would you like to update? [Y/n] " response
case $response in
[Yy]* | "" )
git pull
bash install.sh
echo "Lalubuntu has been updated."
break
;;
[Nn]* )
echo "Update canceled."
exit
;;
* )
echo "Please answer Y or n."
;;
esac
done
else
echo "Already up-to-date 🌹"
fi