forked from ungleich-public/cdist-contrib
100 lines
2.9 KiB
Bash
Executable File
100 lines
2.9 KiB
Bash
Executable File
#!/bin/sh -e
|
|
|
|
os="$(cat "${__global}/explorer/os")"
|
|
kernel_release="$(cat "${__object}/explorer/kernel_release")"
|
|
case "${os}" in
|
|
devuan|debian)
|
|
if echo "${kernel_release}" | grep -qE "cloud|rt"; then
|
|
printf "using wrong kernel ${kernel_release}, do/use: apt install linux-image-amd64" >&2
|
|
exit 1
|
|
fi
|
|
;;
|
|
#ubuntu)
|
|
#;;
|
|
# TODO on ubuntu you should also care about installing:
|
|
# linux-image-extra-virtual
|
|
# and to check for different kernel
|
|
# src https://github.com/jitsi/jibri#installation-notes
|
|
*)
|
|
echo "Your OS '${os}' is currently not supported." > /dev/stderr
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
__line /etc/modules --line "snd_aloop"
|
|
|
|
# thanks https://github.com/emrahcom/emrah-buster-templates/blob/master/machines/eb-jibri-template/usr/local/bin/finalize_recording.sh
|
|
__file "/opt/finalize_recording.sh" \
|
|
--mode 644 \
|
|
--source - << EOF
|
|
#!/bin/sh
|
|
set -e
|
|
|
|
exit 0
|
|
EOF
|
|
|
|
__apt_key 'jitsi_jibri' \
|
|
--source "${__type}/files/apt-jitsi-keyring.gpg" \
|
|
--state 'present'
|
|
|
|
require='__apt_key/jitsi_jibri' __apt_source jitsi_jibri \
|
|
--uri 'https://download.jitsi.org' \
|
|
--distribution 'stable/' \
|
|
--state present
|
|
|
|
__apt_key 'google_chrome' \
|
|
--source "${__type}/files/apt-google-chrome-keyring.gpg" \
|
|
--state 'present'
|
|
|
|
require='__apt_key/google_chrome' __apt_source google_chrome \
|
|
--uri 'http://dl.google.com/linux/chrome/deb/' \
|
|
--distribution 'stable' \
|
|
--component 'main' \
|
|
--state 'present'
|
|
|
|
## Ensure apt cache is up-to-date
|
|
__apt_update_index
|
|
|
|
PKGS="$( grep -v '#' <<END
|
|
jibri
|
|
google-chrome-stable
|
|
# extra deps
|
|
default-jre-headless ffmpeg curl alsa-utils icewm xdotool xserver-xorg-video-dummy ruby-hocon
|
|
END
|
|
)"
|
|
|
|
for pkg in ${PKGS}; do
|
|
require='__apt_update_index' __package "${pkg}"
|
|
done
|
|
|
|
|
|
# TODO CHROME_DRIVER explorer so this process is launched if needed
|
|
CHROME_DRIVER_VERSION="$(cat "${__type}/files/chrome-driver-version")"
|
|
CHROME_DRIVER_HASH="$(cat "${__type}/files/chrome-driver-hash")"
|
|
#echo "${CHROME_DRIVER_HASH}" >&2
|
|
#exit 1
|
|
__download '/tmp/chromedriver.zip' \
|
|
--url "https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip" \
|
|
--sum "${CHROME_DRIVER_HASH}"
|
|
CHROME_DRIVER_PATH='/usr/local/bin/chromedriver'
|
|
require='__download/chromedriver' __unpack '/tmp/chromedriver.zip' \
|
|
--destination "${CHROME_DRIVER_PATH}" \
|
|
--onchange "chown root:root ${CHROME_DRIVER_PATH} && chmod 0755 ${CHROME_DRIVER_PATH}"
|
|
|
|
CHROME_POLICIES='/etc/opt/chrome/policies/managed'
|
|
require='__package/google-chrome' __directory "${CHROME_POLICIES}" --parents
|
|
require="__directory/${CHROME_POLICIES}" __file "${CHROME_POLICIES}/managed_policies" \
|
|
--source '{ "CommandLineFlagSecurityWarningsEnabled": false }' \
|
|
--mode 644
|
|
|
|
# Proceed only after installation/upgrade has finished
|
|
export require="__package/jibri"
|
|
__user_groups jibri --group adm --group audio --group video --group plugdev
|
|
|
|
"${__type}/files/jibri.conf.sh" | \
|
|
__file /etc/jitsi/jibri/jibri.conf --mode 0444 --source '-'
|
|
|
|
__systemd_unit jibri.service \
|
|
--enablement-state enabled \
|
|
--restart
|