matrix-commander - Finalized for manual installation

This commit is contained in:
2022-03-09 12:01:31 +01:00
parent 3fc647aef8
commit 8cf808d70b
2 changed files with 40 additions and 28 deletions

View File

@@ -3,3 +3,23 @@
MACO_USER="matrixcommander" MACO_USER="matrixcommander"
MACO_BASE_DIR="/opt/matrix-commander" MACO_BASE_DIR="/opt/matrix-commander"
MACO_DIR="$MACO_BASE_DIR/matrix-commander" MACO_DIR="$MACO_BASE_DIR/matrix-commander"
MACO_SERVICE="[Unit]
Description=Matrix-Commander
After=syslog.target network-online.target
StartLimitIntervalSec=0
[Service]
User=$MACO_USER
Group=$MACO_USER
Type=simple
ExecStart=${MACO_BASE_DIR}/bin/python3 ${MACO_DIR}/matrix-commander.py --listen forever --listen-self
TimeoutStopSec=20
#KillMode=process
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Alias=matrix-commander.service"

View File

@@ -36,14 +36,19 @@ step_config() {
} }
step_1_info() { echo "Add system user"; } step_1_info() { echo "Install $toolName dependencies"; }
step_1_alias() { ALIAS="install"; } step_1_alias() { ALIAS="install"; }
step_1() { step_1() {
exe adduser --system $MACO_USER --group --home "${MACO_BASE_DIR}" apt install $toolDeps $APTOPT
} }
step_2_info() { echo "Create venv and install $toolName"; } step_2_info() { echo "Add system user $MACO_USER"; }
step_2() { step_2() {
exe adduser --system $MACO_USER --group --home "${MACO_BASE_DIR}"
}
step_3_info() { echo "Create venv and install $toolName"; }
step_3() {
local macommanderDir="${MACO_DIR}" local macommanderDir="${MACO_DIR}"
exe python3 -m venv "$toolVenvDir" exe python3 -m venv "$toolVenvDir"
@@ -54,8 +59,8 @@ step_2() {
exe sudo -u $MACO_USER ${toolVenvDir}/bin/pip install --upgrade pip exe sudo -u $MACO_USER ${toolVenvDir}/bin/pip install --upgrade pip
} }
step_3_info() { echo "Install python requirements"; } step_4_info() { echo "Install python requirements"; }
step_3() { step_4() {
cat <<NOTES_END cat <<NOTES_END
# Remove following packages for headless servers # Remove following packages for headless servers
@@ -68,33 +73,20 @@ NOTES_END
} }
step_4_info() { echo "Create systemd service for $toolName"; } step_6_info() { echo "Create systemd service for $toolName"; }
step_4() { step_6_alias() { ALIAS="service"; }
step_6() {
local macommanderServiceLoc="/etc/systemd/system/matrix-commander.service" local macommanderServiceLoc="/etc/systemd/system/matrix-commander.service"
local lService=$(eval "echo \"$macommanderService\"") addConf -s "$MACO_SERVICE" "$macommanderServiceLoc"
addConf -s "$lService" "$macommanderServiceLoc"
exe systemctl daemon-reload exe systemctl daemon-reload
} }
macommanderService="[Unit]
Description=Matrix-Commander
After=syslog.target network-online.target
StartLimitIntervalSec=0
[Service] step_10_info() { echo "Run $toolName"; }
User=\$MACO_USER step_10_alias() { ALIAS="run"; }
Group=\$MACO_USER step_10() {
shift
Type=simple exe sudo -u $MACO_USER "$toolVenvDir/bin/python3" "$MACO_DIR/matrix-commander.py" "$@"
}
ExecStart=\${toolVenvDir}/bin/python3 \${MACO_DIR}/matrix-commander.py
TimeoutStopSec=20
#KillMode=process
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Alias=matrix-commander.service"
VERSION_SEQREV=15 VERSION_SEQREV=15
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh