2022-05-08 20:30:27 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2022-05-09 00:23:38 +00:00
|
|
|
JIBRI_HOST="${__target_host}"
|
|
|
|
JIBRI_AUTH_PASS='jibriauthpass'
|
|
|
|
JIBRI_RECORDER_PASS='jibrirecorderpass'
|
|
|
|
|
2022-05-08 20:30:27 +00:00
|
|
|
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
|
2022-05-10 12:36:24 +00:00
|
|
|
echo "using wrong kernel ${kernel_release}, do/use: apt install linux-image-amd64" >&2
|
2022-05-08 20:30:27 +00:00
|
|
|
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
|
|
|
|
*)
|
2022-05-10 12:36:24 +00:00
|
|
|
echo "Your OS '${os}' is currently not supported." >&2
|
2022-05-08 20:30:27 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2022-05-09 00:23:38 +00:00
|
|
|
__line '/etc/modules' --line 'snd_aloop' --onchange 'modprobe snd_aloop'
|
2022-05-08 20:30:27 +00:00
|
|
|
|
|
|
|
# thanks https://github.com/emrahcom/emrah-buster-templates/blob/master/machines/eb-jibri-template/usr/local/bin/finalize_recording.sh
|
2022-05-09 00:23:38 +00:00
|
|
|
__file '/opt/finalize_recording.sh' \
|
|
|
|
--mode '755' \
|
2022-06-08 16:53:19 +00:00
|
|
|
--source "${__type}/files/finalize_recording.sh"
|
2022-05-08 20:30:27 +00:00
|
|
|
|
2022-05-09 00:23:38 +00:00
|
|
|
__apt_key 'jitsi_meet' \
|
|
|
|
--source "${__type}/files/apt-jitsi-keyring.gpg"
|
2022-05-08 20:30:27 +00:00
|
|
|
|
2022-05-09 00:23:38 +00:00
|
|
|
require='__apt_key/jitsi_meet' __apt_source 'jitsi_meet' \
|
2022-05-08 20:30:27 +00:00
|
|
|
--uri 'https://download.jitsi.org' \
|
2022-05-09 00:23:38 +00:00
|
|
|
--distribution 'stable/'
|
|
|
|
|
|
|
|
__apt_key 'google-chrome' \
|
|
|
|
--source "${__type}/files/apt-google-chrome-keyring.gpg"
|
2022-05-08 20:30:27 +00:00
|
|
|
|
2022-05-09 00:23:38 +00:00
|
|
|
__apt_source 'debian9' \
|
|
|
|
--uri 'http://security.debian.org/debian-security' \
|
|
|
|
--distribution 'stretch/updates' \
|
|
|
|
--component 'main'
|
2022-05-08 20:30:27 +00:00
|
|
|
|
2022-05-09 00:23:38 +00:00
|
|
|
# google-chrome object id is important because after google-chrome installation
|
|
|
|
# the apt file would be duplicated, making apt update process to fail
|
|
|
|
require='__apt_key/google-chrome' __apt_source google-chrome \
|
2022-05-08 20:30:27 +00:00
|
|
|
--uri 'http://dl.google.com/linux/chrome/deb/' \
|
|
|
|
--distribution 'stable' \
|
2022-05-09 00:23:38 +00:00
|
|
|
--component 'main'
|
2022-05-08 20:30:27 +00:00
|
|
|
|
|
|
|
## Ensure apt cache is up-to-date
|
2022-05-09 00:23:38 +00:00
|
|
|
require='__apt_source/jitsi_meet __apt_source/google-chrome __apt_source/debian9' __check_messages update_jibri \
|
2022-06-08 14:02:46 +00:00
|
|
|
--pattern '^__apt_source/(jitsi_meet|google-chrome|debian9)' \
|
2022-05-09 00:23:38 +00:00
|
|
|
--execute 'apt update'
|
2022-05-08 20:30:27 +00:00
|
|
|
|
|
|
|
PKGS="$( grep -v '#' <<END
|
|
|
|
jibri
|
|
|
|
# extra deps
|
|
|
|
default-jre-headless ffmpeg curl alsa-utils icewm xdotool xserver-xorg-video-dummy ruby-hocon
|
2022-05-09 00:23:38 +00:00
|
|
|
google-chrome-stable
|
|
|
|
# old java for jibri
|
|
|
|
openjdk-8-jdk-headless
|
2022-05-08 20:30:27 +00:00
|
|
|
END
|
|
|
|
)"
|
|
|
|
|
|
|
|
for pkg in ${PKGS}; do
|
2022-05-09 00:23:38 +00:00
|
|
|
require='__check_messages/update_jibri' __package "${pkg}"
|
2022-05-08 20:30:27 +00:00
|
|
|
done
|
|
|
|
|
2022-05-09 00:23:38 +00:00
|
|
|
# TODO CHROME_DRIVER explorer so this process is launched only if needed
|
|
|
|
# src https://github.com/jitsi/jibri#google-chrome-stable--chromedriver
|
2022-05-08 20:30:27 +00:00
|
|
|
CHROME_DRIVER_VERSION="$(cat "${__type}/files/chrome-driver-version")"
|
|
|
|
CHROME_DRIVER_HASH="$(cat "${__type}/files/chrome-driver-hash")"
|
|
|
|
__download '/tmp/chromedriver.zip' \
|
|
|
|
--url "https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip" \
|
|
|
|
--sum "${CHROME_DRIVER_HASH}"
|
2022-05-09 00:23:38 +00:00
|
|
|
CHROME_DRIVER_PATH='/usr/local/bin'
|
|
|
|
require='__download/tmp/chromedriver.zip' __unpack '/tmp/chromedriver.zip' \
|
2022-05-08 20:30:27 +00:00
|
|
|
--destination "${CHROME_DRIVER_PATH}" \
|
|
|
|
--onchange "chown root:root ${CHROME_DRIVER_PATH} && chmod 0755 ${CHROME_DRIVER_PATH}"
|
|
|
|
|
|
|
|
CHROME_POLICIES='/etc/opt/chrome/policies/managed'
|
2022-05-09 00:23:38 +00:00
|
|
|
require='__package/google-chrome-stable' __directory "${CHROME_POLICIES}" --parents
|
2022-05-08 20:30:27 +00:00
|
|
|
require="__directory/${CHROME_POLICIES}" __file "${CHROME_POLICIES}/managed_policies" \
|
2022-05-09 00:23:38 +00:00
|
|
|
--mode '644' \
|
|
|
|
--source '-' <<EOF
|
|
|
|
{ "CommandLineFlagSecurityWarningsEnabled": false }
|
|
|
|
EOF
|
2022-05-08 20:30:27 +00:00
|
|
|
|
|
|
|
# Proceed only after installation/upgrade has finished
|
2022-05-10 12:36:24 +00:00
|
|
|
export require='__package/jibri'
|
2022-05-09 00:23:38 +00:00
|
|
|
__user_groups 'jibri' --group 'adm' --group 'audio' --group 'video' --group 'plugdev'
|
2022-05-08 20:30:27 +00:00
|
|
|
|
2022-06-08 14:02:46 +00:00
|
|
|
# shellcheck source=type/__jitsi_jibri/files/jibri.conf.sh
|
|
|
|
. "${__type}/files/jibri.conf.sh" # This defines JIBRI_CONFIG
|
|
|
|
__file '/etc/jitsi/jibri/jibri.conf' \
|
|
|
|
--mode '0444' \
|
|
|
|
--source '-' <<EOF
|
|
|
|
${JIBRI_CONFIG}
|
|
|
|
EOF
|
2022-05-09 00:23:38 +00:00
|
|
|
|
|
|
|
# thanks https://community.jitsi.org/t/jibri-recording-resolution-to-record-a-full-window-at-720p-without-cropping/104442
|
2022-06-08 14:02:46 +00:00
|
|
|
# shellcheck source=type/__jitsi_jibri/files/xorg-video-dummy.conf
|
|
|
|
. "${__type}/files/xorg-video-dummy.conf.sh" # This defines JIBRI_XORG_CONFIG
|
|
|
|
__file '/etc/jitsi/jibri/xorg-video-dummy.conf' \
|
|
|
|
--mode '0444' \
|
|
|
|
--source '-' <<EOF
|
|
|
|
${JIBRI_XORG_CONFIG}
|
|
|
|
EOF
|
2022-05-09 00:23:38 +00:00
|
|
|
|
|
|
|
__file '/opt/jitsi/jibri/launch.sh' \
|
|
|
|
--onchange 'systemctl daemon-reload && systemctl restart jibri.service' \
|
|
|
|
--mode 755 \
|
|
|
|
--source '-' <<EOF
|
|
|
|
#!/bin/bash
|
2022-05-10 12:36:24 +00:00
|
|
|
# Managed remotely, changes will be lost
|
2022-05-09 00:23:38 +00:00
|
|
|
|
|
|
|
exec /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Djava.util.logging.config.file=/etc/jitsi/jibri/logging.properties -Dconfig.file="/etc/jitsi/jibri/jibri.conf" -jar /opt/jitsi/jibri/jibri.jar --config "/etc/jitsi/jibri/config.json"
|
|
|
|
EOF
|
2022-06-08 14:02:46 +00:00
|
|
|
|
|
|
|
__systemd_unit 'jibri.service' \
|
|
|
|
--enablement-state 'enabled'
|