From 65c1e5f4ee950e3417b38a0d89c4fcee534d8687 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 12 2021 13:22:37 +0000
Subject: [PATCH 1/21] Added 2 missing runtime dependencies


---

diff --git a/jibri/jibri.spec b/jibri/jibri.spec
index 71674d7..ea7f759 100644
--- a/jibri/jibri.spec
+++ b/jibri/jibri.spec
@@ -55,6 +55,8 @@ instructions.
 %prep
 %autosetup -p1
 %pom_add_dep rusv:agafua-syslog:0.4:runtime
+%pom_add_dep javax.activation:activation:1.1.1:runtime
+%pom_add_dep org.glassfish.jaxb:jaxb-runtime:2.3.2:runtime
 %pom_add_plugin :maven-jar-plugin:2.3 . \
     '<configuration><archive><manifest><addClasspath>true</addClasspath><useUniqueVersions>false</useUniqueVersions><classpathPrefix>lib</classpathPrefix><mainClass>${exec.mainClass}</mainClass></manifest></archive></configuration>'
 

From a2efaf13641be3855cf303d568e4b3237b6a0759 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 18 2021 09:47:41 +0000
Subject: [PATCH 2/21] Do not hardcode chromedriver logging path


---

diff --git a/jibri/0002-allow-overriding-webdriver-log.patch b/jibri/0002-allow-overriding-webdriver-log.patch
new file mode 100644
index 0000000..e407ff2
--- /dev/null
+++ b/jibri/0002-allow-overriding-webdriver-log.patch
@@ -0,0 +1,12 @@
+diff -Naur a/src/main/kotlin/org/jitsi/jibri/selenium/JibriSelenium.kt b/src/main/kotlin/org/jitsi/jibri/selenium/JibriSelenium.kt
+--- a/src/main/kotlin/org/jitsi/jibri/selenium/JibriSelenium.kt	2019-08-21 19:10:53.000000000 +0200
++++ b/src/main/kotlin/org/jitsi/jibri/selenium/JibriSelenium.kt	2021-02-17 23:14:38.686581290 +0100
+@@ -130,7 +130,7 @@
+      * Set up default chrome driver options (using fake device, etc.)
+       */
+     init {
+-        System.setProperty("webdriver.chrome.logfile", "/tmp/chromedriver.log")
++        System.setProperty("webdriver.chrome.logfile", System.getProperty("webdriver.chrome.logfile", "/tmp/chromedriver.log"))
+         val chromeOptions = ChromeOptions()
+         chromeOptions.addArguments(
+                 "--use-fake-ui-for-media-stream",
diff --git a/jibri/jibri.service b/jibri/jibri.service
index 581175c..c380c19 100644
--- a/jibri/jibri.service
+++ b/jibri/jibri.service
@@ -6,6 +6,7 @@ After=network.target
 [Service]
 User=jibri
 Group=jibri
+Environment=DISPLAY=:0
 EnvironmentFile=-/etc/sysconfig/jibri
 ExecStart=/usr/libexec/jibri start
 ExecStop=/usr/libexec/jibri graceful
diff --git a/jibri/jibri.sh b/jibri/jibri.sh
index c9a6ff4..6f115a6 100644
--- a/jibri/jibri.sh
+++ b/jibri/jibri.sh
@@ -2,7 +2,7 @@
 
 case "$1" in
     start)
-        exec java -Djava.util.logging.config.file=/etc/jibri/logging.properties -jar /usr/share/jibri/jibri.jar --config /etc/jibri/config.json
+        exec java -Djava.util.logging.config.file=/etc/jibri/logging.properties ${JIBRI_JAVA_OPTIONS} -jar /usr/share/jibri/jibri.jar --config /etc/jibri/config.json
         ;;
     graceful)
         exec curl -X POST http://127.0.0.1:3333/jibri/api/internal/v1.0/gracefulShutdown
diff --git a/jibri/jibri.spec b/jibri/jibri.spec
index ea7f759..8f93561 100644
--- a/jibri/jibri.spec
+++ b/jibri/jibri.spec
@@ -14,11 +14,13 @@ Source3:    %{name}-xorg.service
 Source4:    %{name}.sysusers
 Source5:    %{name}.tmpfiles
 Source6:    README.fedora
-Source7:    jibri-modules.conf
-Source8:    jibri.sh
+Source7:    %{name}-modules.conf
+Source8:    %{name}.sh
 Source9:    config.json
 Source10:   finalize_recording.sh
+Source11:   %{name}.sysconfig
 Patch1:     0001-log-to-syslog.patch
+Patch2:     0002-allow-overriding-webdriver-log.patch
 
 BuildArch:      noarch
 BuildRequires:  maven
