matterbridge - run as dedicated user
This commit is contained in:
@@ -3,31 +3,28 @@
|
||||
#
|
||||
## Installation of chat bridge matterbridge
|
||||
|
||||
toolName="matterbridge"
|
||||
repoName="42wim"
|
||||
toolLatestUrl="https://api.github.com/repos/${repoName}/${toolName}/releases/latest"
|
||||
toolVersion=$(curl --silent "$toolLatestUrl" | grep -Po '"tag_name": "v\K.*?(?=")')
|
||||
toolDownload="https://github.com/${repoName}/${toolName}/releases/download/v${toolVersion}/${toolName}-${toolVersion}-linux-armv6"
|
||||
toolDir="/usr/local/bin"
|
||||
toolLoc="${toolDir}/${toolName}"
|
||||
toolWdir="/opt/${toolName}"
|
||||
toolConfig="${toolName}.toml"
|
||||
toolConfigLoc="${toolWdir}/${toolConfig}"
|
||||
toolService="[Unit]
|
||||
readonly toolName="matterbridge"
|
||||
readonly repoName="42wim"
|
||||
readonly toolLatestUrl="https://api.github.com/repos/${repoName}/${toolName}/releases/latest"
|
||||
readonly toolVersion=$(curl --silent "$toolLatestUrl" | grep -Po '"tag_name": "v\K.*?(?=")')
|
||||
readonly toolDownload="https://github.com/${repoName}/${toolName}/releases/download/v${toolVersion}/${toolName}-${toolVersion}-linux-armv6"
|
||||
readonly toolDir="/usr/local/bin"
|
||||
readonly toolLoc="${toolDir}/${toolName}"
|
||||
readonly toolWdir="/etc/${toolName}"
|
||||
readonly toolConfig="${toolName}.toml"
|
||||
readonly toolConfigLoc="${toolWdir}/${toolConfig}"
|
||||
readonly toolUser='matterbridge'
|
||||
readonly toolService="[Unit]
|
||||
Description=${toolName}
|
||||
After=network.target matrix-synapse.service
|
||||
After=network-online.target matrix-synapse.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=${toolLoc} -conf ${toolWdir}/matterbridge.toml
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
RestartSec=5s
|
||||
WorkingDirectory=${toolWdir}
|
||||
User=root
|
||||
Group=root
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
SyslogIdentifier=${toolName}
|
||||
User=${toolUser}
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target"
|
||||
@@ -60,22 +57,27 @@ step_2() {
|
||||
exe chmod +x ${toolLoc}
|
||||
}
|
||||
|
||||
step_3_info() { echo "Creating systemd service"; }
|
||||
step_3_info() { echo "Creating system user ${toolUser}"; }
|
||||
step_3() {
|
||||
exe adduser --system --group --home "${toolWdir}" "${toolUser}"
|
||||
}
|
||||
|
||||
step_4_info() { echo "Creating systemd service"; }
|
||||
step_4() {
|
||||
addConf -s "$toolService" "$toolServiceLoc"
|
||||
endReturn -o $? "Creating service failed"
|
||||
}
|
||||
|
||||
step_4_info() { echo "Enable $toolName service"; }
|
||||
step_4() {
|
||||
step_5_info() { echo "Enable $toolName service"; }
|
||||
step_5() {
|
||||
exe systemctl enable ${toolName}
|
||||
echo " [I] Before proceeding to run ${toolName} you need to modify ${toolConfigLoc} first"
|
||||
echo
|
||||
}
|
||||
|
||||
step_5_info() { echo "Show configuration notes"; }
|
||||
step_5_alias() { echo "notes"; }
|
||||
step_5() {
|
||||
step_6_info() { echo "Show configuration notes"; }
|
||||
step_6_alias() { echo "notes"; }
|
||||
step_6() {
|
||||
color green
|
||||
cat <<NOTES_END
|
||||
|
||||
@@ -190,12 +192,12 @@ whatsappmulti"
|
||||
}
|
||||
|
||||
step_32_info() { echo "Clean temporary files"; }
|
||||
step_32_alias() { echo "clean"; }
|
||||
step_32() {
|
||||
exe rm -f "${goDownLoc}"
|
||||
}
|
||||
|
||||
# Sequence Revision
|
||||
# shellcheck disable=SC2034 # Appears unused
|
||||
readonly sqr_minVersion=16
|
||||
|
||||
# Path to sequencer
|
||||
# shellcheck disable=SC1091 # Don't follow this source
|
||||
. /usr/local/bin/sequencer.sh
|
||||
|
Reference in New Issue
Block a user