Skip to content

Commit 6dc7875

Browse files
authored
Merge pull request #269 from TommyE123/gitdownload
Use generic Github API to download
2 parents e5229d4 + 2879a1a commit 6dc7875

19 files changed

+82
-81
lines changed

inc/app-constant-reset.sh

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ APPSYSTEMDOVERIDE=''
3131
APPTITLE=''
3232
APPPYTHONVERREQ=''
3333
APPUSESNGINX=''
34+
AVAILABLEVERSION=''
3435
CRONJOB=''
3536
CRONCMD=''
3637
DBUSERNAME=''

inc/app-git-download-release.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
# Script Name: AtoMiC Github Release Installer
3+
4+
echo
5+
echo -e "$YELLOW--->Latest File Found...$ENDCOLOR"
6+
OUTPUT="$(curl -s "$APPDOWNLOADURL" | \
7+
grep "$APPDOWNLOADEXT" | \
8+
grep browser_download_url | \
9+
head -n 1 | \
10+
cut -d '"' -f 4)"
11+
12+
#Sometimes it struggles for some reason so try again!
13+
if [[ -z $OUTPUT ]]; then
14+
echo -e "${RED}URL NOT FOUND AT FIRST ATTEMPT.. RETRYING$ENDCOLOR"
15+
OUTPUT="$(curl -s "$APPDOWNLOADURL" | \
16+
grep "$APPDOWNLOADEXT" | \
17+
grep browser_download_url | \
18+
head -n 1 | \
19+
cut -d '"' -f 4)"
20+
fi
21+
22+
if [[ -z $OUTPUT ]]; then
23+
echo -e "${RED}URL NOT FOUND$ENDCOLOR"
24+
exit 1
25+
fi
26+
27+
echo "$OUTPUT"
28+
echo
29+
echo -e "$YELLOW--->Downloading and extracting files...$ENDCOLOR"
30+
curl -L "$OUTPUT" | sudo tar -xzf - -C "$APPPATH" "$APPDOWNLOADSTRIP"

inc/app-git-latest-release-version.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# Script Name: AtoMiC Get Latest Github Release Version
3+
4+
AVAILABLEVERSION="$(curl -s "$APPDOWNLOADURL" | \
5+
grep tag_name | \
6+
cut -d '"' -f 4 | \
7+
head -n 1 | \
8+
sed s'/[v"]//g')"
9+

jackett/jackett-constants.sh

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ APPSHORTNAME='jk'
55
APPPATH='/opt/jackett'
66
APPTITLE='Jackett'
77
APPDEPS='libcurl4-openssl-dev'
8+
APPDOWNLOADURL='https://api.github.com/repos/jackett/jackett/releases/latest'
9+
APPDOWNLOADEXT='Mono.tar.gz'
10+
APPDOWNLOADSTRIP='--strip-components=1'
811
APPDPORT='9117'
912
APPSETTINGSDIR="/home/$UNAME/.config/Jackett"
1013
APPSETTINGS=$APPSETTINGSDIR'/ServerConfig.json'

jackett/jackett-download.sh

-14
This file was deleted.

jackett/jackett-installer.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ source "$SCRIPTPATH/utils/mono/mono-installer.sh"
1111
source "$SCRIPTPATH/jackett/jackett-constants.sh"
1212
source "$SCRIPTPATH/inc/app-install-deps.sh"
1313
source "$SCRIPTPATH/inc/app-folders-create.sh"
14-
source "$SCRIPTPATH/jackett/jackett-download.sh"
14+
source "$SCRIPTPATH/inc/app-git-download-release.sh"
1515
source "$SCRIPTPATH/inc/app-autostart-configure.sh"
1616
source "$SCRIPTPATH/inc/app-set-permissions.sh"
1717
source "$SCRIPTPATH/inc/app-start.sh"

jackett/jackett-update.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ if DoesAppFolderExist; then
1313
source "$SCRIPTPATH/inc/app-install-deps.sh"
1414
source "$SCRIPTPATH/inc/app-folders-create.sh"
1515
if "$SCRIPTPATH/jackett/jackett-version-handler.sh"; then
16-
source "$SCRIPTPATH/jackett/jackett-download.sh"
16+
source "$SCRIPTPATH/inc/app-git-download-release.sh"
17+
echo
1718
fi
1819
source "$SCRIPTPATH/inc/app-set-permissions.sh"
1920
source "$SCRIPTPATH/inc/app-start.sh"

