From b6b7f3623aa59021513693596537543b725aff04 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 31 Jan 2021 16:01:04 +0200 Subject: [PATCH 01/50] Increment version to 1.0.0, I think it's about time --- src/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config b/src/config index bd3acbef..4a1cc5de 100755 --- a/src/config +++ b/src/config @@ -1,4 +1,4 @@ export DIST_NAME=OctoPi -export DIST_VERSION=0.18.0 +export DIST_VERSION=1.0.0 export MODULES="base(raspicam, network, disable-services(octopi), password-for-sudo)" From ca2840ced1dc6ae398e4c693927a4527514b042a Mon Sep 17 00:00:00 2001 From: Thomas Rose Date: Thu, 11 Feb 2021 15:59:32 +0100 Subject: [PATCH 02/50] Delete octopi-network.txt Remove unused long overdue legacy-file --- src/modules/octopi/filesystem/boot/octopi-network.txt | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 src/modules/octopi/filesystem/boot/octopi-network.txt diff --git a/src/modules/octopi/filesystem/boot/octopi-network.txt b/src/modules/octopi/filesystem/boot/octopi-network.txt deleted file mode 100644 index 85c4c0b1..00000000 --- a/src/modules/octopi/filesystem/boot/octopi-network.txt +++ /dev/null @@ -1,3 +0,0 @@ -# Using this file to configure your network connection is no longer supported. -# -# Please use octopi-wpa-supplicant.txt instead. From 61e0f4984f7ed1dabdca89cf1903674d4c5d0419 Mon Sep 17 00:00:00 2001 From: Thomas Rose Date: Thu, 11 Feb 2021 16:05:50 +0100 Subject: [PATCH 03/50] Small fixes for Ubuntu-Variant Make small changes to HAProxy and webcamd-config to make the Ubuntu-Variant start working - running with interface, normal webcam working (HLS not tested) --- .../filesystem/root/etc/haproxy/haproxy.cfg | 49 +++++++++++++++++++ .../root/etc/systemd/system/webcamd.service | 15 ++++++ 2 files changed, 64 insertions(+) create mode 100644 src/variants/ubuntu_arm64/filesystem/root/etc/haproxy/haproxy.cfg create mode 100644 src/variants/ubuntu_arm64/filesystem/root/etc/systemd/system/webcamd.service diff --git a/src/variants/ubuntu_arm64/filesystem/root/etc/haproxy/haproxy.cfg b/src/variants/ubuntu_arm64/filesystem/root/etc/haproxy/haproxy.cfg new file mode 100644 index 00000000..8ef4d164 --- /dev/null +++ b/src/variants/ubuntu_arm64/filesystem/root/etc/haproxy/haproxy.cfg @@ -0,0 +1,49 @@ +global + maxconn 4096 + user haproxy + group haproxy + log /dev/log local1 debug + tune.ssl.default-dh-param 2048 + +defaults + log global + mode http + compression algo gzip + option httplog + option dontlognull + retries 3 + option redispatch + option http-server-close + option forwardfor + maxconn 2000 + timeout connect 5s + timeout client 15min + timeout server 15min + +frontend public + bind :::80 v4v6 + bind :::443 v4v6 ssl crt /etc/ssl/snakeoil.pem + option forwardfor except 127.0.0.1 + use_backend webcam if { path_beg /webcam/ } + use_backend webcam_hls if { path_beg /hls/ } + use_backend webcam_hls if { path_beg /jpeg/ } + default_backend octoprint + +backend octoprint + acl needs_scheme req.hdr_cnt(X-Scheme) eq 0 + + http-request replace-path ^([^\ :]*)\ /(.*) \1\ /\2 + http-request add-header X-Scheme https if needs_scheme { ssl_fc } + http-request add-header X-Scheme http if needs_scheme !{ ssl_fc } + option forwardfor + server octoprint1 127.0.0.1:5000 + errorfile 503 /etc/haproxy/errors/503-no-octoprint.http + +backend webcam + http-request replace-path /webcam/(.*) /\1 + server webcam1 127.0.0.1:8080 + errorfile 503 /etc/haproxy/errors/503-no-webcam.http + +backend webcam_hls + server webcam_hls_1 127.0.0.1:28126 + errorfile 503 /etc/haproxy/errors/503-no-webcam-hls.http diff --git a/src/variants/ubuntu_arm64/filesystem/root/etc/systemd/system/webcamd.service b/src/variants/ubuntu_arm64/filesystem/root/etc/systemd/system/webcamd.service new file mode 100644 index 00000000..bd5feb53 --- /dev/null +++ b/src/variants/ubuntu_arm64/filesystem/root/etc/systemd/system/webcamd.service @@ -0,0 +1,15 @@ +[Unit] +Description=the OctoPi webcam daemon with the user specified config +# ConditionPathExists=/etc/octopi_streamer/mjpeg + +[Service] +WorkingDirectory=/root/bin +StandardOutput=append:/var/log/webcamd.log +StandardError=append:/var/log/webcamd.log +ExecStart=/root/bin/webcamd +Restart=always +Type=forking +RestartSec=1 + +[Install] +WantedBy=multi-user.target From 3214fe2cf5228a7ea2193726c3aefaa9e2dfe7e1 Mon Sep 17 00:00:00 2001 From: Thomas Rose Date: Thu, 11 Feb 2021 16:05:58 +0100 Subject: [PATCH 04/50] Revert "Delete octopi-network.txt" This reverts commit ca2840ced1dc6ae398e4c693927a4527514b042a. --- src/modules/octopi/filesystem/boot/octopi-network.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/modules/octopi/filesystem/boot/octopi-network.txt diff --git a/src/modules/octopi/filesystem/boot/octopi-network.txt b/src/modules/octopi/filesystem/boot/octopi-network.txt new file mode 100644 index 00000000..85c4c0b1 --- /dev/null +++ b/src/modules/octopi/filesystem/boot/octopi-network.txt @@ -0,0 +1,3 @@ +# Using this file to configure your network connection is no longer supported. +# +# Please use octopi-wpa-supplicant.txt instead. From 5d08be9d487834470d2d64a3e1b770d5466781f5 Mon Sep 17 00:00:00 2001 From: Thomas Rose Date: Thu, 11 Feb 2021 16:11:14 +0100 Subject: [PATCH 05/50] Update post_chroot_script Unpack filesystem changes for ubuntu --- src/variants/ubuntu_arm64/post_chroot_script | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/variants/ubuntu_arm64/post_chroot_script b/src/variants/ubuntu_arm64/post_chroot_script index ff0ed505..d699ad28 100644 --- a/src/variants/ubuntu_arm64/post_chroot_script +++ b/src/variants/ubuntu_arm64/post_chroot_script @@ -7,6 +7,8 @@ export LC_ALL=C source /common.sh install_cleanup_trap +# Unpack the filesystem changes for the variant +unpack /filesystem/root / # add-apt-repository ppa:ubuntu-raspi2/ppa -y apt-get update From d7e5121251b733878e4f52e31a8c9fe10c581b5e Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 22 Feb 2021 15:17:30 +0200 Subject: [PATCH 06/50] Add rpi.gpio-common https://github.com/guysoft/OctoPi/issues/711#issuecomment-783320975 --- src/variants/ubuntu_arm64/post_chroot_script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/variants/ubuntu_arm64/post_chroot_script b/src/variants/ubuntu_arm64/post_chroot_script index d699ad28..918c8bc9 100644 --- a/src/variants/ubuntu_arm64/post_chroot_script +++ b/src/variants/ubuntu_arm64/post_chroot_script @@ -12,6 +12,6 @@ unpack /filesystem/root / # add-apt-repository ppa:ubuntu-raspi2/ppa -y apt-get update -apt-get -y --force-yes install libraspberrypi-bin +apt-get -y --force-yes install libraspberrypi-bin rpi.gpio-common apt-get clean apt-get autoremove -y From 8e9fa779ec7a9f82015281fa420773cc86f2fa8d Mon Sep 17 00:00:00 2001 From: Willmac16 Date: Sun, 28 Feb 2021 10:02:34 -0800 Subject: [PATCH 07/50] Compatibility for ws281x on Ubuntu 64 (#724) * Compatibility for ws281x on Ubuntu 64 * full paths for ws281x compatibility changes * remove the file touch --- .../filesystem/root/etc/udev/rules.d/50-spi.rules | 1 + src/variants/ubuntu_arm64/post_chroot_script | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 src/variants/ubuntu_arm64/filesystem/root/etc/udev/rules.d/50-spi.rules diff --git a/src/variants/ubuntu_arm64/filesystem/root/etc/udev/rules.d/50-spi.rules b/src/variants/ubuntu_arm64/filesystem/root/etc/udev/rules.d/50-spi.rules new file mode 100644 index 00000000..c7d5c8b1 --- /dev/null +++ b/src/variants/ubuntu_arm64/filesystem/root/etc/udev/rules.d/50-spi.rules @@ -0,0 +1 @@ +SUBSYSTEM=="spidev", GROUP="spi", MODE="0660" diff --git a/src/variants/ubuntu_arm64/post_chroot_script b/src/variants/ubuntu_arm64/post_chroot_script index 918c8bc9..b6c0ac89 100644 --- a/src/variants/ubuntu_arm64/post_chroot_script +++ b/src/variants/ubuntu_arm64/post_chroot_script @@ -15,3 +15,8 @@ apt-get update apt-get -y --force-yes install libraspberrypi-bin rpi.gpio-common apt-get clean apt-get autoremove -y + +# Compatibility for ws281x +sudo ln /boot/config-5.8.0-1006-raspi /boot/config.txt +sudo groupadd spi +sudo adduser pi spi From 8e02c9dca6fdba2f5fccf1676a2c158402bcb066 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Tue, 9 Mar 2021 12:08:53 +0200 Subject: [PATCH 08/50] Revert "Compatibility for ws281x on Ubuntu 64 (#724)" This reverts commit 8e9fa779ec7a9f82015281fa420773cc86f2fa8d. --- .../filesystem/root/etc/udev/rules.d/50-spi.rules | 1 - src/variants/ubuntu_arm64/post_chroot_script | 5 ----- 2 files changed, 6 deletions(-) delete mode 100644 src/variants/ubuntu_arm64/filesystem/root/etc/udev/rules.d/50-spi.rules diff --git a/src/variants/ubuntu_arm64/filesystem/root/etc/udev/rules.d/50-spi.rules b/src/variants/ubuntu_arm64/filesystem/root/etc/udev/rules.d/50-spi.rules deleted file mode 100644 index c7d5c8b1..00000000 --- a/src/variants/ubuntu_arm64/filesystem/root/etc/udev/rules.d/50-spi.rules +++ /dev/null @@ -1 +0,0 @@ -SUBSYSTEM=="spidev", GROUP="spi", MODE="0660" diff --git a/src/variants/ubuntu_arm64/post_chroot_script b/src/variants/ubuntu_arm64/post_chroot_script index b6c0ac89..918c8bc9 100644 --- a/src/variants/ubuntu_arm64/post_chroot_script +++ b/src/variants/ubuntu_arm64/post_chroot_script @@ -15,8 +15,3 @@ apt-get update apt-get -y --force-yes install libraspberrypi-bin rpi.gpio-common apt-get clean apt-get autoremove -y - -# Compatibility for ws281x -sudo ln /boot/config-5.8.0-1006-raspi /boot/config.txt -sudo groupadd spi -sudo adduser pi spi From ca3dbfb5758d6b85bb7d9c6ac9b8db4a81da949d Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Thu, 11 Mar 2021 12:08:37 +0200 Subject: [PATCH 09/50] Add rpi-imager compatible file https://github.com/raspberrypi/rpi-imager/issues/162 --- media/rpi-imager-OctoPi.png | Bin 0 -> 12860 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 media/rpi-imager-OctoPi.png diff --git a/media/rpi-imager-OctoPi.png b/media/rpi-imager-OctoPi.png new file mode 100644 index 0000000000000000000000000000000000000000..ac7388695cf586758462275abe325dfc5dc4567b GIT binary patch literal 12860 zcmV-CGQ-V@P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+P$1-b|krSh5us}S^{hUSPtwt+JTm@@1n>yW1f+8 zG(FQKi&dEbBI23=a@_f^|Ge%$_^0P=E|=P@n|c1pJ@+{Hruol5{rw$$et*Az;`i^u z@2|Tbzlgk)_?kXH*75cJ!RzJc2Yy^<{{Fga?Z=%y7yA0e_XU&g9QkJdI!IoRpVveF zx==r#Z>+ca>riL>d|h8}d_(#A?|u)fe!l2u_v;I}vP!#fqZH#wA^G=r`-~vzzmNuB z6Mu&kcwgW(y<(0pC4Enc1^I1y-(S7|b%B0c4fmw z*U?hTtu$-3wbt9{u_rLFbnCUZ-uoEQ4Q@2J*5LhvS7w}P=2@oAI@|1XEYfG?RhF%~ z+UjfUxYGtEw(Yvx?t7fz4oGqGDaTGd?esG)xpvddw_LmRw%hOc5w)+V{^`%Z5w-9Y zwfG{X_thU!<5gGd_a%bhq$p-YEapJOt0F)`N5#yykaJYz6f@r=MNuMyEQ*cWK@lT_ z`Gi<*_z}CGk^7h8=1TjQ;uil|8nHzlhov&#f1+PZerSeWLpK{b>V& z93r*xzy13EccGgL;Mu6obb--&nM@Cb^kS9oA<8?DbGS>G>z{;qKS{`2}tS8w;n z)$L}-<@2nq%v^}UNxzLSrC$dB+i$`juk3!m^xqBqm$9*8#+Ab#R?JzuXXlYN*%0or z@D^$QT%@<|aqgH@O)m`oFTT3J`^8^=h5DA=xEjf5rClnUN-%44xK{RFGXn|pT=SGu z+h?S<+ARX@R;*LZHj`bZgd{k3PR~_fx}NUVU>Q9^E3CODbrTVg{0pKiR^${*TyW1l z<|1iM6!Fg)W;q0Px3jFWQZ*)JmxxUm(>6^Y6KeA7Z6Y+HhWkojb9VI3dNO8d-lcACtnQqBfPN(Lh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boot/octopi.txt | 10 +++++++ .../etc/systemd/system/networkcheck.service | 8 ++++++ .../etc/systemd/system/networkcheck.timer | 10 +++++++ .../root/usr/local/bin/networkcheck | 28 +++++++++++++++++++ src/modules/octopi/start_chroot_script | 4 +++ 5 files changed, 60 insertions(+) create mode 100644 src/modules/octopi/filesystem/root/etc/systemd/system/networkcheck.service create mode 100644 src/modules/octopi/filesystem/root/etc/systemd/system/networkcheck.timer create mode 100755 src/modules/octopi/filesystem/root/usr/local/bin/networkcheck diff --git a/src/modules/octopi/filesystem/boot/octopi.txt b/src/modules/octopi/filesystem/boot/octopi.txt index bc015399..c842c6b4 100644 --- a/src/modules/octopi/filesystem/boot/octopi.txt +++ b/src/modules/octopi/filesystem/boot/octopi.txt @@ -76,6 +76,16 @@ #camera_http_webroot="./www-octopi" #camera_http_options="-n" +# Configuration of network monitoring +# +# This enables network monitoring for wifi connections with a simple ping test. +# If connection terminates by variable reasons system tries to restart the wifi connection to reestablish a connection. +# The connection test is done every minute. +# By default it is disabled (0 = off / 1 = on) +# dstination_host can be an ip address or a hostname (for hostname ensure dns resosultion is working correctly) +enable_network_monitor=0 +destination_host=192.168.1.1 + ### EXPERIMENTAL # Support for different streamer types. # diff --git a/src/modules/octopi/filesystem/root/etc/systemd/system/networkcheck.service b/src/modules/octopi/filesystem/root/etc/systemd/system/networkcheck.service new file mode 100644 index 00000000..ec4a008e --- /dev/null +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/networkcheck.service @@ -0,0 +1,8 @@ +[Unit] + Description=Network Monitor + ConditionPathExists=/usr/local/bin/networkcheck + +[Service] + User=root + Type=simple + ExecStart=/usr/local/bin/networkcheck & diff --git a/src/modules/octopi/filesystem/root/etc/systemd/system/networkcheck.timer b/src/modules/octopi/filesystem/root/etc/systemd/system/networkcheck.timer new file mode 100644 index 00000000..940694fe --- /dev/null +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/networkcheck.timer @@ -0,0 +1,10 @@ +[Unit] + Description=Network Monitor Trigger (every 1 minutes) + After=network.target + +[Timer] + OnCalendar=*-*-* *:*:00 + AccuracySec=1s + +[Install] + WantedBy=timers.target diff --git a/src/modules/octopi/filesystem/root/usr/local/bin/networkcheck b/src/modules/octopi/filesystem/root/usr/local/bin/networkcheck new file mode 100755 index 00000000..0ab1f406 --- /dev/null +++ b/src/modules/octopi/filesystem/root/usr/local/bin/networkcheck @@ -0,0 +1,28 @@ +#!/bin/bash + +source /boot/octopi.txt + +if [ $enable_network_monitor == 1 ] && [ "$destination_host" != "" ]; then + + if [ -f /boot/octopi-wpa-supplicant.txt ]; then # check if config file exists + input="/boot/octopi-wpa-supplicant.txt" + while IFS= read -r line; do # read config file line by line + if [[ $line =~ ^network=.* ]]; then # check if we have a network config if a line starts with "network=" + echo "network config found..." + ping -c4 $destination_host > /dev/null # check if destination is reachable - possible by default the router + if [ $? != 0 ]; then + echo "Destination not reachable - reconfigure interface..." + sudo wpa_cli -i wlan0 reconfigure # reconfigure network to trigger reconnect + sudo dhclient -v # ensure connection will be established by refresh dhcp lease + echo "Reconnect done." + exit 0 # if we detect multiple network configs exit after 1st one - one reconnect is enough :-) + else + echo "Destination reachable - no action needed." + exit 0 # destination reached - exit loop + fi + fi + done < "$input" + fi +else + echo "Network monitoring not enabled." +fi diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 6398aea4..915f13d1 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -258,6 +258,10 @@ fi systemctl_if_exists enable ffmpeg_hls.service +### Network monitoring + +systemctl_if_exists enable networkcheck.timer + #cleanup apt-get clean apt-get autoremove -y From ba1750c1d560749d3e997b194f3609cf6ddb5f62 Mon Sep 17 00:00:00 2001 From: hawkeyexp Date: Tue, 16 Mar 2021 03:52:10 +0100 Subject: [PATCH 11/50] Add avrdude for firmware flashing --- src/modules/octopi/start_chroot_script | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 915f13d1..eed1e5e5 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -262,6 +262,11 @@ systemctl_if_exists enable ffmpeg_hls.service systemctl_if_exists enable networkcheck.timer +### Firmare flashing + +echo "--- Installing avrdude" +apt-get -y install avrdude + #cleanup apt-get clean apt-get autoremove -y From 4e64f6886953382b336043b46541f6e3dc8971f2 Mon Sep 17 00:00:00 2001 From: Jamie Date: Sun, 21 Mar 2021 18:18:46 -0500 Subject: [PATCH 12/50] Fix problem where cmake fails to detect compiler Found this fix while examining why v1pi was failing to build. Apparently current cmake (3.16) fails with the GLOB operation and it sounds like it's related to this issue https://gitlab.kitware.com/cmake/cmake/-/issues/20568 According to that thread, this is a consequence of an update within 3.15, and (probably) fixed sometime before 3.19. --- src/modules/octopi/start_chroot_script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index eed1e5e5..c9037645 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -33,7 +33,7 @@ echo "removing:" $remove_extra apt-get remove -y --purge $remove_extra apt-get autoremove -y -apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev libatlas3-base +apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake=3.13.4-1 cmake-data=3.13.4-1 avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev libatlas3-base echo " - Reinstall iputils-ping" apt-get install --reinstall iputils-ping From 73735b8f12eafd0e7de8f1de5aef4b7551e6bf2b Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 4 Apr 2021 13:39:53 +0300 Subject: [PATCH 13/50] Fix build on Ubuntu arm64 #731 --- src/modules/octopi/start_chroot_script | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index c9037645..38d3f69e 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -33,7 +33,12 @@ echo "removing:" $remove_extra apt-get remove -y --purge $remove_extra apt-get autoremove -y -apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake=3.13.4-1 cmake-data=3.13.4-1 avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev libatlas3-base +if [ "${BASE_DISTRO}" == "ubuntu" ]; then + apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake cmake-data avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev libatlas3-base +else + apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake=3.13.4-1 cmake-data=3.13.4-1 avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev libatlas3-base +fi + echo " - Reinstall iputils-ping" apt-get install --reinstall iputils-ping From 3595898c11c6bd8a017202434ba5c9651e37dea2 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Thu, 17 Jun 2021 13:46:15 +0300 Subject: [PATCH 14/50] Enlarge build root so there is enough space --- src/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/config b/src/config index 4a1cc5de..60299236 100755 --- a/src/config +++ b/src/config @@ -2,3 +2,5 @@ export DIST_NAME=OctoPi export DIST_VERSION=1.0.0 export MODULES="base(raspicam, network, disable-services(octopi), password-for-sudo)" +export BASE_IMAGE_ENLARGEROOT=2000 +export BASE_IMAGE_RESIZEROOT=200 From 1a00e6ec9b586760080f456c5ff4692749581b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 29 Jun 2021 14:38:12 +0200 Subject: [PATCH 15/50] =?UTF-8?q?=F0=9F=90=9B=20Restore=20120s=20daemon=20?= =?UTF-8?q?loop=20behaviour?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We wait for our child processes to complete, reset our "currently run cameras" array, then wait 2min and loop. Closes #740 --- .../octopi/filesystem/home/root/bin/webcamd | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index effdfbe2..c372e142 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -104,6 +104,14 @@ function cleanup() { exit 0 } +# waits for our child processes +function awaitChildren() { + local pids=$(jobs -pr) + for pid in $pids; do + wait $pid + done +} + # says goodbye when the script shuts down function goodbye() { # say goodbye @@ -237,6 +245,7 @@ while true; do camera_http_webroot="${array_camera_http_webroot[${i}]}" camera_http_options="${array_camera_http_options[${i}]}" brokenfps_usb_devices="${array_camera_brokenfps_usb_devices[${i}]}" + if [[ ${camera_usb_device} ]] && { [[ "usb" == ${scan_mode} ]] || [[ "auto" == ${scan_mode} ]]; }; then # usb device is explicitly set in options usb_device_path=`readlink -f ${camera_usb_device}` @@ -253,6 +262,7 @@ while true; do startUsb "$usb_device_path" continue fi + elif [[ -z ${camera_usb_device} ]] && { [[ "usb-auto" == ${scan_mode} ]] || [[ "auto" == ${scan_mode} ]]; }; then for video_device in "${video_devices[@]}"; do if [[ "raspi" != "$video_device" ]]; then @@ -271,6 +281,7 @@ while true; do continue fi fi + if [[ "raspi" == ${scan_mode} ]] || [[ "auto" == ${scan_mode} ]]; then video_device="raspi" if containsString "$video_device" "${array_camera_device[@]}"; then @@ -290,14 +301,19 @@ while true; do fi done done + array_assigned_device=( ${array_camera_device[*]} ) if [[ ${#array_camera[@]} -eq ${#array_assigned_device[@]} ]]; then - echo "Done bring up all configured video device" - exit 0 - else - echo "Scan again in two minutes" - sleep 120 & - sleep_pid=$! - wait ${sleep_pid} + echo "Done bringing up all configured video devices" + awaitChildren + + # reset array_camera_device to empty + array_camera_device=() + for cam in ${array_camera[@]}; do + array_camera_device+=("") + done fi + + echo "Scanning again in two minutes" + sleep 120 done From 3dc1381937922f59fe46c9ddd75d1a6278841b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 29 Jun 2021 14:38:43 +0200 Subject: [PATCH 16/50] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20some=20typos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/octopi/filesystem/home/root/bin/webcamd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index c372e142..2af5a790 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -73,7 +73,7 @@ for cfg_file in ${cfg_files[@]}; do echo "raspi options: $camera_raspi_options" echo "http options: -w $camera_http_webroot $camera_http_options" echo "" - echo "Explicitly USB device: $extracted_device" + echo "Explicitly set USB device: $extracted_device" echo "-----------------------------------------------" echo "" @@ -251,7 +251,7 @@ while true; do usb_device_path=`readlink -f ${camera_usb_device}` if containsString "$usb_device_path" "${array_camera_device[@]}"; then if [[ "auto" != ${scan_mode} ]]; then - array_camera_device[${i}]="alredy_in_use" + array_camera_device[${i}]="already_in_use" echo "config file='$camera_config':Video device already in use." continue fi @@ -286,7 +286,7 @@ while true; do video_device="raspi" if containsString "$video_device" "${array_camera_device[@]}"; then if [[ "auto" != ${scan_mode} ]]; then - array_camera_device[${i}]="alredy_in_use" + array_camera_device[${i}]="already_in_use" echo "config file='$camera_config':RasPiCam device already in use." fi elif containsString "$video_device" "${video_devices[@]}"; then From 8d1e000b549ee8aaba2aa4a6af6ef4ed87d56f49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 29 Jun 2021 14:39:29 +0200 Subject: [PATCH 17/50] =?UTF-8?q?=F0=9F=90=9B=20Fix=20handling=20of=20non-?= =?UTF-8?q?usb=20v4l2=20devices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They don't have a vid and pid, so don't try to format those as hex. --- .../octopi/filesystem/home/root/bin/webcamd | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 2af5a790..4aded2e0 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -189,19 +189,22 @@ function startUsb { product=`cat $uevent_file | grep PRODUCT | cut -d"=" -f2` vid=`echo $product | cut -d"/" -f1` pid=`echo $product | cut -d"/" -f2` - vidpid=`printf "%04x:%04x" "0x$vid" "0x$pid"` - - # ... then look if it is in our list of known broken-fps-devices and if so remove - # the -f parameter from the options (if it's in there, else that's just a no-op) - for identifier in ${brokenfps_usb_devices[@]}; - do - if [ "$vidpid" = "$identifier" ]; then - echo - echo "Camera model $vidpid is known to not work with -f parameter, stripping it out" - echo - options=`echo $options | sed -e "s/\(\s\+\|^\)-f\s\+[0-9]\+//g"` - fi - done + + if [[ -n "$vid" && -n "$pid" ]]; then + vidpid=`printf "%04x:%04x" "0x$vid" "0x$pid"` + + # ... then look if it is in our list of known broken-fps-devices and if so remove + # the -f parameter from the options (if it's in there, else that's just a no-op) + for identifier in ${brokenfps_usb_devices[@]}; + do + if [ "$vidpid" = "$identifier" ]; then + echo + echo "Camera model $vidpid is known to not work with -f parameter, stripping it out" + echo + options=`echo $options | sed -e "s/\(\s\+\|^\)-f\s\+[0-9]\+//g"` + fi + done + fi fi logger -s "Starting USB webcam" From edfa3653d8a18de9bf4dc5dffecb4a92ff96bace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 29 Jun 2021 14:42:33 +0200 Subject: [PATCH 18/50] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20Fix=20more=20typos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/octopi/filesystem/home/root/bin/webcamd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 4aded2e0..8a01a40f 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -261,7 +261,7 @@ while true; do elif containsString "$usb_device_path" "${video_devices[@]}"; then array_camera_device[${i}]="$usb_device_path" # explicitly set usb device was found in video_devices array, start usb with the found device - echo "config file='$camera_config':USB device was set in options and found in devices, start MJPG-streamer with the configured USB video device: $usb_device_path" + echo "config file='$camera_config':USB device was set in options and found in devices, starting MJPG-streamer with the configured USB video device: $usb_device_path" startUsb "$usb_device_path" continue fi @@ -274,7 +274,7 @@ while true; do else array_camera_device[${i}]="$video_device" # device is not set explicitly in options, start usb with first found usb camera as the device - echo "config file='$camera_config':USB device was not set in options, start MJPG-streamer with the first found video device: ${video_device}" + echo "config file='$camera_config':USB device was not set in options, starting MJPG-streamer with the first found video device: ${video_device}" startUsb "${video_device}" break fi @@ -294,7 +294,7 @@ while true; do fi elif containsString "$video_device" "${video_devices[@]}"; then array_camera_device[${i}]="$video_device" - echo "config file='$camera_config':Start MJPG-streamer with video device: ${video_device}" + echo "config file='$camera_config':Starting MJPG-streamer with video device: ${video_device}" startRaspi sleep 30 & sleep_pid=$! From 8c9bd970e93064bfe49aae1e9fa72c112d4738ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 29 Jun 2021 15:42:17 +0200 Subject: [PATCH 19/50] =?UTF-8?q?=F0=9F=90=9B=20Add=20haproxy.cfg=20for=20?= =?UTF-8?q?2.x=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Build will check which one is installed and only enable the correct one. See also #711 --- .../haproxy/{haproxy.cfg => haproxy.1.x.cfg} | 0 .../root/etc/haproxy/haproxy.2.x.cfg | 49 +++++++++++++++++++ src/modules/octopi/start_chroot_script | 9 ++++ 3 files changed, 58 insertions(+) rename src/modules/octopi/filesystem/root/etc/haproxy/{haproxy.cfg => haproxy.1.x.cfg} (100%) create mode 100644 src/modules/octopi/filesystem/root/etc/haproxy/haproxy.2.x.cfg diff --git a/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.1.x.cfg similarity index 100% rename from src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg rename to src/modules/octopi/filesystem/root/etc/haproxy/haproxy.1.x.cfg diff --git a/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.2.x.cfg b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.2.x.cfg new file mode 100644 index 00000000..8ef4d164 --- /dev/null +++ b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.2.x.cfg @@ -0,0 +1,49 @@ +global + maxconn 4096 + user haproxy + group haproxy + log /dev/log local1 debug + tune.ssl.default-dh-param 2048 + +defaults + log global + mode http + compression algo gzip + option httplog + option dontlognull + retries 3 + option redispatch + option http-server-close + option forwardfor + maxconn 2000 + timeout connect 5s + timeout client 15min + timeout server 15min + +frontend public + bind :::80 v4v6 + bind :::443 v4v6 ssl crt /etc/ssl/snakeoil.pem + option forwardfor except 127.0.0.1 + use_backend webcam if { path_beg /webcam/ } + use_backend webcam_hls if { path_beg /hls/ } + use_backend webcam_hls if { path_beg /jpeg/ } + default_backend octoprint + +backend octoprint + acl needs_scheme req.hdr_cnt(X-Scheme) eq 0 + + http-request replace-path ^([^\ :]*)\ /(.*) \1\ /\2 + http-request add-header X-Scheme https if needs_scheme { ssl_fc } + http-request add-header X-Scheme http if needs_scheme !{ ssl_fc } + option forwardfor + server octoprint1 127.0.0.1:5000 + errorfile 503 /etc/haproxy/errors/503-no-octoprint.http + +backend webcam + http-request replace-path /webcam/(.*) /\1 + server webcam1 127.0.0.1:8080 + errorfile 503 /etc/haproxy/errors/503-no-webcam.http + +backend webcam_hls + server webcam_hls_1 127.0.0.1:28126 + errorfile 503 /etc/haproxy/errors/503-no-webcam-hls.http diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 38d3f69e..1b905a8e 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -227,6 +227,15 @@ fi if [ "$OCTOPI_INCLUDE_HAPROXY" == "yes" ] then systemctl_if_exists enable gencert.service + + haproxy_version=$(dpkg -s haproxy | grep '^Version:' | awk '{print $2}') + if [[ $haproxy_version = 2.* ]]; then + mv /etc/haproxy/haproxy.2.x.cfg /etc/haproxy/haproxy.cfg + rm /etc/haproxy/haproxy.1.x.cfg + else + mv /etc/haproxy/haproxy.1.x.cfg /etc/haproxy/haproxy.cfg + rm /etc/haproxy/haproxy.2.x.cfg + fi else # let's remove the configs for system services we don't need rm /etc/systemd/system/gencert.service From 9e473f14ad5e04c9dd6e5f4f4373860a26d25e46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 2 Jul 2021 18:02:23 +0200 Subject: [PATCH 20/50] =?UTF-8?q?=F0=9F=90=9B=20Remove=20mjpg-streamer=20f?= =?UTF-8?q?rom=20pi=20home?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's executed as root so it shouldn't live in a user directory (potential for abuse w/ image access). Move it to /opt/mjpg-streamer, include symlink at old location for backwards compatibility. --- src/modules/octopi/config | 5 +-- .../octopi/filesystem/home/root/bin/webcamd | 2 +- src/modules/octopi/start_chroot_script | 42 ++++++++++++------- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/modules/octopi/config b/src/modules/octopi/config index e9f3d064..43871615 100755 --- a/src/modules/octopi/config +++ b/src/modules/octopi/config @@ -12,10 +12,7 @@ [ -n "$OCTOPI_INCLUDE_CURAENGINE" ] || OCTOPI_INCLUDE_CURAENGINE=no # mjpg streamer -[ -n "$OCTOPI_MJPGSTREAMER_REPO_SHIP" ] || OCTOPI_MJPGSTREAMER_REPO_SHIP=https://github.com/jacksonliam/mjpg-streamer.git -[ -n "$OCTOPI_MJPGSTREAMER_REPO_BUILD" ] || OCTOPI_MJPGSTREAMER_REPO_BUILD= -[ -n "$OCTOPI_MJPGSTREAMER_REPO_BRANCH" ] || OCTOPI_MJPGSTREAMER_REPO_BRANCH=master -[ -n "$OCTOPI_MJPGSTREAMER_REPO_DEPTH" ] || OCTOPI_MJPGSTREAMER_REPO_DEPTH=1 +[ -n "$OCTOPI_MJPGSTREAMER_ARCHIVE" ] || OCTOPI_MJPGSTREAMER_ARCHIVE=https://github.com/jacksonliam/mjpg-streamer/archive/master.zip [ -n "$OCTOPI_INCLUDE_MJPGSTREAMER" ] || OCTOPI_INCLUDE_MJPGSTREAMER=yes # FFMPEG HLS diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 8a01a40f..f2c6dfb1 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -11,7 +11,7 @@ ### computer. ### ######################################################################## -MJPGSTREAMER_HOME=/home/pi/mjpg-streamer +MJPGSTREAMER_HOME=/opt/mjpg-streamer MJPGSTREAMER_INPUT_USB="input_uvc.so" MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so" diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 1b905a8e..e57442aa 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -59,7 +59,8 @@ pushd /home/"${BASE_USER}" #mjpg-streamer if [ "$OCTOPI_INCLUDE_MJPGSTREAMER" == "yes" ] then - echo "--- Installing mjpg-streamer" + install_dir=/opt/mjpg-streamer + echo "--- Installing mjpg-streamer to $install_dir" if [ $( is_in_apt libjpeg62-turbo-dev ) -eq 1 ]; then apt-get -y --force-yes install libjpeg62-turbo-dev elif [ $( is_in_apt libjpeg8-dev ) -eq 1 ]; then @@ -67,26 +68,35 @@ pushd /home/"${BASE_USER}" fi apt-get -y --force-yes --no-install-recommends install imagemagick ffmpeg libv4l-dev - gitclone OCTOPI_MJPGSTREAMER_REPO mjpg-streamer - pushd mjpg-streamer - mv mjpg-streamer-experimental/* . + wget $OCTOPI_MJPGSTREAMER_ARCHIVE -O mjpg-streamer.zip + unzip mjpg-streamer.zip + rm mjpg-streamer.zip + + pushd mjpg-streamer-master/mjpg-streamer-experimental # As said in Makefile, it is just a wrapper around CMake. # To apply -j option, we have to unwrap it. - MJPG_STREAMER_BUILD_DIR=_build - [ -d ${MJPG_STREAMER_BUILD_DIR} ] || (mkdir ${MJPG_STREAMER_BUILD_DIR} && \ - chown "${BASE_USER}:${BASE_USER}" ${MJPG_STREAMER_BUILD_DIR}) - [ -f ${MJPG_STREAMER_BUILD_DIR}/Makefile ] || (cd ${MJPG_STREAMER_BUILD_DIR} && \ - sudo -u "${BASE_USER}" cmake -DCMAKE${MJPG_STREAMER_BUILD_DIR}_TYPE=Release ..) + build_dir=_build + mkdir -p $build_dir + pushd $build_dir + cmake -DCMAKE_BUILD_TYPE=Release .. + popd + + make -j $(nproc) -C $build_dir - sudo -u "${BASE_USER}" make -j $(nproc) -C ${MJPG_STREAMER_BUILD_DIR} + mkdir -p $install_dir - sudo -u "${BASE_USER}" cp ${MJPG_STREAMER_BUILD_DIR}/mjpg_streamer . - sudo -u "${BASE_USER}" find ${MJPG_STREAMER_BUILD_DIR} -name "*.so" -type f -exec cp {} . \; + install -m 755 $build_dir/mjpg_streamer $install_dir + find $build_dir -name "*.so" -type f -exec install -m 644 {} $install_dir \; + + # copy bundled web folder + cp -a -r ./www $install_dir + chmod 755 $install_dir/www + chmod -R 644 $install_dir/www # create our custom web folder and add a minimal index.html to it - sudo -u "${BASE_USER}" mkdir www-octopi - pushd www-octopi + mkdir $install_dir/www-octopi + pushd $install_dir/www-octopi cat <> index.html mjpg_streamer test page @@ -101,6 +111,10 @@ pushd /home/"${BASE_USER}" EOT popd popd + rm -rf mjpg-streamer-master + + # symlink for backwards compatibility + sudo -u "${BASE_USER}" ln -s $install_dir /home/"${BASE_USER}"/mjpg-streamer fi # FFMPEG HLS From d36f1599cabca70d3aa21f6d0e481a0630f01d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 2 Jul 2021 18:12:25 +0200 Subject: [PATCH 21/50] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Install=20OctoPrint?= =?UTF-8?q?=20from=20PyPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/octopi/config | 3 +-- src/modules/octopi/start_chroot_script | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modules/octopi/config b/src/modules/octopi/config index e9f3d064..c9474d1f 100755 --- a/src/modules/octopi/config +++ b/src/modules/octopi/config @@ -2,8 +2,7 @@ # All our config settings must start with OCTOPI_ # OctoPrint archive -[ -n "$OCTOPI_OCTOPRINT_ARCHIVE" ] || OCTOPI_OCTOPRINT_ARCHIVE=$(wget -q -O - https://api.github.com/repos/foosel/OctoPrint/releases/latest | grep "zipball_url" | cut -d : -f 2,3 | tr -d \" | tr -d ,) -[ -n "$OCTOPI_OCTOPRINT_REPO_SHIP" ] || OCTOPI_OCTOPRINT_REPO_SHIP=https://github.com/foosel/OctoPrint.git +[ -n "$OCTOPI_OCTOPRINT_PACKAGE" ] || OCTOPI_OCTOPRINT_PACKAGE="OctoPrint" [ -n "$OCTOPI_INCLUDE_OCTOPRINT" ] || OCTOPI_INCLUDE_OCTOPRINT=yes # CuraEngine archive & version diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 1b905a8e..bed1ed93 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -53,7 +53,7 @@ pushd /home/"${BASE_USER}" if [ "$OCTOPI_INCLUDE_OCTOPRINT" == "yes" ] then echo "--- Installing OctoPrint" - PIP_DEFAULT_TIMEOUT=60 sudo -u "${BASE_USER}" /home/"${BASE_USER}"/oprint/bin/pip install $OCTOPI_OCTOPRINT_ARCHIVE + PIP_DEFAULT_TIMEOUT=60 sudo -u "${BASE_USER}" /home/"${BASE_USER}"/oprint/bin/pip install $OCTOPI_OCTOPRINT_PACKAGE fi #mjpg-streamer From ccda0a601b5dc4e53e320f9ca383c389d229392c Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 18 Jul 2021 15:30:31 +0300 Subject: [PATCH 22/50] Add another mirror --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index 6091ecc9..36afc154 100644 --- a/README.rst +++ b/README.rst @@ -19,6 +19,8 @@ Download the latest stable build via this button: Official mirror is `here `_ +Second mirror is `here `_ + Nightly builds are available `here `_ 64bit Nightly builds are available `here `_ From 6deaa22a71bc1b648652b50c3be2f4d743b27e54 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 18 Jul 2021 15:31:05 +0300 Subject: [PATCH 23/50] Update url --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 36afc154..790ae3bf 100644 --- a/README.rst +++ b/README.rst @@ -19,7 +19,7 @@ Download the latest stable build via this button: Official mirror is `here `_ -Second mirror is `here `_ +Second mirror is `here `_ Nightly builds are available `here `_ From 55228f05d288e6f307cf5abda323dd918e2b148a Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 19 Jul 2021 19:05:54 +0300 Subject: [PATCH 24/50] Add missing unzip for ubuntu needed by #743 --- src/modules/octopi/start_chroot_script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index ac6ca0dd..647eac6f 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -34,7 +34,7 @@ apt-get remove -y --purge $remove_extra apt-get autoremove -y if [ "${BASE_DISTRO}" == "ubuntu" ]; then - apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake cmake-data avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev libatlas3-base + apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake cmake-data avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev libatlas3-base unzip else apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake=3.13.4-1 cmake-data=3.13.4-1 avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev libatlas3-base fi From 9bec6e6ad9dc61fe188c0e3d842d3d30ad656584 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 26 Jul 2021 12:59:04 +0300 Subject: [PATCH 25/50] Fix build for Ubuntu 20.04 64bit, use libjpeg8-dev --- src/modules/octopi/start_chroot_script | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 647eac6f..65eb08e7 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -61,10 +61,14 @@ pushd /home/"${BASE_USER}" then install_dir=/opt/mjpg-streamer echo "--- Installing mjpg-streamer to $install_dir" - if [ $( is_in_apt libjpeg62-turbo-dev ) -eq 1 ]; then - apt-get -y --force-yes install libjpeg62-turbo-dev - elif [ $( is_in_apt libjpeg8-dev ) -eq 1 ]; then - apt-get -y --force-yes install libjpeg8-dev + if [ "${BASE_DISTRO}" == "ubuntu" ]; then + apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages install libjpeg8-dev + else + if [ $( is_in_apt libjpeg62-turbo-dev ) -eq 1 ]; then + apt-get -y --force-yes install libjpeg62-turbo-dev + elif [ $( is_in_apt libjpeg8-dev ) -eq 1 ]; then + apt-get -y --force-yes install libjpeg8-dev + fi fi apt-get -y --force-yes --no-install-recommends install imagemagick ffmpeg libv4l-dev From 55344968198c4ebcf22599835069837feb82c659 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Tue, 27 Jul 2021 00:25:59 +0300 Subject: [PATCH 26/50] Fixes #746 --- src/modules/octopi/start_chroot_script | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 65eb08e7..4d37aa25 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -25,6 +25,11 @@ WEBCAM_USER=webcam unpack /filesystem/home/pi /home/"${BASE_USER}" "${BASE_USER}" unpack /filesystem/home/root /root root unpack /filesystem/boot /boot + +if [ "${BASE_DISTRO}" == "ubuntu" ]; then + ln -s /boot/firmware/octopi.txt /boot/octopi.txt +fi + apt-get update # in case we are building from a regular raspbian image instead of the lite one... From 64c7f714f207e84d5011b365464d25c91ccac30e Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 9 Aug 2021 14:11:38 +0300 Subject: [PATCH 27/50] Revert fix for https://github.com/guysoft/OctoPi/issues/746#issuecomment-894783149 --- src/modules/octopi/start_chroot_script | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 4d37aa25..7c07a273 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -26,10 +26,6 @@ unpack /filesystem/home/pi /home/"${BASE_USER}" "${BASE_USER}" unpack /filesystem/home/root /root root unpack /filesystem/boot /boot -if [ "${BASE_DISTRO}" == "ubuntu" ]; then - ln -s /boot/firmware/octopi.txt /boot/octopi.txt -fi - apt-get update # in case we are building from a regular raspbian image instead of the lite one... From 1249100b5cf4b205426d509182efbd602c577145 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Thu, 9 Sep 2021 02:49:15 +0300 Subject: [PATCH 28/50] Add fix for #508 https://github.com/guysoft/OctoPi/issues/508#issuecomment-914501732 --- .../root/etc/network/if-up.d/powersave_off | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 src/modules/octopi/filesystem/root/etc/network/if-up.d/powersave_off diff --git a/src/modules/octopi/filesystem/root/etc/network/if-up.d/powersave_off b/src/modules/octopi/filesystem/root/etc/network/if-up.d/powersave_off new file mode 100755 index 00000000..9801cf33 --- /dev/null +++ b/src/modules/octopi/filesystem/root/etc/network/if-up.d/powersave_off @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +# Don't bother for loopback +if [ "$IFACE" = lo ]; then + exit 0 +fi + +# Only run from ifup. +if [ "$MODE" != start ]; then + exit 0 +fi + +# Only run once +if [ "$ADDRFAM" != meta ]; then + exit 0 +fi + +/usr/sbin/iw dev wlan0 set power_save off + +exit 0 + From 588373dbb3a2c2ca554041e37152c5282f4cce57 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Thu, 23 Sep 2021 12:50:03 +0300 Subject: [PATCH 29/50] Remove request for HTTPS mirror, we got one donated :) --- README.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.rst b/README.rst index 790ae3bf..d3d46c6e 100644 --- a/README.rst +++ b/README.rst @@ -25,8 +25,6 @@ Nightly builds are available `here `_ -We recently had to move to building location, donations for somewhere with HTTPS would be great. - How to use it? -------------- From b1f84495640c76cd23a633ed4e7a359b1c3faf2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Stra=C3=9Fburger?= Date: Sun, 7 Nov 2021 22:15:01 +0100 Subject: [PATCH 30/50] :zap: when using hls camera streamer, generate frame snapshot only once a second --- .../filesystem/root/etc/systemd/system/ffmpeg_hls.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service b/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service index 15a8da25..2b15d8d8 100644 --- a/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service @@ -25,7 +25,7 @@ ExecStart=/usr/bin/sudo -u webcam \ -pix_fmt yuv420p \ \ -c:v mjpeg -q:v 0 \ - -f image2 -update 1 -atomic_writing 1 \ + -f image2 -r 1 -update 1 -atomic_writing 1 \ /run/webcam/jpeg/frame.jpg \ \ -c:v h264_omx -profile:v high \ From 24be793acac49682a4f9ed81315f5840ae20abac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 9 Nov 2021 22:05:28 +0100 Subject: [PATCH 31/50] cmake-3.13.4 is no more --- src/modules/octopi/start_chroot_script | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 7c07a273..0e01800c 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -34,12 +34,7 @@ echo "removing:" $remove_extra apt-get remove -y --purge $remove_extra apt-get autoremove -y -if [ "${BASE_DISTRO}" == "ubuntu" ]; then - apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake cmake-data avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev libatlas3-base unzip -else - apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake=3.13.4-1 cmake-data=3.13.4-1 avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev libatlas3-base -fi - +apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake cmake-data avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev libatlas3-base unzip echo " - Reinstall iputils-ping" apt-get install --reinstall iputils-ping From 4a4c353d661a86a447665ce172a31857ec320905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 9 Nov 2021 22:06:29 +0100 Subject: [PATCH 32/50] wiringpi is no more --- src/modules/octopi/config | 3 --- src/modules/octopi/start_chroot_script | 6 ------ 2 files changed, 9 deletions(-) diff --git a/src/modules/octopi/config b/src/modules/octopi/config index 5064055e..b39f19a3 100755 --- a/src/modules/octopi/config +++ b/src/modules/octopi/config @@ -20,9 +20,6 @@ # HAProxy [ -n "$OCTOPI_INCLUDE_HAPROXY" ] || OCTOPI_INCLUDE_HAPROXY=yes -# WiringPi -[ -n "$OCTOPI_INCLUDE_WIRINGPI" ] || OCTOPI_INCLUDE_WIRINGPI=yes - # yq [ -n "$OCTOPI_YQ_DOWNLOAD" ] || OCTOPI_YQ_DOWNLOAD=$(wget -q -O - https://api.github.com/repos/mikefarah/yq/releases/latest | grep "browser_download_url" | grep "yq_linux_arm" | cut -d : -f 2,3 | tr -d \" | tr -d ,) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 0e01800c..11b981bc 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -149,12 +149,6 @@ EOT rm /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/certs/ssl-cert-snakeoil.pem fi - if [ "$OCTOPI_INCLUDE_WIRINGPI" == "yes" ] - then - echo "--- Installing WiringPi" - apt-get -y install wiringpi - fi - # fetch current yq build and install to /usr/local/bin wget -O yq $OCTOPI_YQ_DOWNLOAD && chmod +x yq && mv yq /usr/local/bin From df10e6d33c3ea0d122065a030fbea2dcb78be0aa Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 17 Jan 2022 18:02:47 +0200 Subject: [PATCH 33/50] Add repository_dispatch option --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09781709..97238fb2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,7 @@ name: Build Image -on: +on: + repository_dispatch: push: schedule: - cron: '0 0 * * *' @@ -62,4 +63,4 @@ jobs: if: github.event_name == 'schedule' with: name: ${{ steps.copy.outputs.image }} - path: ${{ steps.copy.outputs.image }}.img \ No newline at end of file + path: ${{ steps.copy.outputs.image }}.img From 7e151c0f47d4b9720f9a2973040cd8ebc1e33da5 Mon Sep 17 00:00:00 2001 From: PowerWiesel <11167590+PowerWiesel@users.noreply.github.com> Date: Wed, 26 Jan 2022 11:51:50 +0100 Subject: [PATCH 34/50] picam-bullseye-fix mjpg-streamer doesn't work anymore with the new picam stack on bullseye based images - using the old stack for now. --- src/modules/octopi/start_chroot_script | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 11b981bc..6247a7ba 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -270,6 +270,11 @@ systemctl_if_exists enable streamer_select.service if [ "$OCTOPI_INCLUDE_MJPGSTREAMER" == "yes" ] then systemctl_if_exists enable webcamd.service +### use legacy camera stack on bullseye for now + if grep "camera_auto_detect=1" /boot/config.txt + then + sed -i "s/camera_auto_detect=1/camera_auto_detect=0/g" /boot/config.txt + fi else rm /etc/logrotate.d/webcamd rm /etc/systemd/system/webcamd.service From 70d256b24985cbf3c9adf8f4141a572cd9f15a8c Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Fri, 4 Feb 2022 13:36:13 +0200 Subject: [PATCH 35/50] Add rpi-imager values --- src/config | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/config b/src/config index 60299236..506f300e 100755 --- a/src/config +++ b/src/config @@ -2,5 +2,10 @@ export DIST_NAME=OctoPi export DIST_VERSION=1.0.0 export MODULES="base(raspicam, network, disable-services(octopi), password-for-sudo)" +export RPI_IMAGER_NAME="${DIST_NAME} version ${DIST_VERSION}" +export RPI_IMAGER_DESCRIPTION="A Raspberry Pi distribution for 3D printers. Ships OctoPrint out-of-the-box." +export RPI_IMAGER_ICON="https://raw.githubusercontent.com/guysoft/OctoPi/devel/media/rpi-imager-OctoPi.png" + + export BASE_IMAGE_ENLARGEROOT=2000 export BASE_IMAGE_RESIZEROOT=200 From aeca7ca63c91644615a3e72e58e1bb74d12a0df3 Mon Sep 17 00:00:00 2001 From: Flip Date: Tue, 8 Feb 2022 21:48:18 +0100 Subject: [PATCH 36/50] Set systemd Type to simple instead of forking --- .../octopi/filesystem/root/etc/systemd/system/webcamd.service | 2 +- .../filesystem/root/etc/systemd/system/webcamd.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service b/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service index ea494e40..451d2377 100644 --- a/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service @@ -8,7 +8,7 @@ StandardOutput=append:/var/log/webcamd.log StandardError=append:/var/log/webcamd.log ExecStart=/root/bin/webcamd Restart=always -Type=forking +Type=simple RestartSec=1 [Install] diff --git a/src/variants/ubuntu_arm64/filesystem/root/etc/systemd/system/webcamd.service b/src/variants/ubuntu_arm64/filesystem/root/etc/systemd/system/webcamd.service index bd5feb53..5154d6e8 100644 --- a/src/variants/ubuntu_arm64/filesystem/root/etc/systemd/system/webcamd.service +++ b/src/variants/ubuntu_arm64/filesystem/root/etc/systemd/system/webcamd.service @@ -8,7 +8,7 @@ StandardOutput=append:/var/log/webcamd.log StandardError=append:/var/log/webcamd.log ExecStart=/root/bin/webcamd Restart=always -Type=forking +Type=simple RestartSec=1 [Install] From 1843700621516a2fcb9e6c45971ff5f3539b35b1 Mon Sep 17 00:00:00 2001 From: Sadetdin EYILI Date: Fri, 25 Feb 2022 23:55:12 +0100 Subject: [PATCH 37/50] Fix typo in octopi.txt --- src/modules/octopi/filesystem/boot/octopi.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/boot/octopi.txt b/src/modules/octopi/filesystem/boot/octopi.txt index c842c6b4..24cc430e 100644 --- a/src/modules/octopi/filesystem/boot/octopi.txt +++ b/src/modules/octopi/filesystem/boot/octopi.txt @@ -82,7 +82,7 @@ # If connection terminates by variable reasons system tries to restart the wifi connection to reestablish a connection. # The connection test is done every minute. # By default it is disabled (0 = off / 1 = on) -# dstination_host can be an ip address or a hostname (for hostname ensure dns resosultion is working correctly) +# destination_host can be an ip address or a hostname (for hostname ensure dns resosultion is working correctly) enable_network_monitor=0 destination_host=192.168.1.1 From 9bee5f088ea46d30d7a21859844598bc5ad24de3 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 27 Feb 2022 13:50:43 +0200 Subject: [PATCH 38/50] Add rpi imager 64bit to title on 64bit builds --- src/variants/ubuntu_arm64/config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/variants/ubuntu_arm64/config b/src/variants/ubuntu_arm64/config index 5fa90462..1f54aa96 100755 --- a/src/variants/ubuntu_arm64/config +++ b/src/variants/ubuntu_arm64/config @@ -6,3 +6,5 @@ export BASE_ZIP_IMG=`ls -t $BASE_IMAGE_PATH/*-{ubuntu}-*-arm64-*.xz | head -n 1` export BASE_IGNORE_VARIANT_NAME=yes export BASE_USER=pi export BASE_USER_PASSWORD=raspberry +export RPI_IMAGER_NAME="${DIST_NAME} version ${DIST_VERSION} 64bit" + From 017b75869185fc71030100e2fef0ffd9fbe28633 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 2 Mar 2022 19:01:02 +0100 Subject: [PATCH 39/50] Install vcgencmd and fix user permission on Ubuntu The 64bit images are currently lacking vcgencmd, meaning that the PiSupport plugin can't check for undervoltage and overheat situations and will complain about this in the latest version as well, see feedback in #770. This should fix it by installing the package containing vcgencmd and making sure the base user is added to the video group as well. I was not able to test this in a build since I could not find documentation on which base image exactly to use and how to precisely run the 64bit build, but based on user feedback it should hopefully work. Still, please test in a build before merging. --- src/modules/octopi/start_chroot_script | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 11b981bc..4a2438c6 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -158,6 +158,12 @@ popd usermod -a -G tty "${BASE_USER}" usermod -a -G dialout "${BASE_USER}" +# If building against Ubuntu, make sure vcgencmd is available and pi has the rights to use it +if [ "${BASE_DISTRO}" == "ubuntu" ]; then + apt-get -y --force-yes install libraspberrypi-bin + usermod -a -G video "${BASE_USER}" +fi + # store octopi commit used to build this image echo "$OCTOPI_COMMIT" > /etc/octopi_commit From 6fd716b415f53036cc36f9d40c816c7470534c18 Mon Sep 17 00:00:00 2001 From: Willem Date: Mon, 28 Mar 2022 18:37:35 +0000 Subject: [PATCH 40/50] Fix HAProxy warning on wrong timeout abrreviation --- .../octopi/filesystem/root/etc/haproxy/haproxy.2.x.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.2.x.cfg b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.2.x.cfg index 8ef4d164..b9c30185 100644 --- a/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.2.x.cfg +++ b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.2.x.cfg @@ -17,8 +17,8 @@ defaults option forwardfor maxconn 2000 timeout connect 5s - timeout client 15min - timeout server 15min + timeout client 15m + timeout server 15m frontend public bind :::80 v4v6 From c8045f46959aefe27e43a2ac6a46ad32b8fefec2 Mon Sep 17 00:00:00 2001 From: Timofei Korostelev Date: Sun, 10 Jul 2022 23:07:16 -0700 Subject: [PATCH 41/50] Building FFmpeg from source for HLS. Using V4L2 M2M encoder. --- .../etc/systemd/system/ffmpeg_hls.service | 6 +-- src/modules/octopi/start_chroot_script | 41 +++++++++++++++---- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service b/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service index 2b15d8d8..3a1f463b 100644 --- a/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service @@ -18,7 +18,7 @@ ExecStartPre=/bin/chown -R webcam:webcam /run/webcam ExecStartPre=/bin/chmod -R 0755 /run/webcam ExecStart=/usr/bin/sudo -u webcam \ - /usr/bin/ffmpeg \ + /opt/ffmpeg-hls/ffmpeg \ \ -framerate 30 -video_size 640x480 \ -i /dev/video0 \ @@ -28,7 +28,7 @@ ExecStart=/usr/bin/sudo -u webcam \ -f image2 -r 1 -update 1 -atomic_writing 1 \ /run/webcam/jpeg/frame.jpg \ \ - -c:v h264_omx -profile:v high \ + -c:v h264_v4l2m2m -level:v 4.0 \ -b:v 1264k -flags +cgop \ -g 30 -keyint_min 30 \ \ @@ -40,7 +40,7 @@ ExecStart=/usr/bin/sudo -u webcam \ \ -vf scale=-1:240 \ \ - -c:v h264_omx -profile:v high \ + -c:v h264_v4l2m2m -level:v 4.0 \ -b:v 240k -flags +cgop \ -g 30 -keyint_min 30 \ \ diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 7c3b03f6..91e08e98 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -11,7 +11,7 @@ export LC_ALL=C source /common.sh -if [ -n "$OCTOPI_APTMIRROR" ]; +if [ -n "$OCTOPI_APTMIRROR" ]; then echo "Switching apt mirror in /etc/apt/sources.list to $OCTOPI_APTMIRROR" cp /etc/apt/sources.list /etc/apt/sources.list.backup @@ -19,6 +19,8 @@ then fi WEBCAM_USER=webcam +FFMPEG_HLS_COMMIT=c6fdbe26ef30fff817581e5ed6e078d96111248a +FFMPEG_HLS_DIR=/opt/ffmpeg-hls ### Script #### @@ -66,7 +68,7 @@ pushd /home/"${BASE_USER}" apt-get -y --force-yes install libjpeg8-dev fi fi - + apt-get -y --force-yes --no-install-recommends install imagemagick ffmpeg libv4l-dev wget $OCTOPI_MJPGSTREAMER_ARCHIVE -O mjpg-streamer.zip @@ -120,11 +122,32 @@ EOT # FFMPEG HLS if [ "$OCTOPI_INCLUDE_FFMPEG_HLS" == "yes" ] then - apt-get install -y --force-yes --no-install-recommends ffmpeg nginx + apt-get install -y --force-yes --no-install-recommends nginx + + FFMPEG_BUILD_DIR=$(mktemp -d) + pushd ${FFMPEG_BUILD_DIR} + FFMPEG_ARCHIVE=ffmpeg.tar.gz + wget https://api.github.com/repos/FFmpeg/FFmpeg/tarball/${FFMPEG_COMMIT} -O ${FFMPEG_ARCHIVE} + tar xvzf ${FFMPEG_ARCHIVE} + cd FFmpeg* + ./configure \ + --disable-doc \ + --disable-htmlpages \ + --disable-manpages \ + --disable-podpages \ + --disable-txtpages \ + --disable-ffplay \ + --disable-ffprobe + make -j$(nproc) + mkdir -p ${FFMPEG_HLS_DIR} + cp ffmpeg ${FFMPEG_HLS_DIR} + popd + rm -r ${FFMPEG_BUILD_DIR} + useradd ${WEBCAM_USER} usermod -aG video ${WEBCAM_USER} fi - + #CuraEngine if [ "$OCTOPI_INCLUDE_CURAENGINE" == "yes" ] then @@ -151,7 +174,7 @@ EOT # fetch current yq build and install to /usr/local/bin wget -O yq $OCTOPI_YQ_DOWNLOAD && chmod +x yq && mv yq /usr/local/bin - + popd #Make sure user pi / ${BASE_USER} has access to serial ports @@ -197,13 +220,13 @@ do done for ip in $(hostname -I); -do +do echo " http://$ip" done echo echo "https is also available, with a self-signed certificate." -echo +echo echo "------------------------------------------------------------" echo EOT @@ -276,7 +299,7 @@ systemctl_if_exists enable streamer_select.service if [ "$OCTOPI_INCLUDE_MJPGSTREAMER" == "yes" ] then systemctl_if_exists enable webcamd.service -### use legacy camera stack on bullseye for now +### use legacy camera stack on bullseye for now if grep "camera_auto_detect=1" /boot/config.txt then sed -i "s/camera_auto_detect=1/camera_auto_detect=0/g" /boot/config.txt @@ -304,7 +327,7 @@ apt-get -y install avrdude apt-get clean apt-get autoremove -y -if [ -n "$OCTOPI_APTMIRROR" ]; +if [ -n "$OCTOPI_APTMIRROR" ]; then echo "Reverting /etc/apt/sources.list" mv /etc/apt/sources.list.backup /etc/apt/sources.list From 7d57995e41fa2f1bb5e637cb7431578c69650397 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Fri, 15 Jul 2022 13:48:51 +0300 Subject: [PATCH 42/50] Add raspios_arm64 variant #785 --- src/variants/rpios_arm64/config | 7 +++ .../filesystem/root/etc/haproxy/haproxy.cfg | 49 +++++++++++++++++++ .../root/etc/systemd/system/webcamd.service | 15 ++++++ src/variants/rpios_arm64/post_chroot_script | 17 +++++++ 4 files changed, 88 insertions(+) create mode 100755 src/variants/rpios_arm64/config create mode 100644 src/variants/rpios_arm64/filesystem/root/etc/haproxy/haproxy.cfg create mode 100644 src/variants/rpios_arm64/filesystem/root/etc/systemd/system/webcamd.service create mode 100644 src/variants/rpios_arm64/post_chroot_script diff --git a/src/variants/rpios_arm64/config b/src/variants/rpios_arm64/config new file mode 100755 index 00000000..bbc234f2 --- /dev/null +++ b/src/variants/rpios_arm64/config @@ -0,0 +1,7 @@ +export BASE_ARCH=aarch64 +export BASE_DISTRO=raspios64 +export BASE_IMAGE_PATH=${DIST_PATH}/image-rpios_arm64 +# export BASE_ZIP_IMG=`ls -t $BASE_IMAGE_PATH/*-{ubuntu}-*-arm64-*.xz | head -n 1` +export BASE_IGNORE_VARIANT_NAME=yes +export BASE_USER=pi +export BASE_USER_PASSWORD=raspberry diff --git a/src/variants/rpios_arm64/filesystem/root/etc/haproxy/haproxy.cfg b/src/variants/rpios_arm64/filesystem/root/etc/haproxy/haproxy.cfg new file mode 100644 index 00000000..8ef4d164 --- /dev/null +++ b/src/variants/rpios_arm64/filesystem/root/etc/haproxy/haproxy.cfg @@ -0,0 +1,49 @@ +global + maxconn 4096 + user haproxy + group haproxy + log /dev/log local1 debug + tune.ssl.default-dh-param 2048 + +defaults + log global + mode http + compression algo gzip + option httplog + option dontlognull + retries 3 + option redispatch + option http-server-close + option forwardfor + maxconn 2000 + timeout connect 5s + timeout client 15min + timeout server 15min + +frontend public + bind :::80 v4v6 + bind :::443 v4v6 ssl crt /etc/ssl/snakeoil.pem + option forwardfor except 127.0.0.1 + use_backend webcam if { path_beg /webcam/ } + use_backend webcam_hls if { path_beg /hls/ } + use_backend webcam_hls if { path_beg /jpeg/ } + default_backend octoprint + +backend octoprint + acl needs_scheme req.hdr_cnt(X-Scheme) eq 0 + + http-request replace-path ^([^\ :]*)\ /(.*) \1\ /\2 + http-request add-header X-Scheme https if needs_scheme { ssl_fc } + http-request add-header X-Scheme http if needs_scheme !{ ssl_fc } + option forwardfor + server octoprint1 127.0.0.1:5000 + errorfile 503 /etc/haproxy/errors/503-no-octoprint.http + +backend webcam + http-request replace-path /webcam/(.*) /\1 + server webcam1 127.0.0.1:8080 + errorfile 503 /etc/haproxy/errors/503-no-webcam.http + +backend webcam_hls + server webcam_hls_1 127.0.0.1:28126 + errorfile 503 /etc/haproxy/errors/503-no-webcam-hls.http diff --git a/src/variants/rpios_arm64/filesystem/root/etc/systemd/system/webcamd.service b/src/variants/rpios_arm64/filesystem/root/etc/systemd/system/webcamd.service new file mode 100644 index 00000000..bd5feb53 --- /dev/null +++ b/src/variants/rpios_arm64/filesystem/root/etc/systemd/system/webcamd.service @@ -0,0 +1,15 @@ +[Unit] +Description=the OctoPi webcam daemon with the user specified config +# ConditionPathExists=/etc/octopi_streamer/mjpeg + +[Service] +WorkingDirectory=/root/bin +StandardOutput=append:/var/log/webcamd.log +StandardError=append:/var/log/webcamd.log +ExecStart=/root/bin/webcamd +Restart=always +Type=forking +RestartSec=1 + +[Install] +WantedBy=multi-user.target diff --git a/src/variants/rpios_arm64/post_chroot_script b/src/variants/rpios_arm64/post_chroot_script new file mode 100644 index 00000000..918c8bc9 --- /dev/null +++ b/src/variants/rpios_arm64/post_chroot_script @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -x +set -e + +export LC_ALL=C + +source /common.sh +install_cleanup_trap + +# Unpack the filesystem changes for the variant +unpack /filesystem/root / + +# add-apt-repository ppa:ubuntu-raspi2/ppa -y +apt-get update +apt-get -y --force-yes install libraspberrypi-bin rpi.gpio-common +apt-get clean +apt-get autoremove -y From 86f398c133e78e8023047a94ea343379ea4b1549 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 17 Jul 2022 01:28:28 +0300 Subject: [PATCH 43/50] Update README, add README for rpios_arm64 variant image location #785 --- src/image-rpios_arm64/README | 5 +++++ src/image/README | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 src/image-rpios_arm64/README diff --git a/src/image-rpios_arm64/README b/src/image-rpios_arm64/README new file mode 100644 index 00000000..63a2c46b --- /dev/null +++ b/src/image-rpios_arm64/README @@ -0,0 +1,5 @@ +Place zipped Raspberry Pi OS image here for the arm64 variant. Or any other variant you want to build/ + +If not otherwise specified, the build script will always use the most +recent zip file matching the file name pattern "*-raspbian.zip" or "*-rpios.zip" or "*-rpios.xz" located +here. diff --git a/src/image/README b/src/image/README index a536aca2..4203497c 100644 --- a/src/image/README +++ b/src/image/README @@ -1,5 +1,5 @@ Place zipped Raspberry Pi OS image here. Or any other variant you want to build/ If not otherwise specified, the build script will always use the most -recent zip file matching the file name pattern "*-raspbian.zip" or "*-rpios.zip" located +recent zip file matching the file name pattern "*-raspbian.zip" or "*-rpios.zip" or "*-rpios.xz" located here. From ec90e9a892710ee59652970c68b9aea14029e77e Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 17 Jul 2022 10:31:39 +0300 Subject: [PATCH 44/50] Fix building for armv7 on a arm64 kernel adn 32bit userspace #784 Fixes #787 --- src/modules/octopi/start_chroot_script | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 91e08e98..87bb5151 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -124,6 +124,11 @@ EOT then apt-get install -y --force-yes --no-install-recommends nginx + ARCH=arm + if [ "${BASE_ARCH}" == "aarch64"]; then + ARCH=aarch64 + fi + FFMPEG_BUILD_DIR=$(mktemp -d) pushd ${FFMPEG_BUILD_DIR} FFMPEG_ARCHIVE=ffmpeg.tar.gz @@ -131,6 +136,7 @@ EOT tar xvzf ${FFMPEG_ARCHIVE} cd FFmpeg* ./configure \ + --arch="${ARCH}" \ --disable-doc \ --disable-htmlpages \ --disable-manpages \ From 1d6d81f75f4384708e49ca67c0a3097d5bc28583 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 27 Jul 2022 00:02:23 +0300 Subject: [PATCH 45/50] Export ffmpeg HLS so we can place it as a pre-built binary later on #784 --- src/modules/octopi/start_chroot_script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 87bb5151..db72e43d 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -146,7 +146,7 @@ EOT --disable-ffprobe make -j$(nproc) mkdir -p ${FFMPEG_HLS_DIR} - cp ffmpeg ${FFMPEG_HLS_DIR} + copy_and_export ffmpeg-hls-"${ARCH}" ffmpeg "${FFMPEG_HLS_DIR}" popd rm -r ${FFMPEG_BUILD_DIR} From 1e5e8eaa61e0360954a0a3d709592ce20f9e6762 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 3 Aug 2022 15:26:57 +0300 Subject: [PATCH 46/50] Fix typo --- src/modules/octopi/start_chroot_script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index db72e43d..56f43b60 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -125,7 +125,7 @@ EOT apt-get install -y --force-yes --no-install-recommends nginx ARCH=arm - if [ "${BASE_ARCH}" == "aarch64"]; then + if [ "${BASE_ARCH}" == "aarch64" ]; then ARCH=aarch64 fi From 9105292c71d52121f3b76148c09b31ca2ceee668 Mon Sep 17 00:00:00 2001 From: Charlie Powell <31997505+cp2004@users.noreply.github.com> Date: Sun, 14 Aug 2022 17:32:20 +0100 Subject: [PATCH 47/50] Ensure webcamd service type is simple, not forking See #788 --- .../filesystem/root/etc/systemd/system/webcamd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/variants/rpios_arm64/filesystem/root/etc/systemd/system/webcamd.service b/src/variants/rpios_arm64/filesystem/root/etc/systemd/system/webcamd.service index bd5feb53..5154d6e8 100644 --- a/src/variants/rpios_arm64/filesystem/root/etc/systemd/system/webcamd.service +++ b/src/variants/rpios_arm64/filesystem/root/etc/systemd/system/webcamd.service @@ -8,7 +8,7 @@ StandardOutput=append:/var/log/webcamd.log StandardError=append:/var/log/webcamd.log ExecStart=/root/bin/webcamd Restart=always -Type=forking +Type=simple RestartSec=1 [Install] From fc82f1202f5c818f855a4cdb22a7bb2ec3a1f95e Mon Sep 17 00:00:00 2001 From: Charlie Powell <31997505+cp2004@users.noreply.github.com> Date: Sun, 14 Aug 2022 17:43:49 +0100 Subject: [PATCH 48/50] Fix vcgencmd get_camera output matching with libcamera --- src/modules/octopi/filesystem/home/root/bin/webcamd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index f2c6dfb1..89d5d96a 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -227,7 +227,9 @@ while true; do video_devices=($(find /dev -regextype sed -regex '\/dev/video[0-9]\+' | sort 2> /dev/null)) # add list of raspi camera into an array - if [ "`vcgencmd get_camera`" = "supported=1 detected=1" ]; then + vcgencmd_regex="supported=1 detected=1.*" + # Example output matching: supported=1 detected=1, libcamera interfaces=0 + if [[ "`vcgencmd get_camera`" =~ $vcgencmd_regex ]]; then video_devices+=( "raspi" ) fi From e5fc9bfb10a5de518459a16f3b7bfb23778c3b5e Mon Sep 17 00:00:00 2001 From: Charlie Powell <31997505+cp2004@users.noreply.github.com> Date: Sun, 14 Aug 2022 18:29:41 +0100 Subject: [PATCH 49/50] Add userfix script to allow changing usernames --- .../octopi/filesystem/home/root/bin/user-fix | 53 +++++++++++++++++++ .../root/etc/systemd/system/user-fix.service | 18 +++++++ src/modules/octopi/start_chroot_script | 9 ++++ 3 files changed, 80 insertions(+) create mode 100755 src/modules/octopi/filesystem/home/root/bin/user-fix create mode 100644 src/modules/octopi/filesystem/root/etc/systemd/system/user-fix.service diff --git a/src/modules/octopi/filesystem/home/root/bin/user-fix b/src/modules/octopi/filesystem/home/root/bin/user-fix new file mode 100755 index 00000000..09735c9e --- /dev/null +++ b/src/modules/octopi/filesystem/home/root/bin/user-fix @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +# Written by Gina Häußge originally at https://github.com/OctoPrint/OctoPi-UpToDate/blob/e70ccdaf0cd4ef4adfaa3f9b6b288fb6bfda116a/scripts/files/user-fix + +set -e + +USERID=1000 +FIRSTUSER=`getent passwd $USERID | cut -d: -f1` +FIRSTUSERHOME=`getent passwd $USERID | cut -d: -f6` + +CURRENT=`grep User= /etc/systemd/system/octoprint.service | cut -d= -f2` + +if [ "$CURRENT" = "pi" -a "$FIRSTUSER" != "pi" ]; then + # if we get here it means that the first user was renamed but we haven't yet + # updated all of OctoPi's files that depend on that name, so let's do that now + + # first we need to figure out if we can use the new user name in systemd files + # directly or if we need to use the UID - we do that by checking if the + # escaped name differes from the plain name, if so something is non ASCII + # and the UID is the safer bet + FIRSTUSERESC=`systemd-escape "$FIRSTUSER"` + if [ "$FIRSTUSER" != "$FIRSTUSERESC" ]; then + SERVICEUSER=$USERID + else + SERVICEUSER=$FIRSTUSER + fi + + # fix OctoPrint service file + echo "Fixing service file" + sed -i "s!User=pi!User=$SERVICEUSER!g" /etc/systemd/system/octoprint.service + sed -i "s!ExecStart=/home/pi/!ExecStart=$FIRSTUSERHOME/!g" /etc/systemd/system/octoprint.service + systemctl daemon-reload + + # fix sudoers files + echo "Fixing sudoers" + sed -i "s!^pi!$FIRSTUSER!g" /etc/sudoers.d/octoprint-service + sed -i "s!^pi!$FIRSTUSER!g" /etc/sudoers.d/octoprint-shutdown + + # fix scripts + echo "Fixing scripts" + sed -i "s!/home/pi/!$FIRSTUSERHOME/!g" $FIRSTUSERHOME/scripts/add-octoprint-checkout + sed -i "s!/home/pi/!$FIRSTUSERHOME/!g" $FIRSTUSERHOME/scripts/welcome + sed -i "s!/home/pi/!$FIRSTUSERHOME/!g" $FIRSTUSERHOME/.bashrc + sed -i "s!/home/pi/!$FIRSTUSERHOME/!g" /root/bin/webcamd + + # fix virtualenv + echo "Fixing paths in virtual environment" + cd $FIRSTUSERHOME/oprint + sudo -u $FIRSTUSER $FIRSTUSERHOME/.local/bin/virtualenv-tools --update-path $FIRSTUSERHOME/oprint + + # finally, reboot for all of this to actually take affect + echo "Adjusted scripts to new user, restarting services..." + systemctl reboot +fi \ No newline at end of file diff --git a/src/modules/octopi/filesystem/root/etc/systemd/system/user-fix.service b/src/modules/octopi/filesystem/root/etc/systemd/system/user-fix.service new file mode 100644 index 00000000..b95981ca --- /dev/null +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/user-fix.service @@ -0,0 +1,18 @@ +# Written by Gina Häußge originally at https://github.com/OctoPrint/OctoPi-UpToDate/blob/e70ccdaf0cd4ef4adfaa3f9b6b288fb6bfda116a/scripts/files/user-fix.service +[Unit] +Description=Ensure that user name changes are applied as needed + +DefaultDependencies=no + +Before=network-pre.target +Wants=network-pre.target + +After=local-fs.target +Wants=local-fs.target + +[Service] +Type=oneshot +ExecStart=/root/bin/user-fix + +[Install] +WantedBy=multi-user.target diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 56f43b60..d78f49e6 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -329,6 +329,15 @@ systemctl_if_exists enable networkcheck.timer echo "--- Installing avrdude" apt-get -y install avrdude +### User-fixing +# Users can change their username easily via the Raspberry Pi imager, which breaks some of OctoPi's scripts +# we need to install virtualenv-tools3, so let's get pip and that +apt install -y python3-pip +sudo -u pi pip3 install --user virtualenv-tools3 + +systemctl_if_exists enable user-fix.service + + #cleanup apt-get clean apt-get autoremove -y From 5ec881b5988911880b2896af5d765098c760c16a Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Thu, 27 Oct 2022 16:54:12 +0300 Subject: [PATCH 50/50] Add 64-bit in to name of generated rpi-imaer snipplet --- src/variants/rpios_arm64/config | 1 + 1 file changed, 1 insertion(+) diff --git a/src/variants/rpios_arm64/config b/src/variants/rpios_arm64/config index bbc234f2..36278105 100755 --- a/src/variants/rpios_arm64/config +++ b/src/variants/rpios_arm64/config @@ -5,3 +5,4 @@ export BASE_IMAGE_PATH=${DIST_PATH}/image-rpios_arm64 export BASE_IGNORE_VARIANT_NAME=yes export BASE_USER=pi export BASE_USER_PASSWORD=raspberry +export RPI_IMAGER_NAME="${DIST_NAME} version ${DIST_VERSION} 64-bit"