Created Update Script for Systemd (Ombi v3) (markdown)

master
Avi 7 years ago
parent 2aca0b4441
commit b016c2e1d6

@ -0,0 +1,59 @@
### Systemd (Ubuntu based distros)
**Create the Ombi update script**
nano ~/update_ombi.sh
**Paste in the following code (right click if using terminal)**
```
#!/bin/bash
installdir="/opt/ombi"
unzip-strip() (
local zip=$1
local dest=${2:-.}
local temp=$(mktemp -d) && tar -zxf "$zip" -C "$temp" && mkdir -p "$dest" &&
shopt -s dotglob && local f=("$temp"/*) &&
if (( ${#f[@]} == 1 )) && [[ -d "${f[0]}" ]] ; then
cp -r "$temp"/*/* "$dest"
else
cp -r "$temp"/* "$dest"
fi && rm -rf "$temp"/* "$temp"
)
echo "Downloading Ombi update..."
json=$(curl -sL https://ci.appveyor.com/api/projects/tidusjar/requestplex)
jobId=$(grep -Po '(?<="jobId":")([^"]+)' <<< "$json")
version=$(grep -Po '(?<="version":")([^"]+)' <<< "$json")
file=ombi_$version.tar.gz
size=$(curl -sL https://ci.appveyor.com/api/buildjobs/$jobId/artifacts | grep -Po '(?<="linux.tar.gz","type":"File","size":)(\d+)')
wget --quiet -O $file https://ci.appveyor.com/api/buildjobs/$jobId/artifacts/linux.tar.gz
echo Version $version downloaded...checking file size
if [ $(wc -c < $file) != $size ]; then
echo "Downloaded file size does not match expected file size...bailing!"
exit 1
fi
echo "File size validated...stopping Ombi..."
systemctl stop ombi.service
echo "Ombi stopped...installing update..."
unzip-strip $file $installdir
echo "Update installed...starting Ombi"
sudo systemctl start ombi.service
echo "Ombi started...cleaning up..."
rm -f $file
echo "Update complete"
```
> Note: Set installdir to your Ombi installation directory.
Press <kbd>Ctrl</kbd>+<kbd>X</kbd> then <kbd>y</kbd> to save (assuming you're using nano).
Make it executable
```
chmod +x ~/update_ombi.sh
```
When an update is provided for Ombi simply run
```
sudo ./update_ombi.sh
```
Loading…
Cancel
Save