jackett/jackett-version-handler.sh

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33

44
echo
55
source "$SCRIPTPATH/inc/commons.sh"
6+
source "$SCRIPTPATH/jackett/jackett-constants.sh"
7+
68
echo -e "${YELLOW}--->Jackett Version Check...$ENDCOLOR"
7-
JACKETTVERSION=$(curl -s https://github.com/Jackett/Jackett/releases/latest | \
8-
grep -o '".*"' | \
9-
awk -F / '{print $NF}' | \
10-
sed s'/[v"]//g')
11-
echo "Available Version: $JACKETTVERSION"
9+
source "$SCRIPTPATH/inc/app-git-latest-release-version.sh"
10+
echo "Available Version: $AVAILABLEVERSION"
1211

13-
if ! checkappversion "JACKETT" "$JACKETTVERSION" ; then
12+
if ! checkappversion "JACKETT" "$AVAILABLEVERSION" ; then
1413
exit 1
1514
fi

ombi/ombi-constants.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ APPSHORTNAME='ombi'
55
APPPATH='/opt/Ombi'
66
APPTITLE='Ombi'
77
APPDEPS='libunwind8 libcurl4-openssl-dev'
8-
APPDOWNLOADURL='https://api.github.com/ombi/ombi/releases'
8+
APPDOWNLOADURL='https://api.github.com/repos/tidusjar/Ombi/releases/latest'
99
APPDPORT='5000'
1010
APPSETTINGSTYPE='DB'
1111
APPSETTINGSDIR=$APPPATH

ombi/ombi-download.sh

-22
This file was deleted.

ombi/ombi-downloadext.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# Script Name: AtoMiC Ombi Download Get Extension
3+
4+
echo
5+
ARCH=$(uname -m)
6+
ARCHSHORT=${ARCH:0:3}
7+
if [[ $ARCHSHORT = 'arm' ]]; then
8+
APPDOWNLOADEXT='linux-arm.tar.gz'
9+
else
10+
APPDOWNLOADEXT='linux.tar.gz'
11+
fi

ombi/ombi-installer.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ fi
1919
source "$SCRIPTPATH/inc/app-move-previous.sh"
2020
source "$SCRIPTPATH/inc/app-install-deps.sh"
2121
source "$SCRIPTPATH/inc/app-folders-create.sh"
22-
source "$SCRIPTPATH/ombi/ombi-download.sh"
22+
source "$SCRIPTPATH/ombi/ombi-downloadext.sh"
23+
source "$SCRIPTPATH/inc/app-git-download-release.sh"
2324
source "$SCRIPTPATH/inc/app-autostart-configure.sh"
2425
source "$SCRIPTPATH/inc/app-set-permissions.sh"
2526
source "$SCRIPTPATH/inc/app-start.sh"

ombi/ombi-update.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ echo -e "${GREEN}AtoMiC $APPTITLE Update Script$ENDCOLOR"
77
source "$SCRIPTPATH/inc/pause.sh"
88

99
if DoesAppFolderExist; then
10-
if source "$SCRIPTPATH/ombi/ombi-version-check.sh"; then
10+
if "$SCRIPTPATH/ombi/ombi-version-check.sh"; then
1111
source "$SCRIPTPATH/inc/app-stop.sh"
1212
source "$SCRIPTPATH/inc/app-install-deps.sh"
13-
source "$SCRIPTPATH/ombi/ombi-download.sh"
13+
source "$SCRIPTPATH/ombi/ombi-downloadext.sh"
14+
source "$SCRIPTPATH/inc/app-git-download-release.sh"
1415
source "$SCRIPTPATH/inc/app-set-permissions.sh"
1516
source "$SCRIPTPATH/inc/app-start.sh"
1617
source "$SCRIPTPATH/inc/app-update-confirmation.sh"

ombi/ombi-version-check.sh

+5-7
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
echo
55
source "$SCRIPTPATH/inc/commons.sh"
6+
source "$SCRIPTPATH/ombi/ombi-constants.sh"
67
echo -e "${YELLOW}--->Ombi Version Check...$ENDCOLOR"
7-
CONTENT=$(echo 'select content from globalsettings;' | sqlite3 "$APPSETTINGSDB")
8+
CONTENT=$(echo 'select Content from globalsettings;' | sqlite3 "$APPSETTINGSDB")
89
OMBIAPIKEY=$(grep -Po '(?<="ApiKey":")([^"]+)' <<< "$CONTENT")
910

