Skip to content

Commit 9122146

Browse files
authored
Ombi v3
* Ombi updated to v3 Reverse Proxy still needs fixing.
1 parent 8155834 commit 9122146

13 files changed

+108
-56
lines changed

ombi/ombi-constants.sh

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
APPNAME='ombi'
44
APPSHORTNAME='ombi'
5-
APPPATH='/opt/ombi'
5+
APPPATH='/opt/Ombi'
66
APPTITLE='Ombi'
7-
APPDEPS='libmono-cil-dev'
7+
APPDEPS='libunwind8 libcurl4-openssl-dev'
88
APPDOWNLOADURL='https://api.github.com/ombi/ombi/releases'
9-
APPDPORT='3579'
9+
APPDPORT='5000'
1010
APPSETTINGSTYPE='DB'
1111
APPSETTINGSDIR=$APPPATH
12-
APPSETTINGSDB=$APPSETTINGSDIR'/Ombi.sqlite'
12+
APPSETTINGSDB="$APPSETTINGSDIR/Ombi.db"
1313
ACCESSHOST='NA'
14-
DBUSERSEARCH='SELECT UserName FROM Users WHERE ID = 1;'
14+
DBUSERSEARCH='SELECT aspnetusers FROM Users ORDER BY ROWID ASC LIMIT 1;'
1515
APPSYSTEMD='ombi.service'
16-
APPSYSTEMDLOC=$SCRIPTPATH'/ombi/'$APPSYSTEMD
16+
APPSYSTEMDLOC="$SCRIPTPATH/ombi/$APPSYSTEMD"
1717
APPINITD='ombi'
18-
APPINITDLOC=$SCRIPTPATH'/ombi/ombi.init'
18+
APPINITDLOC="$SCRIPTPATH/ombi/ombi.init"

ombi/ombi-download.sh

+16-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
#!/bin/bash
2-
# Script Name: AtoMiC Ombi Installer
2+
# Script Name: AtoMiC Ombi Downloader
33

