-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
tch-gui-unhide
executable file
·28 lines (27 loc) · 1.15 KB
/
tch-gui-unhide
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
#!/bin/sh
VERSION="$(uci get version.@version[0].marketing_version)"
SCRIPT="tch-gui-unhide-$VERSION"
if [ -f "$SCRIPT" -a "$(echo $* | grep -o -e '-U')" != '-U' ]; then
sh $SCRIPT -W $*
else
if [ ! -f "$SCRIPT" ]; then
echo "$(date +%H:%M:%S): Platform script $SCRIPT not found in $(pwd)!"
fi
echo "$(date +%H:%M:%S): Attempting to download latest release for FW $VERSION from GitHub..."
RESPONSE_CODE=$(curl -gkLsI -o /dev/null -w '%{http_code}' https://github.com/seud0nym/tch-gui-unhide/releases/latest/download/$VERSION.tar.gz)
if [ "$RESPONSE_CODE" = 200 ]
then
curl -gkL https://github.com/seud0nym/tch-gui-unhide/releases/latest/download/$VERSION.tar.gz | tar -xzvf -
if [ -f "$SCRIPT" ]; then
sh $SCRIPT -W $(echo "$*" | sed -e 's/-U$//' -e 's/-U //g' -e 's/U//g')
fi
elif [ "$RESPONSE_CODE" = 404 ]
then
echo "$(date +%H:%M:%S): ERROR! No latest release found on GitHub for FW $VERSION"
elif [ "$RESPONSE_CODE" = 000 ]
then
echo "$(date +%H:%M:%S): ERROR! No Internet connection???"
else
echo "$(date +%H:%M:%S): ERROR! Unknown response for latest FW $VERSION release on GitHub [$RESPONSE_CODE]"
fi
fi