1011
if [[ -n $OMBIAPIKEY ]]; then
@@ -16,13 +17,10 @@ else
1617
echo "Updating continuing however possibly not necessary"
1718
fi
1819

19-
OMBIAVAILABLETVERSION=$(curl -s https://github.com/tidusjar/Ombi/releases/latest | \
20-
grep -o '".*"' | \
21-
awk -F / '{print $NF}' | \
22-
sed s'/[v"]//g')
23-
echo -e "Available Version: ${GREEN}$OMBIAVAILABLETVERSION$ENDCOLOR"
20+
source "$SCRIPTPATH/inc/app-git-latest-release-version.sh"
21+
echo -e "Available Version: ${GREEN}$AVAILABLEVERSION$ENDCOLOR"
2422

25-
vercomp "$OMBIINSTALLEDVERSION" "$OMBIAVAILABLETVERSION"
23+
vercomp "$OMBIINSTALLEDVERSION" "$AVAILABLEVERSION"
2624
if [[ $? != 2 ]]; then
2725
echo "Update not required"
2826
exit 1

radarr/radarr-constants.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ APPSHORTNAME='radarr'
55
APPPATH='/opt/radarr'
66
APPTITLE='radarr'
77
APPDEPS='libmono-cil-dev'
8-
APPDOWNLOADURL='https://api.github.com/Radarr/Radarr/releases'
8+
APPDOWNLOADURL='https://api.github.com/repos/radarr/radarr/releases'
9+
APPDOWNLOADEXT='linux.tar.gz'
10+
APPDOWNLOADSTRIP='--strip-components=1'
911
APPDPORT='7878'
1012
APPSETTINGSTYPE='DB'
1113
APPSETTINGSDIR="/home/$UNAME/.config/Radarr"

radarr/radarr-download.sh

-14
This file was deleted.

radarr/radarr-installer.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ source "$SCRIPTPATH/utils/mono/mono-installer.sh"
1111
source "$SCRIPTPATH/radarr/radarr-constants.sh"
1212
source "$SCRIPTPATH/inc/app-install-deps.sh"
1313
source "$SCRIPTPATH/inc/app-folders-create.sh"
14-
source "$SCRIPTPATH/radarr/radarr-download.sh"
14+
source "$SCRIPTPATH/inc/app-git-download-release.sh"
1515
source "$SCRIPTPATH/inc/app-autostart-configure.sh"
1616
source "$SCRIPTPATH/inc/app-set-permissions.sh"
1717
source "$SCRIPTPATH/inc/app-start.sh"

radarr/radarr-update.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if DoesAppFolderExist; then
1212
source "$SCRIPTPATH/radarr/radarr-constants.sh"
1313
source "$SCRIPTPATH/inc/app-install-deps.sh"
1414
if "$SCRIPTPATH/radarr/radarr-version-handler.sh"; then
15-
source "$SCRIPTPATH/radarr/radarr-download.sh"
15+
source "$SCRIPTPATH/inc/app-git-download-release.sh"
1616
fi
1717
source "$SCRIPTPATH/inc/app-set-permissions.sh"
1818
source "$SCRIPTPATH/inc/app-start.sh"

radarr/radarr-version-handler.sh

+4-9
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@
33

44
echo
55
source "$SCRIPTPATH/inc/commons.sh"
6+
source "$SCRIPTPATH/radarr/radarr-constants.sh"
67
echo -e "${YELLOW}--->Radarr Version Check...$ENDCOLOR"
7-
RADARRVERSION=$(curl -s https://api.github.com/repos/radarr/radarr/releases | \
8-
grep browser_download_url | \
9-
grep linux.tar.gz | \
10-
head -n 1 | \
11-
cut -d '"' -f 4 |
12-
cut -d/ -f8 |
13-
sed s'/[v"]//g')
14-
echo "Available Version: $RADARRVERSION"
8+
source "$SCRIPTPATH/inc/app-git-latest-release-version.sh"
9+
echo -e "Available Version: ${GREEN}$AVAILABLEVERSION$ENDCOLOR"
1510

16-
if ! checkappversion "RADARR" "$RADARRVERSION" ; then
11+
if ! checkappversion "RADARR" "$AVAILABLEVERSION" ; then
1712
exit 1
1813
fi

0 commit comments

Comments
 (0)