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