__matterbridge: add support for ubuntu, fix configuration via STDIN

This commit is contained in:
fnux 2021-12-23 12:30:58 +01:00
parent 35e299a5d1
commit afe76af679
No known key found for this signature in database
GPG key ID: 4502C902C00A1E12

View file

@ -20,7 +20,7 @@
os=$(cat "$__global/explorer/os")
case "$os" in
debian)
debian|ubuntu)
# This type assume systemd for service installation.
;;
*)
@ -31,11 +31,13 @@ case "$os" in
esac
# Required parameters.
VERSION=$(cat "$__object/parameter/version")
version=$(cat "$__object/parameter/version")
if [ -f "$__object/parameter/config" ]; then
CONFIG="$(cat "$__object/parameter/config")"
if [ "$CONFIG" = "-" ]; then
CONFIG=$(cat "$__object/stdin")
config="$(cat "$__object/parameter/config")"
if [ "$config" = "-" ]; then
mkdir -p "$__object/files"
config="$__object/files/matterbridge.toml"
cat "$__object/stdin" > "$config"
fi
fi
@ -46,11 +48,11 @@ export USER=matterbridge
export GROUP=$USER
# Internal variables.
artefact="matterbridge-$VERSION-linux-64bit"
artefact="matterbridge-$version-linux-64bit"
checksum_file="checksums.txt"
release_download_url=https://github.com/42wim/matterbridge/releases/download
binary_url="$release_download_url/v$VERSION/$artefact"
checksum_file_url="$release_download_url/v$VERSION/$checksum_file"
binary_url="$release_download_url/v$version/$artefact"
checksum_file_url="$release_download_url/v$version/$checksum_file"
config_dir=$(dirname $CONFIG_PATH)
systemd_unit_path='/etc/systemd/system/matterbridge.service'
@ -88,7 +90,7 @@ require="__user/$USER" __directory "$config_dir" \
require="__directory/$config_dir" __file "$CONFIG_PATH" \
--owner "$USER" \
--mode 0640 \
--source "$CONFIG"
--source "$config"
__file "$systemd_unit_path" \
--source "$__object/files/matterbridge.service"