#!/bin/bash toolName=couchpotato toolDeps="git python-lxml python-pip libssl-dev libffi-dev" toolGit="https://github.com/CouchPotato/CouchPotatoServer.git" # Get script working directory # (when called from a different directory) WDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)" APTOPT= CONFIG=0 SCRIPT_NAME=$(basename -- $0) SCRIPT_NAME=${SCRIPT_NAME%%.*} CONFIG_FILE_NAME="${SCRIPT_NAME}.cfg" CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example" step_config() { initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE" if [ $? -eq 0 ] ; then CONFIG=1 else [ $DRY -eq 0 ] && return -1 fi [ $QUIET -ne 0 ] && APTOPT="-y" return 0 } step_1_info() { echo "Install $toolName" echoinfo "Default port: 5050" } step_1_alias() { ALIAS="install"; } step_1() { exe apt update exe apt install $toolDeps $APTOPT exe pip install --upgrade pyopenssl endReturn -o $? "Pip install pyopenssl failed" } step_2_info() { echo "Clone git repository"; } step_2() { exe git clone $toolGit "$CPO_INSTALL_DIR" } step_3_info() { echo "Create user $toolUser"; } step_3() { exe adduser --system --group --home "${CPO_INSTALL_DIR}" --no-create-home "$CPO_USER" exe chown -R ${CPO_USER}: "${CPO_INSTALL_DIR}" } step_4_info() { echo "Create systemd service"; } step_4() { exe cp "$CPO_INSTALL_DIR/init/couchpotato.service" "/etc/systemd/system" endReturn -o $? "Creating service file failed" exe systemctl daemon-reload } step_5_info() { echo "Add ufw rule for web interface"; } step_5_alias() { ALIAS="ufw"; } step_5() { exe ufw allow in on eth0 to any port 5050 proto tcp comment "couchpotato" } VERSION_SEQREV=12 . /usr/local/bin/sequencer.sh