From f6ccc54556fd6d075ab9624ebb365c22de4555a8 Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Sun, 21 Mar 2021 17:27:52 +0100 Subject: [PATCH] Sequence to install couchpotato --- seqs/couchpotato.cfg.example | 6 ++++ seqs/couchpotato.sh | 65 ++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 seqs/couchpotato.cfg.example create mode 100755 seqs/couchpotato.sh diff --git a/seqs/couchpotato.cfg.example b/seqs/couchpotato.cfg.example new file mode 100644 index 0000000..dffe06c --- /dev/null +++ b/seqs/couchpotato.cfg.example @@ -0,0 +1,6 @@ +#!/bin/bash + +#CPO = couchpotato + +CPO_USER="couchpotato" +CPO_INSTALL_DIR="/var/lib/CouchPotatoServer" diff --git a/seqs/couchpotato.sh b/seqs/couchpotato.sh new file mode 100755 index 0000000..cba0278 --- /dev/null +++ b/seqs/couchpotato.sh @@ -0,0 +1,65 @@ +#!/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