Files
shell_sequencer/seqs/pyload.sh
Martin Winkler 317b2088f0 Add step to upgrade to latest version
Raised dependency to sequencer 10
2020-02-11 11:36:21 +01:00

78 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
toolName="pyload"
toolUser="${toolName}"
toolBranch="stable"
toolLoc=/opt/pyload
toolDownload="https://github.com/pyload/pyload.git"
toolDeps="git liblept5 python python-crypto python-pycurl python-imaging python-sleekxmpp tesseract-ocr zip unzip python-openssl libmozjs-24-bin"
toolBuildDeps="rar unrar-nonfree"
step_1_info() { echo "Apt sources.list check and update"; }
step_1_alias() { ALIAS="install"; }
step_1() {
echo "Make sure you have the \"deb-src\" entry active in your /etc/apt/sources.list"
echo "Especially check for \"non-free\""
exe read -p "Press Enter to continue: "
exe vi /etc/apt/sources.list
exe apt update
}
step_2_info() { echo "Install dependencies $toolDeps $toolBuildDeps"; }
step_2() {
exe apt-get install ${toolDeps}
exe apt-get build-dep ${toolBuildDeps}
saveReturn $?
endReturn
cd /usr/bin
exe ln -s js24 js
cd /tmp
exe apt-get source -b unrar-nonfree
saveReturn $?
endReturn
exe dpkg -i unrar_*_armhf.deb
exe rm -rf unrar-*
}
step_3_info() { echo "Get $toolName from $toolDownload and create dedicated user"; }
step_3() {
exe git clone -b $toolBranch $toolDownload "$toolLoc"
endReturn -o $? "Git clone failed"
exe adduser --system "$toolUser"
}
step_4_info() { echo "Make initial configuration"; }
step_4() {
echo "Webinterface server \"threaded\" is recommended on a raspberry pi."
exe read -p "Press Enter to continue: "
exe cd "$toolLoc"
exe sudo -u $toolUser python pyLoadCore.py
}
step_5_info() { echo "Create systemd service"; }
step_5() {
addConf -c "$toolService" "$toolServiceLoc"
}
toolServiceLoc="/etc/systemd/system/pyload.service"
toolService="\
[Unit]
Description=Python Downloader
After=network.target
[Service]
User=pyload
ExecStart=/usr/bin/python /opt/pyload/pyLoadCore.py
[Install]
WantedBy=multi-user.target"
step_10_info() { echo "Upgrade to latest version of branch $toolBranch"; }
step_10_alias() { ALIAS="upgrade"; }
step_10() {
exe cd $toolLoc
exe git pull
exe service $toolName restart
}
VERSION_SEQREV=10
. /usr/local/bin/sequencer.sh