@@ -75,6 +77,7 @@ install -m 644 target/%{name}-%{version}.jar %{buildroot}%{_datadir}/%{name}/%{n
 # config
 install -D -m 640 -t %{buildroot}%{_sysconfdir}/%{name}/ lib/logging.properties resources/debian-package/etc/%{project}/%{name}/*
 install -D -m 640 %{SOURCE9} %{buildroot}%{_sysconfdir}/%{name}/config.json
+install -D -m 640 %{SOURCE11} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
 # helper script
 install -D -m 755 -t %{buildroot}%{_sysconfdir}/%{name}/ %{SOURCE10}
 
@@ -124,6 +127,7 @@ test "$1" == "0" && rm -rf %{_rundir}/%{name}/{.cache,.config,.local} || true
 # package files/dirs
 %{_datadir}/%{name}/
 %dir %attr(0750,root,%{user}) %{_sysconfdir}/%{name}/
+%config(noreplace) %attr(0640,root,%{user}) %{_sysconfdir}/sysconfig/%{name}
 %config(noreplace) %attr(0640,root,%{user}) %{_sysconfdir}/%{name}/*.{preferences,properties,conf,json}
 %config(noreplace) %attr(0640,root,%{user}) %{_sysconfdir}/%{name}/asoundrc
 %config(noreplace) %attr(0750,root,%{user}) %{_sysconfdir}/%{name}/*.sh
diff --git a/jibri/jibri.sysconfig b/jibri/jibri.sysconfig
new file mode 100644
index 0000000..8d5e66f
--- /dev/null
+++ b/jibri/jibri.sysconfig
@@ -0,0 +1 @@
+JIBRI_JAVA_OPTIONS="-Dwebdriver.chrome.logfile=/run/jibri/chromedriver.log -Dwebdriver.chrome.verboseLogging=true"

From 00c406a9c5856f77bd391bc0976dfbc765be0980 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 18 2021 09:57:03 +0000
Subject: [PATCH 3/21] Declare ordered service dependency


---

diff --git a/jibri/jibri.service b/jibri/jibri.service
index c380c19..b4069ad 100644
--- a/jibri/jibri.service
+++ b/jibri/jibri.service
@@ -1,7 +1,7 @@
 [Unit]
 Description=Jibri Process
 Requires=jibri-icewm.service jibri-xorg.service
-After=network.target
+After=network.target jibri-icewm.service jibri-xorg.service
 
 [Service]
 User=jibri

From d6f4044daaefd8ed1d46453d736987af93bffaa2 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 20 2021 20:11:39 +0000
Subject: [PATCH 4/21] Switch to git 99288dc


---

diff --git a/jibri/0001-log-to-syslog.patch b/jibri/0001-log-to-syslog.patch
index 2338892..aa8b6d3 100644
--- a/jibri/0001-log-to-syslog.patch
+++ b/jibri/0001-log-to-syslog.patch
@@ -1,20 +1,40 @@
 diff -Naur a/lib/logging.properties b/lib/logging.properties
---- a/lib/logging.properties	2019-08-21 19:10:53.000000000 +0200
-+++ b/lib/logging.properties	2021-02-07 19:47:51.898638399 +0100
-@@ -1,4 +1,5 @@
--handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
-+#handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
-+handlers = java.util.logging.ConsoleHandler, com.agafua.syslog.SyslogHandler
+--- a/lib/logging.properties	2020-10-07 19:49:38.000000000 +0200
++++ b/lib/logging.properties	2021-02-19 16:37:26.157880894 +0100
+@@ -1,29 +1,39 @@
+-handlers = java.util.logging.FileHandler
++handlers = java.util.logging.FileHandler, com.agafua.syslog.SyslogHandler
  
- java.util.logging.FileHandler.level = FINE
- java.util.logging.FileHandler.pattern   = /var/log/jitsi/jibri/log.%g.txt
-@@ -25,7 +26,16 @@
+-java.util.logging.FileHandler.level = FINE
+-java.util.logging.FileHandler.pattern   = /var/log/jitsi/jibri/log.%g.txt
++java.util.logging.FileHandler.level = OFF
++java.util.logging.FileHandler.pattern   = /run/jibri/log.%g.txt
+ java.util.logging.FileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
+ java.util.logging.FileHandler.count = 10
+ java.util.logging.FileHandler.limit = 10000000
+ 
+ org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.level = FINE
+-org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.pattern   = /var/log/jitsi/jibri/ffmpeg.%g.txt
++org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.pattern   = /run/jibri/ffmpeg.%g.txt
+ org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
+ org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.count = 10
+ org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.limit = 10000000
+ 
+ org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.level = FINE
+-org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.pattern   = /var/log/jitsi/jibri/pjsua.%g.txt
++org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.pattern   = /run/jibri/pjsua.%g.txt
+ org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
+ org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.count = 10
+ org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.limit = 10000000
+ 
+ org.jitsi.jibri.selenium.util.BrowserFileHandler.level = FINE
+-org.jitsi.jibri.selenium.util.BrowserFileHandler.pattern   = /var/log/jitsi/jibri/browser.%g.txt
++org.jitsi.jibri.selenium.util.BrowserFileHandler.pattern   = /run/jibri/browser.%g.txt
+ org.jitsi.jibri.selenium.util.BrowserFileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
+ org.jitsi.jibri.selenium.util.BrowserFileHandler.count = 10
  org.jitsi.jibri.selenium.util.BrowserFileHandler.limit = 10000000
  
- java.util.logging.ConsoleHandler.level = FINE
--java.util.logging.ConsoleHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
-+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
-+
++com.agafua.syslog.SyslogHandler.level = FINE
 +com.agafua.syslog.SyslogHandler.transport = udp
 +com.agafua.syslog.SyslogHandler.facility = local0
 +com.agafua.syslog.SyslogHandler.port = 514
@@ -23,6 +43,7 @@ diff -Naur a/lib/logging.properties b/lib/logging.properties
 +com.agafua.syslog.SyslogHandler.escapeNewlines = false
 +
 +java.util.logging.SimpleFormatter.format = %4$s %2$s %5$s %6$s%
- 
++
  org.jitsi.level = FINE
+ org.jitsi.jibri.config.level = INFO
  
diff --git a/jibri/0002-allow-overriding-webdriver-log.patch b/jibri/0002-allow-overriding-webdriver-log.patch
index e407ff2..170c1be 100644
--- a/jibri/0002-allow-overriding-webdriver-log.patch
+++ b/jibri/0002-allow-overriding-webdriver-log.patch
@@ -1,12 +1,12 @@
 diff -Naur a/src/main/kotlin/org/jitsi/jibri/selenium/JibriSelenium.kt b/src/main/kotlin/org/jitsi/jibri/selenium/JibriSelenium.kt
---- a/src/main/kotlin/org/jitsi/jibri/selenium/JibriSelenium.kt	2019-08-21 19:10:53.000000000 +0200
-+++ b/src/main/kotlin/org/jitsi/jibri/selenium/JibriSelenium.kt	2021-02-17 23:14:38.686581290 +0100
-@@ -130,7 +130,7 @@
+--- a/src/main/kotlin/org/jitsi/jibri/selenium/JibriSelenium.kt	2020-10-07 19:49:38.000000000 +0200
++++ b/src/main/kotlin/org/jitsi/jibri/selenium/JibriSelenium.kt	2021-02-19 11:46:10.830118895 +0100
+@@ -135,7 +135,7 @@
       * Set up default chrome driver options (using fake device, etc.)
        */
      init {
 -        System.setProperty("webdriver.chrome.logfile", "/tmp/chromedriver.log")
 +        System.setProperty("webdriver.chrome.logfile", System.getProperty("webdriver.chrome.logfile", "/tmp/chromedriver.log"))
          val chromeOptions = ChromeOptions()
-         chromeOptions.addArguments(
-                 "--use-fake-ui-for-media-stream",
+         chromeOptions.addArguments(chromeOpts)
+         chromeOptions.setExperimentalOption("w3c", false)
diff --git a/jibri/99288dc8e6f4b4c74886d31737b05e9e3bfad3c3.tar.gz b/jibri/99288dc8e6f4b4c74886d31737b05e9e3bfad3c3.tar.gz
new file mode 100644
index 0000000..3d19a60
Binary files /dev/null and b/jibri/99288dc8e6f4b4c74886d31737b05e9e3bfad3c3.tar.gz differ
diff --git a/jibri/README.fedora b/jibri/README.fedora
index 8dea888..d97dd4c 100644
--- a/jibri/README.fedora
+++ b/jibri/README.fedora
@@ -82,7 +82,7 @@ Configuration is located in `/etc/jibri/config.json`. Replace `__jitsiFQDN__`, `
 Add users to prosody:
 ```
 $ prosodyctl register jibri auth.__jitsiFQDN__ __jibriUserSecret__
-$ prosodyctl register recorder auth.__jitsiFQDN__ __recorderUserSecret__
+$ prosodyctl register recorder recorder.__jitsiFQDN__ __recorderUserSecret__
 ```
 
 ### Troubleshooting
diff --git a/jibri/jibri.service b/jibri/jibri.service
index b4069ad..fcdfef8 100644
--- a/jibri/jibri.service
+++ b/jibri/jibri.service
@@ -25,6 +25,8 @@ ProtectHome=yes
 ProtectKernelTunables=yes
 ProtectControlGroups=yes
 ProtectSystem=strict
+# whitelist writing to rundir and spool
+ReadWritePaths=/run/jibri /var/spool/jibri
 
 [Install]
 WantedBy=multi-user.target
diff --git a/jibri/jibri.spec b/jibri/jibri.spec
index 8f93561..954c7ad 100644
--- a/jibri/jibri.spec
+++ b/jibri/jibri.spec
@@ -1,13 +1,15 @@
 %global project jitsi
 %global user %{name}
+%global commit 99288dc8e6f4b4c74886d31737b05e9e3bfad3c3
+%global shortcommit 99288dc
 
 Name:       jibri
-Version:    8.0
+Version:    8.0.g%{shortcommit}
 Release:    0.4%{?dist}
 Summary:    Jitsi Broadcasting Infrastructure
 Url:        https://jitsi.org
 License:    ASL 2.0
-Source0:    https://github.com/%{project}/%{name}/archive/v%{version}.tar.gz
+Source0:    https://github.com/%{project}/%{name}/archive/%{commit}.tar.gz
 Source1:    %{name}.service
 Source2:    %{name}-icewm.service
 Source3:    %{name}-xorg.service
@@ -55,7 +57,7 @@ instructions.
 
 #-- PREP, BUILD & INSTALL -----------------------------------------------------#
 %prep
-%autosetup -p1
+%autosetup -p1 -n %{name}-%{commit}
 %pom_add_dep rusv:agafua-syslog:0.4:runtime
 %pom_add_dep javax.activation:activation:1.1.1:runtime
 %pom_add_dep org.glassfish.jaxb:jaxb-runtime:2.3.2:runtime
@@ -128,7 +130,7 @@ test "$1" == "0" && rm -rf %{_rundir}/%{name}/{.cache,.config,.local} || true
 %{_datadir}/%{name}/
 %dir %attr(0750,root,%{user}) %{_sysconfdir}/%{name}/
 %config(noreplace) %attr(0640,root,%{user}) %{_sysconfdir}/sysconfig/%{name}
-%config(noreplace) %attr(0640,root,%{user}) %{_sysconfdir}/%{name}/*.{preferences,properties,conf,json}
+%config(noreplace) %attr(0640,root,%{user}) %{_sysconfdir}/%{name}/*.{preferences,properties,conf*,json}
 %config(noreplace) %attr(0640,root,%{user}) %{_sysconfdir}/%{name}/asoundrc
 %config(noreplace) %attr(0750,root,%{user}) %{_sysconfdir}/%{name}/*.sh
 %dir %attr(0755,%{user},%{user}) %{_rundir}/%{name}/
diff --git a/jibri/v8.0.tar.gz b/jibri/v8.0.tar.gz
deleted file mode 100644
index bd21179..0000000
Binary files a/jibri/v8.0.tar.gz and /dev/null differ

From 8d5fa8e2550f2395934a67008a47f8dc9b8faa09 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 20 2021 20:11:53 +0000
Subject: [PATCH 5/21] Silence curl in wrapper script


---

diff --git a/jibri/jibri.sh b/jibri/jibri.sh
index 6f115a6..f3d156b 100644
--- a/jibri/jibri.sh
+++ b/jibri/jibri.sh
@@ -5,10 +5,10 @@ case "$1" in
         exec java -Djava.util.logging.config.file=/etc/jibri/logging.properties ${JIBRI_JAVA_OPTIONS} -jar /usr/share/jibri/jibri.jar --config /etc/jibri/config.json
         ;;
     graceful)
-        exec curl -X POST http://127.0.0.1:3333/jibri/api/internal/v1.0/gracefulShutdown
+        exec curl -sX POST http://127.0.0.1:3333/jibri/api/internal/v1.0/gracefulShutdown > /dev/null
         ;;
     stop)
-        exec curl -X POST http://127.0.0.1:3333/jibri/api/internal/v1.0/shutdown
+        exec curl -sX POST http://127.0.0.1:3333/jibri/api/internal/v1.0/shutdown > /dev/null
         ;;
     *)
         echo "Invalid action specified" >&2

From deb3554cfec9b1773b7be76e80c5e6c8c1df7bec Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 20 2021 20:11:54 +0000
Subject: [PATCH 6/21] Fix logging configuration


---

diff --git a/jibri/0001-log-to-syslog.patch b/jibri/0001-log-to-syslog.patch
deleted file mode 100644
index aa8b6d3..0000000
--- a/jibri/0001-log-to-syslog.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-diff -Naur a/lib/logging.properties b/lib/logging.properties
---- a/lib/logging.properties	2020-10-07 19:49:38.000000000 +0200
-+++ b/lib/logging.properties	2021-02-19 16:37:26.157880894 +0100
-@@ -1,29 +1,39 @@
--handlers = java.util.logging.FileHandler
-+handlers = java.util.logging.FileHandler, com.agafua.syslog.SyslogHandler
- 
--java.util.logging.FileHandler.level = FINE
--java.util.logging.FileHandler.pattern   = /var/log/jitsi/jibri/log.%g.txt
-+java.util.logging.FileHandler.level = OFF
-+java.util.logging.FileHandler.pattern   = /run/jibri/log.%g.txt
- java.util.logging.FileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
- java.util.logging.FileHandler.count = 10
- java.util.logging.FileHandler.limit = 10000000
- 
- org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.level = FINE
--org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.pattern   = /var/log/jitsi/jibri/ffmpeg.%g.txt
-+org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.pattern   = /run/jibri/ffmpeg.%g.txt
- org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
- org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.count = 10
- org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.limit = 10000000
- 
- org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.level = FINE
--org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.pattern   = /var/log/jitsi/jibri/pjsua.%g.txt
-+org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.pattern   = /run/jibri/pjsua.%g.txt
- org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
- org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.count = 10
- org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.limit = 10000000
- 
- org.jitsi.jibri.selenium.util.BrowserFileHandler.level = FINE
--org.jitsi.jibri.selenium.util.BrowserFileHandler.pattern   = /var/log/jitsi/jibri/browser.%g.txt
-+org.jitsi.jibri.selenium.util.BrowserFileHandler.pattern   = /run/jibri/browser.%g.txt
- org.jitsi.jibri.selenium.util.BrowserFileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
- org.jitsi.jibri.selenium.util.BrowserFileHandler.count = 10
- org.jitsi.jibri.selenium.util.BrowserFileHandler.limit = 10000000
- 
-+com.agafua.syslog.SyslogHandler.level = FINE
-+com.agafua.syslog.SyslogHandler.transport = udp
-+com.agafua.syslog.SyslogHandler.facility = local0
-+com.agafua.syslog.SyslogHandler.port = 514
-+com.agafua.syslog.SyslogHandler.hostname = localhost
-+com.agafua.syslog.SyslogHandler.formatter = java.util.logging.SimpleFormatter
-+com.agafua.syslog.SyslogHandler.escapeNewlines = false
-+
-+java.util.logging.SimpleFormatter.format = %4$s %2$s %5$s %6$s%
-+
- org.jitsi.level = FINE
- org.jitsi.jibri.config.level = INFO
- 
diff --git a/jibri/0001-logconfig.patch b/jibri/0001-logconfig.patch
new file mode 100644
index 0000000..6066403
--- /dev/null
+++ b/jibri/0001-logconfig.patch
@@ -0,0 +1,33 @@
+diff -Naur a/lib/logging.properties b/lib/logging.properties
+--- a/lib/logging.properties	2020-10-07 19:49:38.000000000 +0200
++++ b/lib/logging.properties	2021-02-19 22:41:27.998882052 +0100
+@@ -1,25 +1,25 @@
+ handlers = java.util.logging.FileHandler
+ 
+ java.util.logging.FileHandler.level = FINE
+-java.util.logging.FileHandler.pattern   = /var/log/jitsi/jibri/log.%g.txt
++java.util.logging.FileHandler.pattern   = /var/log/jibri/log.%g.txt
+ java.util.logging.FileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
+ java.util.logging.FileHandler.count = 10
+ java.util.logging.FileHandler.limit = 10000000
+ 
+ org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.level = FINE
+-org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.pattern   = /var/log/jitsi/jibri/ffmpeg.%g.txt
++org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.pattern   = /var/log/jibri/ffmpeg.%g.txt
+ org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
+ org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.count = 10
+ org.jitsi.jibri.capture.ffmpeg.util.FfmpegFileHandler.limit = 10000000
+ 
+ org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.level = FINE
+-org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.pattern   = /var/log/jitsi/jibri/pjsua.%g.txt
++org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.pattern   = /var/log/jibri/pjsua.%g.txt
+ org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
+ org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.count = 10
+ org.jitsi.jibri.sipgateway.pjsua.util.PjsuaFileHandler.limit = 10000000
+ 
+ org.jitsi.jibri.selenium.util.BrowserFileHandler.level = FINE
+-org.jitsi.jibri.selenium.util.BrowserFileHandler.pattern   = /var/log/jitsi/jibri/browser.%g.txt
++org.jitsi.jibri.selenium.util.BrowserFileHandler.pattern   = /var/log/jibri/browser.%g.txt
+ org.jitsi.jibri.selenium.util.BrowserFileHandler.formatter = net.java.sip.communicator.util.ScLogFormatter
+ org.jitsi.jibri.selenium.util.BrowserFileHandler.count = 10
+ org.jitsi.jibri.selenium.util.BrowserFileHandler.limit = 10000000
diff --git a/jibri/jibri.spec b/jibri/jibri.spec
index 954c7ad..59e38d0 100644
--- a/jibri/jibri.spec
+++ b/jibri/jibri.spec
@@ -21,7 +21,7 @@ Source8:    %{name}.sh
 Source9:    config.json
 Source10:   finalize_recording.sh
 Source11:   %{name}.sysconfig
-Patch1:     0001-log-to-syslog.patch
+Patch1:     0001-logconfig.patch
 Patch2:     0002-allow-overriding-webdriver-log.patch
 
 BuildArch:      noarch
@@ -58,7 +58,6 @@ instructions.
 #-- PREP, BUILD & INSTALL -----------------------------------------------------#
 %prep
 %autosetup -p1 -n %{name}-%{commit}
-%pom_add_dep rusv:agafua-syslog:0.4:runtime
 %pom_add_dep javax.activation:activation:1.1.1:runtime
 %pom_add_dep org.glassfish.jaxb:jaxb-runtime:2.3.2:runtime
 %pom_add_plugin :maven-jar-plugin:2.3 . \
@@ -83,6 +82,8 @@ install -D -m 640 %{SOURCE11} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
 # helper script
 install -D -m 755 -t %{buildroot}%{_sysconfdir}/%{name}/ %{SOURCE10}
 
+# logdir
+install -d -m 0755 %{buildroot}/%{_var}/log/%{name}/
 # rundir
 install -d -m 0755 %{buildroot}%{_rundir}/%{name}/
 install -d -m 0755 %{buildroot}%{_var}/spool/%{name}/
@@ -136,6 +137,7 @@ test "$1" == "0" && rm -rf %{_rundir}/%{name}/{.cache,.config,.local} || true
 %dir %attr(0755,%{user},%{user}) %{_rundir}/%{name}/
 %dir %attr(0755,%{user},%{user}) %{_rundir}/%{name}/.icewm
 %dir %attr(0755,%{user},%{user}) %{_var}/spool/%{name}/
+%dir %attr(0755,%{user},%{user}) %{_var}/log/%{name}/
 %ghost %attr(0644,%{user},%{user}) %{_rundir}/%{name}/%{name}.pid
 %ghost %attr(0644,%{user},%{user}) %{_rundir}/%{name}/.asoundrc
 %ghost %attr(0644,%{user},%{user}) %{_rundir}/%{name}/.icewm/settings
diff --git a/jibri/jibri.sysconfig b/jibri/jibri.sysconfig
index 8d5e66f..84552e0 100644
--- a/jibri/jibri.sysconfig
+++ b/jibri/jibri.sysconfig
@@ -1 +1 @@
-JIBRI_JAVA_OPTIONS="-Dwebdriver.chrome.logfile=/run/jibri/chromedriver.log -Dwebdriver.chrome.verboseLogging=true"
+JIBRI_JAVA_OPTIONS="-Dwebdriver.chrome.logfile=/var/log/jibri/chromedriver.log -Dwebdriver.chrome.verboseLogging=true"
diff --git a/jibri/jibri.tmpfiles b/jibri/jibri.tmpfiles
index 42d00e8..c4a0edf 100644
--- a/jibri/jibri.tmpfiles
+++ b/jibri/jibri.tmpfiles
@@ -1,5 +1,7 @@
 # create rundir
 d /run/jibri 0755 jibri jibri -
+# create logdir
+d /var/log/jibri 0755 jibri jibri -
 # ensure correct permissions for all files in config dir
 Z /etc/jibri 0640 root jibri
 z /etc/jibri 0750 root jibri

From 1f4f6badc43d15e650e94323dac63c56cca5e4bf Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 20 2021 20:18:57 +0000
Subject: [PATCH 7/21] Allow writing in log directory


---

diff --git a/jibri/jibri.service b/jibri/jibri.service
index fcdfef8..a9a99f2 100644
--- a/jibri/jibri.service
+++ b/jibri/jibri.service
@@ -25,8 +25,8 @@ ProtectHome=yes
 ProtectKernelTunables=yes
 ProtectControlGroups=yes
 ProtectSystem=strict
-# whitelist writing to rundir and spool
-ReadWritePaths=/run/jibri /var/spool/jibri
+# whitelist writing to rundir, logdir and spool
+ReadWritePaths=/run/jibri /var/log/jibri /var/spool/jibri 
 
 [Install]
 WantedBy=multi-user.target

From 38860be1ba2956a263966e5f667927e1339afcd9 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 20 2021 20:19:43 +0000
Subject: [PATCH 8/21] Add chrome managed policy


---

diff --git a/jibri/jibri.chromepolicy b/jibri/jibri.chromepolicy
new file mode 100644
index 0000000..29bc946
--- /dev/null
+++ b/jibri/jibri.chromepolicy
@@ -0,0 +1 @@
+{ "CommandLineFlagSecurityWarningsEnabled": false }
diff --git a/jibri/jibri.spec b/jibri/jibri.spec
index 59e38d0..afd349c 100644
--- a/jibri/jibri.spec
+++ b/jibri/jibri.spec
@@ -21,6 +21,7 @@ Source8:    %{name}.sh
 Source9:    config.json
 Source10:   finalize_recording.sh
 Source11:   %{name}.sysconfig
+Source12:   %{name}.chromepolicy
 Patch1:     0001-logconfig.patch
 Patch2:     0002-allow-overriding-webdriver-log.patch
 
@@ -32,6 +33,7 @@ BuildRequires:  systemd-rpm-macros
 
 Requires:       xdotool
 Requires:       chromedriver
+Requires:       chromium
 Requires:       ffmpeg
 Requires:       alsa-utils
 Requires:       icewm
@@ -95,6 +97,8 @@ touch %{buildroot}%{_rundir}/%{name}/.asoundrc
 install -d -m 0755 %{buildroot}%{_rundir}/%{name}/.icewm
 touch %{buildroot}%{_rundir}/%{name}/.icewm/settings
 
+# chrome policy
+install -D -m 644 %{SOURCE12} %{buildroot}%{_sysconfdir}/chromium/policies/managed/01_jibri.json
 # system config
 install -D -m 644 -t %{buildroot}%{_unitdir}/ %{SOURCE1} %{SOURCE2} %{SOURCE3}
 install -D -m 644 %{SOURCE4} %{buildroot}%{_sysusersdir}/%{name}.conf
@@ -141,6 +145,10 @@ test "$1" == "0" && rm -rf %{_rundir}/%{name}/{.cache,.config,.local} || true
 %ghost %attr(0644,%{user},%{user}) %{_rundir}/%{name}/%{name}.pid
 %ghost %attr(0644,%{user},%{user}) %{_rundir}/%{name}/.asoundrc
 %ghost %attr(0644,%{user},%{user}) %{_rundir}/%{name}/.icewm/settings
+%dir %{_sysconfdir}/chromium/
+%dir %{_sysconfdir}/chromium/policies
+%dir %{_sysconfdir}/chromium/policies/managed
+%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/chromium/policies/managed/*.json
 
 # system config
 %{_unitdir}/*.service

From 1e9500d60b56ab56db50ba802e6d3d6344f94c24 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 20 2021 20:20:02 +0000
Subject: [PATCH 9/21] Add supplementary groups for jibri user


---

diff --git a/jibri/jibri.sysusers b/jibri/jibri.sysusers
index 1338190..22f47ab 100644
--- a/jibri/jibri.sysusers
+++ b/jibri/jibri.sysusers
@@ -1 +1,3 @@
 u jibri - "Runs Jitsi Broadcasting Infrastructure" /run/jibri /sbin/nologin
+m jibri audio
+m jibri video

From 64126fb424415c45ddaeae49560118cf6869639e Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 20 2021 20:20:02 +0000
Subject: [PATCH 10/21] Fix creation of icewm settings


---

diff --git a/jibri/jibri-icewm.service b/jibri/jibri-icewm.service
index c35fa5f..f6c91da 100644
--- a/jibri/jibri-icewm.service
+++ b/jibri/jibri-icewm.service
@@ -9,6 +9,7 @@ Group=jibri
 Environment=DISPLAY=:0
 EnvironmentFile=-/etc/sysconfig/jibri
 ExecStartPre=/usr/bin/cp /etc/jibri/asoundrc /run/jibri/.asoundrc
+ExecStartpre=/usr/bin/mkdir /run/jibri/.icewm
 ExecStartPre=/usr/bin/cp /etc/jibri/icewm.preferences /run/jibri/.icewm/settings
 ExecStart=/usr/bin/icewm-session
 Restart=on-failure

From 6edc5fefd9ae9a5791fa710f9af7f6c4b2df680d Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 20 2021 20:20:02 +0000
Subject: [PATCH 11/21] Fix device access for jibri service


---

diff --git a/jibri/jibri.service b/jibri/jibri.service
index a9a99f2..899d3b7 100644
--- a/jibri/jibri.service
+++ b/jibri/jibri.service
@@ -20,7 +20,6 @@ WorkingDirectory=~
 # Hardening
 NoNewPrivileges=yes
 PrivateTmp=yes
-PrivateDevices=yes
 ProtectHome=yes
 ProtectKernelTunables=yes
 ProtectControlGroups=yes

From 17317fb3ca0607f2170076bac9583e9ef84dc3a7 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 20 2021 20:20:13 +0000
Subject: [PATCH 12/21] Fix wrapper script


---

diff --git a/jibri/jibri.service b/jibri/jibri.service
index 899d3b7..8eb2387 100644
--- a/jibri/jibri.service
+++ b/jibri/jibri.service
@@ -10,7 +10,7 @@ Environment=DISPLAY=:0
 EnvironmentFile=-/etc/sysconfig/jibri
 ExecStart=/usr/libexec/jibri start
 ExecStop=/usr/libexec/jibri graceful
-ExecReload=/usr/libexec/jibri graceful
+ExecReload=/usr/libexec/jibri reload
 KillMode=process
 Restart=always
 RestartPreventExitStatus=255
diff --git a/jibri/jibri.sh b/jibri/jibri.sh
index f3d156b..978cbbb 100644
--- a/jibri/jibri.sh
+++ b/jibri/jibri.sh
@@ -4,6 +4,9 @@ case "$1" in
     start)
         exec java -Djava.util.logging.config.file=/etc/jibri/logging.properties ${JIBRI_JAVA_OPTIONS} -jar /usr/share/jibri/jibri.jar --config /etc/jibri/config.json
         ;;
+    reload)
+        exec curl -sX POST http://127.0.0.1:3333/jibri/api/internal/v1.0/notifyConfigChanged > /dev/null
+        ;;
     graceful)
         exec curl -sX POST http://127.0.0.1:3333/jibri/api/internal/v1.0/gracefulShutdown > /dev/null
         ;;

From 2fcd301b60848b68af2ffe58315b5ce2b3dbb4a0 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 20 2021 20:20:25 +0000
Subject: [PATCH 13/21] Improve finalize script


---

diff --git a/jibri/finalize_recording.sh b/jibri/finalize_recording.sh
index f603158..ce4590e 100644
--- a/jibri/finalize_recording.sh
+++ b/jibri/finalize_recording.sh
@@ -1,3 +1,11 @@
 #! /bin/sh
 # This script is called after recording has finished.
+# It is called with a single argument: The directory of
+# the recording. In that directory, two files can be expected:
+#  - A mp4 video file named roomname_YYYY-MM-DD-hh-mm-ss.mp4
+#  - A file metadata.json, containing additional info.
+#
 # TODO: Implement something useful.
+(
+    echo "Recording is located at $1"
+) > /var/log/jibri/finalize.log 2>&1

From d2d79a29927439fc487fce756229ffc66c513913 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 20 2021 20:20:25 +0000
Subject: [PATCH 14/21] Migrate to new HOCON config


---

diff --git a/jibri/jibri.conf b/jibri/jibri.conf
new file mode 100644
index 0000000..d04e226
--- /dev/null
+++ b/jibri/jibri.conf
@@ -0,0 +1,45 @@
+// This config file uses HOCON, the JSON Superset. See https://github.com/lightbend/config/blob/master/HOCON.md
+// Help on migrating an old style config.json can be found in /usr/share/doc/jibri/config_migration_guide.md
+// Defaults can be found in /usr/share/doc/jibri/reference.conf
+//
+
+jibri {
+
+    jitsi-fqdn = "__jitsiFQDN__"
+    jibri-secret = "__jibriUserSecret__"
+    recorder-secret = "__recorderUserSecret__"
+
+    recording {
+        recordings-directory = "/var/spool/jibri"
+        finalize-script = "/etc/jibri/finalize_recording.sh"
+    }
+    api {
+        xmpp {
+            environments = [
+                {
+                    name = "prod environment"
+                    xmpp-server-hosts = [ ${jibri.jitsi-fqdn} ]
+                    xmpp-domain = ${jibri.jitsi-fqdn}
+                    control-muc {
+                        domain = internal.auth.${jibri.jitsi-fqdn}
+                        room-name = "JibriBrewery"
+                        nickname = "jibri"
+                    }
+                    control-login {
+                        domain = auth.${jibri.jitsi-fqdn}
+                        username = "jibri"
+                        password = ${jibri.jibri-secret}
+                    }
+                    call-login {
+                        domain = recorder.${jibri.jitsi-fqdn}
+                        username = "recorder"
+                        password = ${jibri.recorder-secret}
+                    }
+                    strip-from-room-domain = "conference."
+                    usage-timeout = "5 minutes"
+                    trust-all-xmpp-certs = true
+                }
+            ]
+        }
+    }
+}
diff --git a/jibri/jibri.sh b/jibri/jibri.sh
index 978cbbb..8a810c6 100644
--- a/jibri/jibri.sh
+++ b/jibri/jibri.sh
@@ -2,7 +2,10 @@
 
 case "$1" in
     start)
-        exec java -Djava.util.logging.config.file=/etc/jibri/logging.properties ${JIBRI_JAVA_OPTIONS} -jar /usr/share/jibri/jibri.jar --config /etc/jibri/config.json
+        exec java \
+            -Djava.util.logging.config.file=/etc/jibri/logging.properties \
+            -Dconfig.file=/etc/jibri/jibri.conf \
+            ${JIBRI_JAVA_OPTIONS} -jar /usr/share/jibri/jibri.jar --config /etc/jibri/config.json
         ;;
     reload)
         exec curl -sX POST http://127.0.0.1:3333/jibri/api/internal/v1.0/notifyConfigChanged > /dev/null
diff --git a/jibri/jibri.spec b/jibri/jibri.spec
index afd349c..6e036d7 100644
--- a/jibri/jibri.spec
+++ b/jibri/jibri.spec
@@ -18,7 +18,7 @@ Source5:    %{name}.tmpfiles
 Source6:    README.fedora
 Source7:    %{name}-modules.conf
 Source8:    %{name}.sh
-Source9:    config.json
+Source9:    %{name}.conf
 Source10:   finalize_recording.sh
 Source11:   %{name}.sysconfig
 Source12:   %{name}.chromepolicy
@@ -79,7 +79,12 @@ install -m 644 target/%{name}-%{version}.jar %{buildroot}%{_datadir}/%{name}/%{n
 
 # config
 install -D -m 640 -t %{buildroot}%{_sysconfdir}/%{name}/ lib/logging.properties resources/debian-package/etc/%{project}/%{name}/*
-install -D -m 640 %{SOURCE9} %{buildroot}%{_sysconfdir}/%{name}/config.json
+
+# OLD style config install -D -m 640 %{SOURCE9} %{buildroot}%{_sysconfdir}/%{name}/config.json
+# NEW style config
+rm -f %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
+install -D -m 640 %{SOURCE9} %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
+
 install -D -m 640 %{SOURCE11} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
 # helper script
 install -D -m 755 -t %{buildroot}%{_sysconfdir}/%{name}/ %{SOURCE10}
@@ -110,6 +115,7 @@ install -D -m 755 %{SOURCE8} %{buildroot}%{_libexecdir}/%{name}
 install -D -m 644 -t %{buildroot}/%{_pkgdocdir}/ *.md
 install -D -m 644 -t %{buildroot}/%{_pkgdocdir}/ doc/*.md
 install -D -m 644 %{SOURCE6} %{buildroot}/%{_pkgdocdir}/README-fedora.md
+install -D -m 644 -t %{buildroot}/%{_pkgdocdir}/ src/main/resources/reference.conf
 
 #-- SCRIPTLETS -----------------------------------------------------------------#
 %pre

From a434ff87af84c91450a61c4064cbe6174878b9c1 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 20 2021 20:20:25 +0000
Subject: [PATCH 15/21] Append to log in finalize script


---

diff --git a/jibri/finalize_recording.sh b/jibri/finalize_recording.sh
index ce4590e..197836b 100644
--- a/jibri/finalize_recording.sh
+++ b/jibri/finalize_recording.sh
@@ -8,4 +8,4 @@
 # TODO: Implement something useful.
 (
     echo "Recording is located at $1"
-) > /var/log/jibri/finalize.log 2>&1
+) >> /var/log/jibri/finalize.log 2>&1

From e711f6ae9dba7529a71a374abc20eae6a9c7c502 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 21 2021 00:41:04 +0000
Subject: [PATCH 16/21] Fix icewm setup


---

diff --git a/jibri/jibri-icewm-setup.sh b/jibri/jibri-icewm-setup.sh
new file mode 100644
index 0000000..df6974f
--- /dev/null
+++ b/jibri/jibri-icewm-setup.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+cp /etc/jibri/asoundrc /run/jibri/.asoundrc
+mkdir /run/jibri/.icewm
+cp /etc/jibri/icewm.preferences /run/jibri/.icewm/settings
diff --git a/jibri/jibri-icewm.service b/jibri/jibri-icewm.service
index f6c91da..1eb459a 100644
--- a/jibri/jibri-icewm.service
+++ b/jibri/jibri-icewm.service
@@ -8,9 +8,7 @@ User=jibri
 Group=jibri
 Environment=DISPLAY=:0
 EnvironmentFile=-/etc/sysconfig/jibri
-ExecStartPre=/usr/bin/cp /etc/jibri/asoundrc /run/jibri/.asoundrc
-ExecStartpre=/usr/bin/mkdir /run/jibri/.icewm
-ExecStartPre=/usr/bin/cp /etc/jibri/icewm.preferences /run/jibri/.icewm/settings
+ExecStartPre=/usr/libexec/jibri-icewm-setup
 ExecStart=/usr/bin/icewm-session
 Restart=on-failure
 RestartPreventExitStatus=255
diff --git a/jibri/jibri.spec b/jibri/jibri.spec
index 6e036d7..2403750 100644
--- a/jibri/jibri.spec
+++ b/jibri/jibri.spec
@@ -22,6 +22,7 @@ Source9:    %{name}.conf
 Source10:   finalize_recording.sh
 Source11:   %{name}.sysconfig
 Source12:   %{name}.chromepolicy
+Source13:   %{name}-icewm-setup.sh
 Patch1:     0001-logconfig.patch
 Patch2:     0002-allow-overriding-webdriver-log.patch
 
@@ -110,6 +111,7 @@ install -D -m 644 %{SOURCE4} %{buildroot}%{_sysusersdir}/%{name}.conf
 install -D -m 644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf
 install -D -m 644 -t %{buildroot}%{_sysconfdir}/modules-load.d/ %{SOURCE7}
 install -D -m 755 %{SOURCE8} %{buildroot}%{_libexecdir}/%{name}
+install -D -m 755 %{SOURCE13} %{buildroot}%{_libexecdir}/%{name}-icewm-setup
 
 # documentation
 install -D -m 644 -t %{buildroot}/%{_pkgdocdir}/ *.md
@@ -161,7 +163,7 @@ test "$1" == "0" && rm -rf %{_rundir}/%{name}/{.cache,.config,.local} || true
 %{_tmpfilesdir}/%{name}.conf
 %{_sysusersdir}/%{name}.conf
 %{_sysconfdir}/modules-load.d/%{name}-*.conf
-%{_libexecdir}/%{name}
+%{_libexecdir}/%{name}*
 
 #-- CHANGELOG -----------------------------------------------------------------#
 %changelog

From e0615949ee6f7c80148a68751592ad6706b90d22 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 21 2021 11:57:55 +0000
Subject: [PATCH 17/21] Don't fail icewm-setup if /run/jibri/.icewm already exists


---

diff --git a/jibri/jibri-icewm-setup.sh b/jibri/jibri-icewm-setup.sh
index df6974f..128ee9e 100644
--- a/jibri/jibri-icewm-setup.sh
+++ b/jibri/jibri-icewm-setup.sh
@@ -1,4 +1,4 @@
 #!/bin/bash
 cp /etc/jibri/asoundrc /run/jibri/.asoundrc
-mkdir /run/jibri/.icewm
+mkdir -p /run/jibri/.icewm
 cp /etc/jibri/icewm.preferences /run/jibri/.icewm/settings

From 6fe0a826bffed8595856f488e7a3cdfe84d34ffa Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 21 2021 20:06:48 +0000
Subject: [PATCH 18/21] jibri requires jre-1.8.0-headless


---

diff --git a/jibri/jibri.spec b/jibri/jibri.spec
index 2403750..78e0792 100644
--- a/jibri/jibri.spec
+++ b/jibri/jibri.spec
@@ -40,7 +40,7 @@ Requires:       alsa-utils
 Requires:       icewm
 Requires:       xorg-x11-drv-dummy
 Requires:       curl
-Requires:       jre-headless
+Requires:       jre-1.8.0-headless
 Requires:       systemd
 %{?sysusers_requires_compat}
 

From 0a847fd83e45ffea5cdb0d401f86b635e7b052dd Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Feb 22 2021 18:33:20 +0000
Subject: [PATCH 19/21] jdk11-compatibility


---

diff --git a/jibri/0003-jdk11-compatibility.patch b/jibri/0003-jdk11-compatibility.patch
new file mode 100644
index 0000000..d983707
--- /dev/null
+++ b/jibri/0003-jdk11-compatibility.patch
@@ -0,0 +1,158 @@
+diff -Naur a/pom.xml b/pom.xml
+--- a/pom.xml	2020-10-07 19:49:38.000000000 +0200
++++ b/pom.xml	2021-02-22 16:56:41.464916849 +0100
+@@ -25,6 +25,33 @@
+         <jicoco.version>1.1-54-g5387346</jicoco.version>
+     </properties>
+ 
++    <profiles>
++        <profile>
++            <id>target-jdk8</id>
++            <activation>
++                <jdk>1.8</jdk>
++            </activation>
++            <properties>
++                <maven.compiler.source>1.8</maven.compiler.source>
++                <maven.compiler.target>1.8</maven.compiler.target>
++                <kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
++                <kcond>jdk8</kcond>
++            </properties>
++        </profile>
++        <profile>
++            <id>target-jdk9</id>
++            <activation>
++                <jdk>[9,)</jdk>
++            </activation>
++            <properties>
++                <maven.compiler.source>9</maven.compiler.source>
++                <maven.compiler.target>9</maven.compiler.target>
++                <kotlin.compiler.jvmTarget>9</kotlin.compiler.jvmTarget>
++                <kcond>jdk9</kcond>
++            </properties>
++        </profile>
++    </profiles>
++
+     <dependencies>
+         <dependency>
+             <groupId>${project.groupId}</groupId>
+@@ -212,6 +239,7 @@
+                         <configuration>
+                             <sourceDirs>
+                                 <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
++                                <sourceDir>${project.basedir}/src/main/kotlin-${kcond}</sourceDir>
+                                 <sourceDir>${project.basedir}/src/main/java</sourceDir>
+                             </sourceDirs>
+                             <args>
+diff -Naur a/src/main/kotlin/org/jitsi/jibri/util/extensions/Process.kt b/src/main/kotlin/org/jitsi/jibri/util/extensions/Process.kt
+--- a/src/main/kotlin/org/jitsi/jibri/util/extensions/Process.kt	2020-10-07 19:49:38.000000000 +0200
++++ b/src/main/kotlin/org/jitsi/jibri/util/extensions/Process.kt	1970-01-01 01:00:00.000000000 +0100
+@@ -1,38 +0,0 @@
+-/*
+- * Copyright @ 2018 - present 8x8, Inc.
+- *
+- * Licensed under the Apache License, Version 2.0 (the "License");
+- * you may not use this file except in compliance with the License.
+- * You may obtain a copy of the License at
+- *
+- *     http://www.apache.org/licenses/LICENSE-2.0
+- *
+- * Unless required by applicable law or agreed to in writing, software
+- * distributed under the License is distributed on an "AS IS" BASIS,
+- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+- * See the License for the specific language governing permissions and
+- * limitations under the License.
+- */
+-
+-package org.jitsi.jibri.util.extensions
+-
+-import java.lang.reflect.Field
+-
+-/**
+- * Mimic the "pid" member of Java 9's [Process].
+- */
+-val Process.pidValue: Long
+-    get() {
+-        var pid: Long = -1
+-        try {
+-            if (javaClass.name == "java.lang.UNIXProcess") {
+-                val field: Field = javaClass.getDeclaredField("pid")
+-                field.isAccessible = true
+-                pid = field.getLong(this)
+-                field.isAccessible = false
+-            }
+-        } catch (e: Exception) {
+-            pid = -1
+-        }
+-        return pid
+-    }
+diff -Naur a/src/main/kotlin-jdk8/org/jitsi/jibri/util/extensions/Process.kt b/src/main/kotlin-jdk8/org/jitsi/jibri/util/extensions/Process.kt
+--- a/src/main/kotlin-jdk8/org/jitsi/jibri/util/extensions/Process.kt	1970-01-01 01:00:00.000000000 +0100
++++ b/src/main/kotlin-jdk8/org/jitsi/jibri/util/extensions/Process.kt	2020-10-07 19:49:38.000000000 +0200
+@@ -0,0 +1,38 @@
++/*
++ * Copyright @ 2018 - present 8x8, Inc.
++ *
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ *     http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++package org.jitsi.jibri.util.extensions
++
++import java.lang.reflect.Field
++
++/**
++ * Mimic the "pid" member of Java 9's [Process].
++ */
++val Process.pidValue: Long
++    get() {
++        var pid: Long = -1
++        try {
++            if (javaClass.name == "java.lang.UNIXProcess") {
++                val field: Field = javaClass.getDeclaredField("pid")
++                field.isAccessible = true
++                pid = field.getLong(this)
++                field.isAccessible = false
++            }
++        } catch (e: Exception) {
++            pid = -1
++        }
++        return pid
++    }
+diff -Naur a/src/main/kotlin-jdk9/org/jitsi/jibri/util/extensions/Process.kt b/src/main/kotlin-jdk9/org/jitsi/jibri/util/extensions/Process.kt
+--- a/src/main/kotlin-jdk9/org/jitsi/jibri/util/extensions/Process.kt	1970-01-01 01:00:00.000000000 +0100
++++ b/src/main/kotlin-jdk9/org/jitsi/jibri/util/extensions/Process.kt	2021-02-22 16:59:44.783666826 +0100
+@@ -0,0 +1,25 @@
++/*
++ * Copyright @ 2018 - present 8x8, Inc.
++ *
++ * Licensed under the Apache License, Version 2.0 (the "License");
++ * you may not use this file except in compliance with the License.
++ * You may obtain a copy of the License at
++ *
++ *     http://www.apache.org/licenses/LICENSE-2.0
++ *
++ * Unless required by applicable law or agreed to in writing, software
++ * distributed under the License is distributed on an "AS IS" BASIS,
++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++ * See the License for the specific language governing permissions and
++ * limitations under the License.
++ */
++
++package org.jitsi.jibri.util.extensions
++
++/**
++ * Mimic the "pid" member of Java 9's [Process].
++ */
++val Process.pidValue: Long
++    get() {
++        return this.pid()
++    }
diff --git a/jibri/jibri.spec b/jibri/jibri.spec
index 78e0792..2abf083 100644
--- a/jibri/jibri.spec
+++ b/jibri/jibri.spec
@@ -25,6 +25,7 @@ Source12:   %{name}.chromepolicy
 Source13:   %{name}-icewm-setup.sh
 Patch1:     0001-logconfig.patch
 Patch2:     0002-allow-overriding-webdriver-log.patch
+Patch3:     0003-jdk11-compatibility.patch
 
 BuildArch:      noarch
 BuildRequires:  maven
@@ -40,7 +41,7 @@ Requires:       alsa-utils
 Requires:       icewm
 Requires:       xorg-x11-drv-dummy
 Requires:       curl
-Requires:       jre-1.8.0-headless
+Requires:       jre-headless
 Requires:       systemd
 %{?sysusers_requires_compat}
 

From 2c4936f3272851e33cd2bf1cc29cd1d6bc7cb937 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Jul 31 2021 12:18:47 +0000
Subject: [PATCH 20/21] Update spec for F34


---

diff --git a/jitsi-meet/jitsi-meet.spec b/jitsi-meet/jitsi-meet.spec
index b842081..0895e41 100644
--- a/jitsi-meet/jitsi-meet.spec
+++ b/jitsi-meet/jitsi-meet.spec
@@ -24,6 +24,7 @@ BuildRequires:  nodejs
 BuildRequires:  npm
 BuildRequires:  git
 BuildRequires:  systemd-rpm-macros
+BuildRequires:  make
 Requires:       jre-headless
 
 %description

From ec28705cc00b75ca2d96810884d706846707b1f6 Mon Sep 17 00:00:00 2001
From: Fritz Elfert <fritz@fritz-elfert.de>
Date: Jul 31 2021 12:28:05 +0000
Subject: [PATCH 21/21] rename dummy finalize script in jibri


---

diff --git a/jibri/finalize_recording.sh b/jibri/finalize_recording.sh
deleted file mode 100644
index 197836b..0000000
--- a/jibri/finalize_recording.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#! /bin/sh
-# This script is called after recording has finished.
-# It is called with a single argument: The directory of
-# the recording. In that directory, two files can be expected:
-#  - A mp4 video file named roomname_YYYY-MM-DD-hh-mm-ss.mp4
-#  - A file metadata.json, containing additional info.
-#
-# TODO: Implement something useful.
-(
-    echo "Recording is located at $1"
-) >> /var/log/jibri/finalize.log 2>&1
diff --git a/jibri/jibri.spec b/jibri/jibri.spec
index 2abf083..722c19f 100644
--- a/jibri/jibri.spec
+++ b/jibri/jibri.spec
@@ -2,6 +2,7 @@
 %global user %{name}
 %global commit 99288dc8e6f4b4c74886d31737b05e9e3bfad3c3
 %global shortcommit 99288dc
+%global finalize_link %{_sysconfdir}/%{name}/finalize_recording.sh
 
 Name:       jibri
 Version:    8.0.g%{shortcommit}
@@ -19,7 +20,7 @@ Source6:    README.fedora
 Source7:    %{name}-modules.conf
 Source8:    %{name}.sh
 Source9:    %{name}.conf
-Source10:   finalize_recording.sh
+Source10:   %{name}_finalize_noop.sh
 Source11:   %{name}.sysconfig
 Source12:   %{name}.chromepolicy
 Source13:   %{name}-icewm-setup.sh
@@ -89,7 +90,7 @@ install -D -m 640 %{SOURCE9} %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
 
 install -D -m 640 %{SOURCE11} %{buildroot}%{_sysconfdir}/sysconfig/%{name}
 # helper script
-install -D -m 755 -t %{buildroot}%{_sysconfdir}/%{name}/ %{SOURCE10}
+install -D -m 755 -t %{buildroot}%{_libexecdir}/ %{SOURCE10}
 
 # logdir
 install -d -m 0755 %{buildroot}/%{_var}/log/%{name}/
@@ -126,6 +127,7 @@ install -D -m 644 -t %{buildroot}/%{_pkgdocdir}/ src/main/resources/reference.co
 
 %post
 /usr/sbin/modprobe snd_aloop
+test -h %{finalize_link} || ln -sn %{_libexecdir}/%{name}_finalize_noop.sh %{finalize_link}
 %systemd_post %{name}.service %{name}-icewm.service %{name}-xorg.service
 
 %preun
diff --git a/jibri/jibri_finalize_noop.sh b/jibri/jibri_finalize_noop.sh
new file mode 100644
index 0000000..197836b
--- /dev/null
+++ b/jibri/jibri_finalize_noop.sh
@@ -0,0 +1,11 @@
+#! /bin/sh
+# This script is called after recording has finished.
+# It is called with a single argument: The directory of
+# the recording. In that directory, two files can be expected:
+#  - A mp4 video file named roomname_YYYY-MM-DD-hh-mm-ss.mp4
+#  - A file metadata.json, containing additional info.
+#
+# TODO: Implement something useful.
+(
+    echo "Recording is located at $1"
+) >> /var/log/jibri/finalize.log 2>&1

