forked from piware14/pi-ware
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdater
More file actions
31 lines (28 loc) · 761 Bytes
/
Copy pathupdater
File metadata and controls
31 lines (28 loc) · 761 Bytes
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
#!/bin/bash
#load functions and variables
source "$HOME/pi-ware/func/api" || echo "failed to source $HOME/pi-ware/func/api"
#Check if connected to internet
while [[ "$(wget -q --spider http://google.com)" -eq 1 ]]
do
echo "I couldn't detect an internet connection! Trying again..."
sleep 2
done
#If loop ends, User online
#Check for updates
if [ "$CURRENT_COMMIT" != "$LATEST_COMMIT" ] || [ "$1" == "--force" ]; then
cd $HOME
rm -rf "$HOME/pi-ware/"
git clone "$PW_REPO" "$HOME/pi-ware"
rm -rf $PW_DATA/version
cd "$HOME/pi-ware"
echo $(git rev-parse main) > "$PW_DATA/version"
bash install
cd $HOME
echo "Update complete, Closing in 5 seconds..."
sleep 5
exit 0
else
echo "Pi-Ware is currently up-to-date."
sleep 2
exit 1
fi