44
echo
5-
echo -e "${YELLOW}--->Latest File Found...$ENDCOLOR"
6-
OUTPUT="$(curl -s https://api.github.com/repos/tidusjar/Ombi/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4)"
5+
ARCH=$(uname -m)
6+
ARCHSHORT=${ARCH:0:3}
7+
if [[ $ARCHSHORT = 'arm' ]]; then
8+
FILENAME='linux-arm.tar.gz'
9+
else
10+
FILENAME='linux.tar.gz'
11+
fi
12+
13+
OUTPUT="$(curl -s https://api.github.com/repos/tidusjar/Ombi/releases | \
14+
grep browser_download_url | \
15+
grep $FILENAME | \
16+
head -n 1 | \
17+
cut -d '"' -f 4)"
718
echo "${OUTPUT}"
819
echo
9-
echo -e "${YELLOW}--->Downloading files...$ENDCOLOR"
10-
sudo rm -rf /tmp/ombidownload
11-
sudo wget -P /tmp/ombidownload "${OUTPUT}"
12-
echo -e "${YELLOW}--->Extracting files...$ENDCOLOR"
13-
sudo unzip -q /tmp/ombidownload/*.zip -d /tmp/ombidownload/extract
14-
sudo mv /tmp/ombidownload/extract/Release/* "$APPPATH"
20+
echo -e "$YELLOW--->Downloading and extracting Latest Release File...$ENDCOLOR"
21+
sudo curl -L "${OUTPUT}" | tar -xzf - -C "$APPPATH"

ombi/ombi-folders-list

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/opt/ombi
1+
APPPATH

ombi/ombi-init-update.sh

+8-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
# Script Name: AtoMiC Ombi init.d update
33

44
echo 'Updating init.d file'
5-
sudo sed -i "s@user=\"ReplaceMe\"@user=\"$UNAME\"@g" /etc/init.d/$APPINITD || \
6-
{ echo -e "${RED}Replacing user failed.$ENDCOLOR" ; exit 1; }
5+
if sudo sed -i "s@user=\"ReplaceMe\"@user=\"$UNAME\"@g" "/etc/init.d/$APPINITD" || \
6+
{ echo -e "${RED}Replacing user failed.$ENDCOLOR" ; exit 1; }; then
7+
echo "Set USER to $UNAME"
8+
fi
79

8-
sudo sed -i "s@group=\"ReplaceMe\"@group=\"$UGROUP\"@g" /etc/init.d/$APPINITD || \
9-
{ echo -e "${RED}Replacing group failed.$ENDCOLOR" ; exit 1; }
10+
if sudo sed -i "s@group=\"ReplaceMe\"@group=\"$UGROUP\"@g" "/etc/init.d/$APPINITD" || \
11+
{ echo -e "${RED}Replacing group failed.$ENDCOLOR" ; exit 1; }; then
12+
echo "Set GROUP to $UGROUP"
13+
fi

ombi/ombi-installer.sh

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
11
#!/bin/bash
22
# Script Name: AtoMiC Ombi Installer
3-
4-
source "$SCRIPTPATH/inc/app-setup-check.sh"
3+
54
source "$SCRIPTPATH/inc/commons.sh"
65
source "$SCRIPTPATH/inc/header.sh"
76
echo -e "${GREEN}AtoMiC $APPTITLE Installer Script$ENDCOLOR"
87
source "$SCRIPTPATH/inc/pause.sh"
98
source "$SCRIPTPATH/inc/app-autostart-remove.sh"
9+
10+
# Added 15/03/2018 - Can be removed once users have updated.
11+
# Removes old install.
12+
if [[ -d /opt/ombi ]]; then
13+
if sudo rm -r '/opt/ombi'; then
14+
echo
15+
echo 'Removed old /opt/ombi as its not compatable with Ombi V3'
16+
fi
17+
fi
18+
1019
source "$SCRIPTPATH/inc/app-move-previous.sh"
11-
source "$SCRIPTPATH/utils/mono/mono-installer.sh"
12-
source "$SCRIPTPATH/ombi/ombi-constants.sh"
1320
source "$SCRIPTPATH/inc/app-install-deps.sh"
1421
source "$SCRIPTPATH/inc/app-folders-create.sh"
1522
source "$SCRIPTPATH/ombi/ombi-download.sh"

ombi/ombi-systemd-update.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
#!/bin/bash
22
# Script Name: AtoMiC Ombi Systemd Update
33

4-
sudo sed -i "s@User=ReplaceMe@User=$UNAME@g" /etc/systemd/system/$APPSYSTEMD || { echo -e $RED'Modifying USER in SYSTEMD file failed.'$ENDCOLOR; exit 1; }
5-
sudo sed -i "s@Group=ReplaceMe@Group=$UGROUP@g" /etc/systemd/system/$APPSYSTEMD || { echo -e $RED'Modifying GROUP in SYSTEMD file failed.'$ENDCOLOR; exit 1; }
4+
if sudo sed -i "s@User=ReplaceMe@User=$UNAME@g" "/etc/systemd/system/$APPSYSTEMD" || \
5+
{ echo -e "${RED}Modifying USER in SYSTEMD file failed.$ENDCOLOR"; exit 1; }; then
6+
echo "Set USER to $UNAME"
7+
fi
8+
9+
if sudo sed -i "s@Group=ReplaceMe@Group=$UGROUP@g" "/etc/systemd/system/$APPSYSTEMD" || \
10+
{ echo -e "${RED}Modifying GROUP in SYSTEMD file failed.$ENDCOLOR"; exit 1; }; then
11+
echo "Set GROUP to $UGROUP"
12+
fi
613

714
sudo systemctl daemon-reload
815
sudo systemctl enable $APPSYSTEMD

ombi/ombi-uninstaller.sh

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
22
# Script Name: AtoMiC Ombi Uninstaller
33

4-
source "$SCRIPTPATH/inc/app-setup-check.sh"
54
source "$SCRIPTPATH/inc/commons.sh"
65
source "$SCRIPTPATH/inc/header.sh"
76
echo -e "${GREEN}AtoMiC $APPTITLE Uninstaller Script$ENDCOLOR"

ombi/ombi-update.sh

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

99
if DoesAppFolderExist; then
10-
source "$SCRIPTPATH/inc/app-stop.sh"
11-
source "$SCRIPTPATH/utils/mono/mono-installer.sh"
12-
source "$SCRIPTPATH/ombi/ombi-constants.sh"
13-
source "$SCRIPTPATH/inc/app-install-deps.sh"
14-
source "$SCRIPTPATH/ombi/ombi-download.sh"
15-
source "$SCRIPTPATH/inc/app-set-permissions.sh"
16-
source "$SCRIPTPATH/inc/app-start.sh"
17-
source "$SCRIPTPATH/inc/app-update-confirmation.sh"
18-
source "$SCRIPTPATH/inc/thankyou.sh"
10+
if source "$SCRIPTPATH/ombi/ombi-version-check.sh"; then
11+
source "$SCRIPTPATH/inc/app-stop.sh"
12+
source "$SCRIPTPATH/inc/app-install-deps.sh"
13+
source "$SCRIPTPATH/ombi/ombi-download.sh"
14+
source "$SCRIPTPATH/inc/app-set-permissions.sh"
15+
source "$SCRIPTPATH/inc/app-start.sh"
16+
source "$SCRIPTPATH/inc/app-update-confirmation.sh"
17+
source "$SCRIPTPATH/inc/thankyou.sh"
18+
fi
1919
fi
20+
2021
source "$SCRIPTPATH/inc/exit.sh"

ombi/ombi-version-check.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
# Script Name: AtoMiC Ombi Downloader
3+
4+
echo
5+
source "$SCRIPTPATH/inc/commons.sh"
6+
echo -e "${YELLOW}--->Ombi Version Check...$ENDCOLOR"
7+
CONTENT=$(echo 'select content from globalsettings;' | sqlite3 "$APPSETTINGSDB")
8+
OMBIAPIKEY=$(grep -Po '(?<="ApiKey":")([^"]+)' <<< "$CONTENT")
9+
10+
if [[ -n $OMBIAPIKEY ]]; then
11+
OMBIJSON=$(curl -sL --header "ApiKey: $OMBIAPIKEY" localhost:5000/api/v1/Settings/about)
12+
OMBIINSTALLEDVERSION=$(grep -Po '(?<="version":")([^"]+)' <<< "$OMBIJSON")
13+
echo -e "Installed Version: ${GREEN}$OMBIINSTALLEDVERSION$ENDCOLOR"
14+
else
15+
echo -e "${YELLOW}ERROR: unable to retrieve APIKEY. Is it set in the Ombi settings?$ENDCOLOR"
16+
echo "Updating continuing however possibly not necessary"
17+
fi
18+
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"
24+
25+
vercomp "$OMBIINSTALLEDVERSION" "$OMBIAVAILABLETVERSION"
26+
if [[ $? != 2 ]]; then
27+
echo "Update not required"
28+
exit 1
29+
else
30+
echo "Update Required"
31+
fi

ombi/ombi.init

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
user="ReplaceMe"
1313
group="ReplaceMe"
14-
dir="/opt/ombi"
15-
cmd="/usr/bin/mono Ombi.exe"
14+
dir="/opt/Ombi"
15+
cmd="/opt/Ombi/Ombi"
1616

1717
name=`basename $0`
1818
PIDDIR="/var/run/$name"

ombi/ombi.service

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
[Unit]
2-
Description=Ombi
3-
After=syslog.target network.target
2+
Description=Ombi - PMS Requests System
3+
After=network-online.target
44

55
[Service]
66
User=ReplaceMe
77
Group=ReplaceMe
8-
8+
WorkingDirectory=/opt/Ombi/
9+
ExecStart=/opt/Ombi/Ombi
910
Type=simple
10-
ExecStart=/usr/bin/mono /opt/ombi/Ombi.exe
1111
TimeoutStopSec=30
12-
Restart=always
12+
Restart=on-failure
1313
RestartSec=5
1414

1515
[Install]

transmission-daemon/transmission-daemon-settings-configurator.sh

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ echo
55
echo -e "$YELLOW--->Configuring Transmission Settings...$ENDCOLOR"
66

77
#Set to allow network access instead of localhost.
8+
89
if sudo sed -i "s@\"rpc-whitelist-enabled\": \
910
true@\"rpc-whitelist-enabled\": false@g" "$APPSETTINGS" || \
1011
{ echo -e "${RED}Modifying whitelist enabled in \
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
# Version=1.0
2-
# # Ombi v2
1+
# Version=2.0
2+
3+
# Ombi v3
34
location /ombi/ {
4-
proxy_pass http://127.0.0.1:3579;
5+
proxy_pass http://127.0.0.1:5000;
56
proxy_set_header X-Forwarded-Ssl on; # This needs to be here for Ombi to work, even though it's in proxy.conf
67
}
7-
8-
# # Ombi v3 (including this for later)
9-
# location /ombi/ {
10-
# proxy_pass http://127.0.0.1:5000;
11-
# proxy_set_header X-Forwarded-Ssl on; # This needs to be here for Ombi to work, even though it's in proxy.conf
12-
# }
13-
# if ($http_referer ~* /ombi/) {
14-
# rewrite ^/dist/([0-9\d*]).js /ombi/dist/$1.js last;
15-
# }
8+
if ($http_referer ~* /ombi/) {
9+
rewrite ^/dist/([0-9\d*]).js /ombi/dist/$1.js last;
10+
}

0 commit comments

Comments
 (0)