forked from Botspot/box86-updater
-
Notifications
You must be signed in to change notification settings - Fork 0
/
onboot
executable file
·44 lines (34 loc) · 1.26 KB
/
onboot
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
40
41
42
43
44
#!/bin/bash
DIRECTORY="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
function error {
echo -e "\\e[91m$1\\e[39m"
exit 1
}
latesthash="$(wget -qO- https://archive.org/download/box86.7z_20200928/box86sum.txt)"
localhash="$(cat "${DIRECTORY}/box86.hash")"
if [ -z "$latesthash" ];then
error "Failed to get latest box86 hash. Are you connected to the internet?"
fi
if [ -z "$localhash" ];then
update=1
elif [ ! "$localhash" == "$latesthash" ];then
update=1
else
update=0
fi
if [ "$update" == 0 ];then
echo "No box86 updates available. Exiting now."
exit 0
fi
#else (update available)
if [ "$1" == ask ];then
screen_width="$(xdpyinfo | grep 'dimensions:' | tr 'x' '\n' | tr ' ' '\n' | sed -n 7p)"
screen_height="$(xdpyinfo | grep 'dimensions:' | tr 'x' '\n' | tr ' ' '\n' | sed -n 8p)"
yad --form --text='
Box86 can be updated.' \
--on-top --skip-taskbar --undecorated --close-on-unfocus \
--geometry=260+$((screen_width-262))+$((screen_height-150)) \
--image="${DIRECTORY}/icons/box86.png" \
--button="Settings":1 --button="Update now!${DIRECTORY}/icons/update.png":0 || ("${DIRECTORY}/configure";exit 0)
fi
"${DIRECTORY}/terminal-run" "trap 'echo "\""Closing in 10 seconds"\"" ; sleep 10' EXIT; ${DIRECTORY}/update-box86" "Updating box86"