From b1627322aadd424dd50818f340b37cb2b6bae85c Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 30 Apr 2018 15:57:28 +0300 Subject: [PATCH 001/130] Increment version to 0.16.0 --- src/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config b/src/config index 05352183..a53a1d8b 100755 --- a/src/config +++ b/src/config @@ -1,4 +1,4 @@ export DIST_NAME=OctoPi -export DIST_VERSION=0.15.0 +export DIST_VERSION=0.16.0 export MODULES="base(raspicam, network, disable-services(octopi), password-for-sudo)" From 1c3c6f3d5b20036f4104288e0c308a0be769afe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 2 May 2018 10:56:12 +0200 Subject: [PATCH 002/130] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index f6ffd49e..3bb25813 100644 --- a/README.rst +++ b/README.rst @@ -25,7 +25,7 @@ How to use it? -------------- #. Unzip the image and install it to an sd card `like any other Raspberry Pi image `_ -#. Configure your WiFi by editing ``octopi-network.txt`` on the root of the flashed card when using it like a thumb drive +#. Configure your WiFi by editing ``octopi-wpa-supplicant.txt`` on the root of the flashed card when using it like a thumb drive #. Boot the Pi from the card #. Log into your Pi via SSH (it is located at ``octopi.local`` `if your computer supports bonjour `_ or the IP address assigned by your router), default username is "pi", default password is "raspberry", change the password using the ``passwd`` command and expand the filesystem of the SD card through the corresponding option when running ``sudo raspi-config``. From 94d1de7b24517a904b2faee062702d39cc9f3d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 2 May 2018 14:50:26 +0200 Subject: [PATCH 003/130] Expansion of file system happens automatically No need to run it manually. Has been this case for a while now actually. Thanks for the heads-up @John-Mc --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 3bb25813..a6986fc3 100644 --- a/README.rst +++ b/README.rst @@ -27,7 +27,7 @@ How to use it? #. Unzip the image and install it to an sd card `like any other Raspberry Pi image `_ #. Configure your WiFi by editing ``octopi-wpa-supplicant.txt`` on the root of the flashed card when using it like a thumb drive #. Boot the Pi from the card -#. Log into your Pi via SSH (it is located at ``octopi.local`` `if your computer supports bonjour `_ or the IP address assigned by your router), default username is "pi", default password is "raspberry", change the password using the ``passwd`` command and expand the filesystem of the SD card through the corresponding option when running ``sudo raspi-config``. +#. Log into your Pi via SSH (it is located at ``octopi.local`` `if your computer supports bonjour `_ or the IP address assigned by your router), default username is "pi", default password is "raspberry" and change the password using the ``passwd`` command. OctoPrint is located at `http://octopi.local `_ and also at `https://octopi.local `_. Since the SSL certificate is self signed (and generated upon first boot), you will get a certificate warning at the latter location, please ignore it. From c174c7caa757c5d051b081a4233b008dd0c13a19 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Thu, 3 May 2018 14:20:16 +0300 Subject: [PATCH 004/130] Add Issue report template #524 --- .github/ISSUE_TEMPLATE.md | 80 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..6c08377a --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,80 @@ + + +#### What were you doing? + + + +1. ... +2. ... +3. ... + + + +#### What did you expect to happen? + +#### What happened instead? + +#### Did the same happen when running OctoPrint in safe mode? + + + +#### Version of OctoPi + + + + +#### Printer model & used firmware incl. version + + + + +#### Screenshot(s)/video(s) showing the problem: + + + +I have read the FAQ. From fb7093bfb950dc890323a4607068e8ceb5fa36cd Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sat, 26 May 2018 14:19:10 +0300 Subject: [PATCH 005/130] Fix issue #526 - pin pip to 9.0.3 until OctoPrint 1.3.9 is released --- src/modules/octopi/start_chroot_script | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index b5d250c5..3f5abf74 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -36,7 +36,8 @@ pushd /home/pi sudo -u pi virtualenv oprint # first lets upgrade pip (the shipped version is way too old...) - sudo -u pi /home/pi/oprint/bin/pip install --upgrade pip + # issue #526 - pin pip to 9.0.3 until OctoPrint 1.3.9 is released + sudo -u pi /home/pi/oprint/bin/pip install pip==9.0.3 # OctoPrint & pyserial if [ "$OCTOPI_INCLUDE_OCTOPRINT" == "yes" ] From a35f29f7b1f2240c9f2593c49b27742fe6a3ee2b Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Mon, 4 Jun 2018 11:28:49 +0200 Subject: [PATCH 006/130] Don't try FPS with Philips (or NXP) PCVC740K ToUcam Pro [pwc] Fills up the syslog with May 29 06:25:03 octopi kernel: [78101.764331] pwc: Iso frame 7 has error -71 (till the disk is full) --- src/modules/octopi/filesystem/home/root/bin/webcamd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 0a32abaf..78d7defb 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -27,7 +27,7 @@ if [ -e "/boot/octopi.txt" ]; then source "/boot/octopi.txt" fi -brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "${additional_brokenfps_usb_devices[@]}") +brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "${additional_brokenfps_usb_devices[@]}") # check if array contains a string function containsString() { From 8fbfbc87fe7595588d35d5e855487d99d50bb85f Mon Sep 17 00:00:00 2001 From: Arthur Lutz Date: Mon, 4 Jun 2018 11:33:54 +0200 Subject: [PATCH 007/130] remote extra whitespace --- src/modules/octopi/filesystem/home/root/bin/webcamd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 78d7defb..36cc3b02 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -27,7 +27,7 @@ if [ -e "/boot/octopi.txt" ]; then source "/boot/octopi.txt" fi -brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "${additional_brokenfps_usb_devices[@]}") +brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "${additional_brokenfps_usb_devices[@]}") # check if array contains a string function containsString() { From 382c509e399017ea8513cd55cb44dd6420acf8bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 8 Jun 2018 10:49:25 +0200 Subject: [PATCH 008/130] Update links to mjpg streamer config doc Fixes #536 --- src/modules/octopi/filesystem/boot/octopi.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/modules/octopi/filesystem/boot/octopi.txt b/src/modules/octopi/filesystem/boot/octopi.txt index b09fa8be..12557d9a 100644 --- a/src/modules/octopi/filesystem/boot/octopi.txt +++ b/src/modules/octopi/filesystem/boot/octopi.txt @@ -17,8 +17,7 @@ ### Additional options to supply to MJPG Streamer for the USB camera # -# See https://github.com/foosel/OctoPrint/wiki/MJPG-Streamer-configuration -# for available options +# See https://faq.octoprint.org/mjpg-streamer-config for available options # # Defaults to a resolution of 640x480 px and a framerate of 10 fps # @@ -54,8 +53,7 @@ ### Additional options to supply to MJPG Streamer for the RasPi Cam # -# See https://github.com/foosel/OctoPrint/wiki/MJPG-Streamer-configuration -# for available options +# See https://faq.octoprint.org/mjpg-streamer-config for available options # # Defaults to 10fps # From 92a9bd373e6e6376bc527b6f4b622b1885bfefad Mon Sep 17 00:00:00 2001 From: Christopher Dieringer Date: Wed, 13 Jun 2018 20:26:44 -0700 Subject: [PATCH 009/130] docs(readme): clarify plugin installation --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index a6986fc3..b195d10f 100644 --- a/README.rst +++ b/README.rst @@ -28,6 +28,7 @@ How to use it? #. Configure your WiFi by editing ``octopi-wpa-supplicant.txt`` on the root of the flashed card when using it like a thumb drive #. Boot the Pi from the card #. Log into your Pi via SSH (it is located at ``octopi.local`` `if your computer supports bonjour `_ or the IP address assigned by your router), default username is "pi", default password is "raspberry" and change the password using the ``passwd`` command. +#. To install plugins, :code:`pip` may be found at :code:`/home/pi/oprint/bin/pip`. Thus, an example install cmd may be: :code:`/home/pi/oprint/bin/pip install ` OctoPrint is located at `http://octopi.local `_ and also at `https://octopi.local `_. Since the SSL certificate is self signed (and generated upon first boot), you will get a certificate warning at the latter location, please ignore it. From 8e5a154a3feeb70998f154f16cd5af570d341dc6 Mon Sep 17 00:00:00 2001 From: dadosch Date: Fri, 15 Jun 2018 22:43:00 +0200 Subject: [PATCH 010/130] Put IPv6 addressess in brackets Brackets to be RFC2732 compliant >To use a literal IPv6 address in a URL, the literal address should be enclosed in "[" and "]" characters. It worked, (but the KDE console doesn't recognize it correctly as a link, without this fix firefox would complain and try it as a search) --- src/modules/octopi/filesystem/home/pi/scripts/welcome | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/pi/scripts/welcome b/src/modules/octopi/filesystem/home/pi/scripts/welcome index ec030680..c1928a74 100755 --- a/src/modules/octopi/filesystem/home/pi/scripts/welcome +++ b/src/modules/octopi/filesystem/home/pi/scripts/welcome @@ -16,7 +16,12 @@ do done for ip in $_IP; do - echo " http://$ip" + if [[ $ip =~ .*:.* ]] + then + echo " http://[$ip]" + else + echo " http://$ip" + fi done echo From c53220a9b7d4108c74cf073683927a0ab2729645 Mon Sep 17 00:00:00 2001 From: dadosch Date: Mon, 18 Jun 2018 15:01:49 +0200 Subject: [PATCH 011/130] corrected whitespaces --- src/modules/octopi/filesystem/home/pi/scripts/welcome | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/octopi/filesystem/home/pi/scripts/welcome b/src/modules/octopi/filesystem/home/pi/scripts/welcome index c1928a74..46af4349 100755 --- a/src/modules/octopi/filesystem/home/pi/scripts/welcome +++ b/src/modules/octopi/filesystem/home/pi/scripts/welcome @@ -16,12 +16,12 @@ do done for ip in $_IP; do - if [[ $ip =~ .*:.* ]] - then - echo " http://[$ip]" - else + if [[ $ip =~ .*:.* ]] + then + echo " http://[$ip]" + else echo " http://$ip" - fi + fi done echo From e5214e89d50832f1669dc499bf278fc574f3bee8 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 5 Aug 2018 15:15:26 +0300 Subject: [PATCH 012/130] Fix path to mirror --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index b195d10f..2ca3206d 100644 --- a/README.rst +++ b/README.rst @@ -17,7 +17,7 @@ Download the latest stable build via this button: .. image:: https://i.imgur.com/NvUOGfS.png :target: https://octopi.octoprint.org/latest -Official mirror is `here `_ +Official mirror is `here `_ Nightly builds are available `here `_ From 0777e9785e086ac894529c2fa375a39558f1350e Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 5 Aug 2018 15:17:04 +0300 Subject: [PATCH 013/130] Fix typo --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 2ca3206d..94c0147e 100644 --- a/README.rst +++ b/README.rst @@ -40,7 +40,7 @@ Features -------- * `OctoPrint `_ host software for 3d printers out of the box -* `Raspbian `_ tweaked for maximum preformance for printing out of the box +* `Raspbian `_ tweaked for maximum performance for printing out of the box * `mjpg-streamer with RaspiCam support `_ for live viewing of prints and timelapse video creation. * `CuraEngine `_ pre-installed for slicing directly on the Raspberry Pi From aacde48b44861e71acf418a54b96cba1043a033f Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 26 Nov 2018 13:48:34 +0200 Subject: [PATCH 014/130] Add docker entry --- README.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.rst b/README.rst index 94c0147e..1a515f7e 100644 --- a/README.rst +++ b/README.rst @@ -86,6 +86,10 @@ To build a variant use:: sudo bash -x ./build_dist [Variant] +Building Using Docker +~~~~~~~~~~~~~~~~~~~~~~ +`See Building with docker entry in wiki `_ + Building Using Vagrant ~~~~~~~~~~~~~~~~~~~~~~ There is a vagrant machine configuration to let build OctoPi in case your build environment behaves differently. Unless you do extra configuration, vagrant must run as root to have nfs folder sync working. From bade7af57db16e73fb267adb6de2818273009f16 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 10 Dec 2018 11:33:30 +0200 Subject: [PATCH 015/130] Fix moved in to mainline CustomPiOS https://github.com/guysoft/CustomPiOS/commit/e4786461023920b0d7597b046fc971c7bd5ef045 --- src/modules/octopi/start_chroot_script | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 3f5abf74..e411b892 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -187,11 +187,6 @@ update-rc.d change_password defaults update-rc.d change_hostname defaults -### Try and fix https://github.com/guysoft/OctoPi/issues/424 - -sed -i "s@ExecStart=/usr/bin/ssh-keygen -A -v@ExecStart=/bin/bash -c ' /usr/bin/ssh-keygen -A -v >> /var/log/regenerate_ssh_host_keys.log 2>\&1'@g" /lib/systemd/system/regenerate_ssh_host_keys.service -sed -i "s@ExecStartPost=/bin/systemctl disable regenerate_ssh_host_keys@ExecStartPost=/bin/bash -c 'for i in /etc/ssh/ssh_host_*_key*; do actualsize=\$(wc -c <\"\$i\") ;if [ \$actualsize -eq 0 ]; then echo size is 0 bytes ; exit 1 ; fi ; done ; /bin/systemctl disable regenerate_ssh_host_keys'@g" /lib/systemd/system/regenerate_ssh_host_keys.service - ### OctoPrint if [ "$OCTOPI_INCLUDE_OCTOPRINT" == "yes" ] From 6854edff4e2867c858ac5d656ced34d570b8e3da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 25 Jan 2019 12:07:10 +0100 Subject: [PATCH 016/130] Instructions how to optionally change timezone Also relocated the "how to install plugins from the command line" step into the informational section since it's not a mandatory setup step considering that OctoPrint has a built-in plugin manager that works out of the box without needing to use the command line. Closes #569 --- README.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 1a515f7e..60d627d9 100644 --- a/README.rst +++ b/README.rst @@ -27,11 +27,18 @@ How to use it? #. Unzip the image and install it to an sd card `like any other Raspberry Pi image `_ #. Configure your WiFi by editing ``octopi-wpa-supplicant.txt`` on the root of the flashed card when using it like a thumb drive #. Boot the Pi from the card -#. Log into your Pi via SSH (it is located at ``octopi.local`` `if your computer supports bonjour `_ or the IP address assigned by your router), default username is "pi", default password is "raspberry" and change the password using the ``passwd`` command. -#. To install plugins, :code:`pip` may be found at :code:`/home/pi/oprint/bin/pip`. Thus, an example install cmd may be: :code:`/home/pi/oprint/bin/pip install ` +#. Log into your Pi via SSH (it is located at ``octopi.local`` `if your computer supports bonjour `_ or the IP address assigned by your router), default username is "pi", default password is "raspberry". Run ``sudo raspi-config``. Once that is open: + + a. Change the password using via "Change User Password" + b. Optionally: Change the configured timezone via "Localization Options" > "Timezone". + c. Optionally: Change the hostname via "Network Options" > "Hostname". Your OctoPi instance will then no longer be reachable under ``octopi.local`` but rather the hostname you chose postfixed with ``.local``, so keep that in mind. + + You can navigate in the menus using the arrow keys and Enter. To switch to selecting the buttons at the bottom use Tab. OctoPrint is located at `http://octopi.local `_ and also at `https://octopi.local `_. Since the SSL certificate is self signed (and generated upon first boot), you will get a certificate warning at the latter location, please ignore it. +To install plugins from the commandline instead of OctoPrint's built-in plugin manager, :code:`pip` may be found at :code:`/home/pi/oprint/bin/pip`. Thus, an example install cmd may be: :code:`/home/pi/oprint/bin/pip install ` + If a USB webcam or the Raspberry Pi camera is detected, MJPG-streamer will be started automatically as webcam server. OctoPrint on OctoPi ships with correctly configured stream and snapshot URLs pointing at it. If necessary, you can reach it under `http://octopi.local/webcam/?action=stream `_ and SSL respectively, or directly on its configured port 8080: `http://octopi.local:8080/?action=stream `_. CuraEngine is installed and OctoPrint ships pre-configured with the correct path to utilize it for on-board-slicing. Just import a Cura Slicing Profile in OctoPrint's settings and start slicing directly on your Pi. From 0d0b2fc627a78e6fdc866f4a09d66a26fa0f22fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 25 Jan 2019 12:08:26 +0100 Subject: [PATCH 017/130] Fix a typo --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 60d627d9..57ffc485 100644 --- a/README.rst +++ b/README.rst @@ -29,7 +29,7 @@ How to use it? #. Boot the Pi from the card #. Log into your Pi via SSH (it is located at ``octopi.local`` `if your computer supports bonjour `_ or the IP address assigned by your router), default username is "pi", default password is "raspberry". Run ``sudo raspi-config``. Once that is open: - a. Change the password using via "Change User Password" + a. Change the password via "Change User Password" b. Optionally: Change the configured timezone via "Localization Options" > "Timezone". c. Optionally: Change the hostname via "Network Options" > "Hostname". Your OctoPi instance will then no longer be reachable under ``octopi.local`` but rather the hostname you chose postfixed with ``.local``, so keep that in mind. From 6e6827ff040b310742fe35b09c187292b397f9b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 25 Jan 2019 12:38:48 +0100 Subject: [PATCH 018/130] Note that the filesystem is expanded automatically Further synchronized with the instructions on octoprint.org. Hopefully helps against people still constantly recommending that you need to expand the file system manually. --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index 57ffc485..1ac227b3 100644 --- a/README.rst +++ b/README.rst @@ -34,6 +34,8 @@ How to use it? c. Optionally: Change the hostname via "Network Options" > "Hostname". Your OctoPi instance will then no longer be reachable under ``octopi.local`` but rather the hostname you chose postfixed with ``.local``, so keep that in mind. You can navigate in the menus using the arrow keys and Enter. To switch to selecting the buttons at the bottom use Tab. + + You do not need to expand the filesystem, current versions of OctoPi do this automatically. OctoPrint is located at `http://octopi.local `_ and also at `https://octopi.local `_. Since the SSL certificate is self signed (and generated upon first boot), you will get a certificate warning at the latter location, please ignore it. From 70f71c1e60581593f333fa94ad417910e87726be Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 27 Jan 2019 14:50:59 +0200 Subject: [PATCH 019/130] Revert #527 because OctoPrint 1.3.9 is released Related to #526 --- src/modules/octopi/start_chroot_script | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index e411b892..cb816115 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -35,9 +35,7 @@ pushd /home/pi #build virtualenv sudo -u pi virtualenv oprint - # first lets upgrade pip (the shipped version is way too old...) - # issue #526 - pin pip to 9.0.3 until OctoPrint 1.3.9 is released - sudo -u pi /home/pi/oprint/bin/pip install pip==9.0.3 + sudo -u pi /home/pi/oprint/bin/pip install --upgrade pip # OctoPrint & pyserial if [ "$OCTOPI_INCLUDE_OCTOPRINT" == "yes" ] From 65c07c203ab2d98ba99745e8c61e0f918fd22728 Mon Sep 17 00:00:00 2001 From: Milkey Mouse Date: Sun, 27 Jan 2019 11:27:57 -0800 Subject: [PATCH 020/130] Directly exec git instead of running child process --- src/modules/octopi/filesystem/home/root/bin/git | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/git b/src/modules/octopi/filesystem/home/root/bin/git index d10f25c0..39a0e07b 100644 --- a/src/modules/octopi/filesystem/home/root/bin/git +++ b/src/modules/octopi/filesystem/home/root/bin/git @@ -13,4 +13,4 @@ then exit 1 fi -/usr/bin/git "$@" +exec /usr/bin/git "$@" From 83a7bc3961d1a337b3a2f2d9e7d8ab364fc3b4af Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 11 Feb 2019 16:25:11 +0200 Subject: [PATCH 021/130] Increment version to 0.17.0 --- src/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config b/src/config index a53a1d8b..f4af2f4b 100755 --- a/src/config +++ b/src/config @@ -1,4 +1,4 @@ export DIST_NAME=OctoPi -export DIST_VERSION=0.16.0 +export DIST_VERSION=0.17.0 export MODULES="base(raspicam, network, disable-services(octopi), password-for-sudo)" From e3503031d8b8c13ceabe7f66faad74be0f0ce087 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Tue, 23 Apr 2019 11:48:24 +0300 Subject: [PATCH 022/130] Fixes #583 --- .../filesystem/home/pi/scripts/add-octoprint-checkout | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/octopi/filesystem/home/pi/scripts/add-octoprint-checkout b/src/modules/octopi/filesystem/home/pi/scripts/add-octoprint-checkout index 615a2d92..8a87651b 100755 --- a/src/modules/octopi/filesystem/home/pi/scripts/add-octoprint-checkout +++ b/src/modules/octopi/filesystem/home/pi/scripts/add-octoprint-checkout @@ -3,6 +3,12 @@ OCTOPRINT_FOLDER=/home/pi/OctoPrint OCTOPRINT_CONFIG=/home/pi/.octoprint/config.yaml +if [ "${PWD}" == "${OCTOPRINT_FOLDER}" ]; then + echo "Error: you are in the folder: "${OCTOPRINT_FOLDER} + echo "This is where OctoPrint is going to be checked out, please change to a different folder before running this script" + exit 1 +fi + pause() { read -n1 -r -p $'Press any key to continue or Ctrl+C to exit...\n' key } From 2f51406418a569b0952bd6c31c7d3020d95249a3 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 19 May 2019 11:43:40 +0300 Subject: [PATCH 023/130] Fix syntax for url --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 1ac227b3..cf1a6a9d 100644 --- a/README.rst +++ b/README.rst @@ -89,7 +89,7 @@ You can build it by issuing the following commands:: Building OctoPi Variants ~~~~~~~~~~~~~~~~~~~~~~~~ -OctoPi supports building variants, which are builds with changes from the main release build. An example and other variants are available in [CustomPiOS, folder ``src/variants/example``](https://github.com/guysoft/CustomPiOS/tree/CustomPiOS/src/variants/example). +OctoPi supports building variants, which are builds with changes from the main release build. An example and other variants are available in `CustomPiOS, folder ``src/variants/example`` `_. To build a variant use:: From 9393d3e93e4bb17131139abc46a60629dcba3d43 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 19 May 2019 11:46:17 +0300 Subject: [PATCH 024/130] Remove monospace in url --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index cf1a6a9d..d855d4dc 100644 --- a/README.rst +++ b/README.rst @@ -89,7 +89,7 @@ You can build it by issuing the following commands:: Building OctoPi Variants ~~~~~~~~~~~~~~~~~~~~~~~~ -OctoPi supports building variants, which are builds with changes from the main release build. An example and other variants are available in `CustomPiOS, folder ``src/variants/example`` `_. +OctoPi supports building variants, which are builds with changes from the main release build. An example and other variants are available in `CustomPiOS, folder src/variants/example `_. To build a variant use:: From f44bfe13a5460b53aa766683bb105e5c48b56556 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 24 Jun 2019 15:05:11 +0300 Subject: [PATCH 025/130] Switch libav-tools to ffmpeg in Debian Buster --- 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 cb816115..92232b7b 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -59,7 +59,7 @@ pushd /home/pi apt-get -y --force-yes install libjpeg8-dev fi - apt-get -y --force-yes --no-install-recommends install imagemagick libav-tools libv4l-dev + 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/* . From 7ae5fcb998fc8b6016b53e7bfc1a82ecf27b21d6 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 24 Jun 2019 16:44:19 +0300 Subject: [PATCH 026/130] Add buster in nightly script --- src/nightly_build_scripts/generate_nightly_page.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nightly_build_scripts/generate_nightly_page.js b/src/nightly_build_scripts/generate_nightly_page.js index 3e0f5196..2d25ceb7 100644 --- a/src/nightly_build_scripts/generate_nightly_page.js +++ b/src/nightly_build_scripts/generate_nightly_page.js @@ -167,14 +167,14 @@ var outputPage = function(files, s) { output.write("

Raspberry Pi

\n"); output.write("

Stable Builds

\n") - outputTable(filterNameByRegex(files, /^stable\/.*octopi-(wheezy|jessie|stretch)-.*/), + outputTable(filterNameByRegex(files, /^stable\/.*octopi-(wheezy|jessie|stretch|buster)-.*/), output, function(name) { return stripLeading(name, "stable/") }, 3); output.write("

Nightly Builds

\n"); output.write("Warning: These builds are untested and can be unstable and/or broken. If in doubt use a stable build."); - outputTable(filterNameByRegex(files.filter(function (obj) { return !obj.name.startsWith("stable/") && !obj.name.startsWith("bananapi-m1/") }), /octopi-(wheezy|jessie|stretch)-/), + outputTable(filterNameByRegex(files.filter(function (obj) { return !obj.name.startsWith("stable/") && !obj.name.startsWith("bananapi-m1/") }), /octopi-(wheezy|jessie|stretch|buster)-/), output, function(name) { return name }, 14); From 555b28b06fccf10b4423c9ee9a807aa2c7916475 Mon Sep 17 00:00:00 2001 From: usk-johnny-s Date: Tue, 2 Jul 2019 22:58:33 +0900 Subject: [PATCH 027/130] Accept to specify a camera device with "-d /dev/v4l/*" in "/boot/octpi.txt" (#597) #596 * Accept to specify a camera device with "-d /dev/v4l/*" in "/boot/octpi.txt" * Support plug and play of a USB camera. (delayed a read-link of a device link) * Add feature: Load multiple camera configuration files. * change video config file path to "/boot/octopi.conf.d/*.txt" and remove loading of conventional location video config file. * Create video config directory and move config-file. * Remove conventional config file * Fix typo of variable name * Fix typo of variable refernce * Fix issue of raspi-cam with camera="auto" in webcamd script. Change webcamd startup mechanism to systemd from init.d. --- .../boot/{ => octopi.conf.d}/octopi.txt | 0 .../octopi/filesystem/home/root/bin/webcamd | 229 ++++++++++++------ .../octopi/filesystem/root/etc/init.d/webcamd | 137 ----------- .../root/etc/systemd/system/webcamd.service | 11 + src/modules/octopi/start_chroot_script | 3 +- 5 files changed, 168 insertions(+), 212 deletions(-) rename src/modules/octopi/filesystem/boot/{ => octopi.conf.d}/octopi.txt (100%) delete mode 100755 src/modules/octopi/filesystem/root/etc/init.d/webcamd create mode 100644 src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service diff --git a/src/modules/octopi/filesystem/boot/octopi.txt b/src/modules/octopi/filesystem/boot/octopi.conf.d/octopi.txt similarity index 100% rename from src/modules/octopi/filesystem/boot/octopi.txt rename to src/modules/octopi/filesystem/boot/octopi.conf.d/octopi.txt diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 36cc3b02..084cc42a 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -15,19 +15,77 @@ MJPGSTREAMER_HOME=/home/pi/mjpg-streamer MJPGSTREAMER_INPUT_USB="input_uvc.so" MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so" -# init configuration - DO NOT EDIT, USE /boot/octopi.txt INSTEAD! -camera="auto" -camera_usb_options="-r 640x480 -f 10" -camera_raspi_options="-fps 10" -camera_http_webroot="./www-octopi" -camera_http_options="-n" -additional_brokenfps_usb_devices=() - -if [ -e "/boot/octopi.txt" ]; then - source "/boot/octopi.txt" +brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311") + +config_dir="/boot/octopi.conf.d" + +echo "Starting up webcamDaemon..." +echo "" + +cfg_files=() +if [[ -d ${config_dir} ]]; then + cfg_files+=( `ls ${config_dir}/*.txt` ) fi -brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "${additional_brokenfps_usb_devices[@]}") +array_camera_config=() +array_camera=() +array_camera_usb_options=() +array_camera_usb_device=() +array_camera_raspi_options=() +array_camera_http_webroot=() +array_camera_http_options=() +array_additional_brokenfps_usb_devices=() +array_camera_device=() +array_assigned_device=() + +echo "--- Configuration: ----------------------------" +for cfg_file in ${cfg_files[@]}; do + # init configuration - DO NOT EDIT, USE /boot/octopi.conf.d/*.txt INSTEAD! + camera="auto" + camera_usb_options="-r 640x480 -f 10" + camera_raspi_options="-fps 10" + camera_http_webroot="./www-octopi" + camera_http_options="-n" + additional_brokenfps_usb_devices=() + + if [[ -e ${cfg_file} ]]; then + source "$cfg_file" + fi + usb_options="$camera_usb_options" + + # if webcam device is explicitly given in /boot/octopi.txt, save the path of the device + # to a variable and remove its parameter from usb_options + extracted_device=`echo $usb_options | sed 's@.*-d \(/dev/\(video[0-9]\+\|v4l/[^ ]*\)\).*@\1@'` + if [ "$extracted_device" != "$usb_options" ] + then + # the camera options refer to a device, save it in a variable + # replace video device parameter with empty string and strip extra whitespace + usb_options=`echo $usb_options | sed 's/\-d \/dev\/\(video[0-9]\+\|v4l\/[^ ]*\)//g' | awk '$1=$1'` + else + extracted_device="" + fi + + # echo configuration + echo "cfg_file: $cfg_file" + echo "camera: $camera" + echo "usb options: $camera_usb_options" + echo "raspi options: $camera_raspi_options" + echo "http options: -w $camera_http_webroot $camera_http_options" + echo "" + echo "Explicitly USB device: $extracted_device" + echo "-----------------------------------------------" + echo "" + + array_camera_config+=( $cfg_file ) + array_camera+=( $camera ) + array_camera_usb_options+=("$usb_options") + array_camera_usb_device+=("$extracted_device") + array_camera_raspi_options+=("$camera_raspi_options") + array_camera_http_webroot+=("$camera_http_webroot") + array_camera_http_options+=("$camera_http_options") + array_camera_brokenfps_usb_devices+=("${brokenfps_usb_devices[*]} ${additional_brokenfps_usb_devices[*]}") + array_camera_device+=("") +done # check if array contains a string function containsString() { @@ -59,7 +117,9 @@ function runMjpgStreamer { pushd $MJPGSTREAMER_HOME > /dev/null 2>&1 echo Running ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input" LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input" & - wait + sleep 1 & + sleep_pid=$! + wait ${sleep_pid} popd > /dev/null 2>&1 } @@ -113,76 +173,99 @@ trap "cleanup" SIGINT SIGTERM # say goodbye when we EXIT trap "goodbye" EXIT -# echo configuration -echo "Starting up webcamDaemon..." -echo "" -echo "--- Configuration: ----------------------------" -echo "camera: $camera" -echo "usb options: $camera_usb_options" -echo "raspi options: $camera_raspi_options" -echo "http options: -w $camera_http_webroot $camera_http_options" -echo "-----------------------------------------------" -echo "" - # we need this to prevent the later calls to vcgencmd from blocking # I have no idea why, but that's how it is... vcgencmd version > /dev/null 2>&1 -usb_options="$camera_usb_options" - -# if webcam device is explicitly given in /boot/octopi.txt, save the path of the device -# to a variable and remove its parameter from usb_options -extracted_device=`echo $usb_options | sed 's@.*-d \(/dev/video[0-9]\+\).*@\1@'` -if [ "$extracted_device" != "$usb_options" ] -then - # the camera options refer to a device, save it in a variable - usb_device_path="$extracted_device" - # replace video device parameter with empty string and strip extra whitespace - usb_options=`echo $usb_options | sed 's/\-d \/dev\/video[0-9]\+//g' | awk '$1=$1'` - echo "Explicitly set USB device was found in options: $usb_device_path" -fi - # keep mjpg streamer running if some camera is attached while true; do - # get list of usb video devices into an array - video_devices=($(find /dev -regextype sed -regex '\/dev/video[0-9]\+' | sort 2> /dev/null)) - - if [ ${#video_devices[@]} != 0 ] && { [ "$camera" = "auto" ] || [ "$camera" = "usb" ] ; }; then - - echo "Found video devices:" - printf '%s\n' "${video_devices[@]}" - - if [[ $usb_device_path ]]; then - # usb device is explicitly set in options - if containsString "$usb_device_path" "${video_devices[@]}"; then - # explicitly set usb device was found in video_devices array, start usb with the found device - echo "USB device was set in options and found in devices, start MJPG-streamer with the configured USB video device: $usb_device_path" - startUsb "$usb_device_path" - else - # explicitly set usb device was not found - echo "Configured USB camera was not detected, trying again in two minutes" - sleep 120 & - wait - fi - else - # device is not set explicitly in options, start usb with first found usb camera as the device - echo "USB device was not set in options, start MJPG-streamer with the first found video device: ${video_devices[0]}" - startUsb "${video_devices[0]}" - fi - - sleep 30 & - wait + # get list of usb video devices into an array + video_devices=($(find /dev -regextype sed -regex '\/dev/video[0-9]\+' | sort 2> /dev/null)) - elif [ "`vcgencmd get_camera`" = "supported=1 detected=1" ] && { [ "$camera" = "auto" ] || [ "$camera" = "raspi" ] ; }; then - startRaspi - sleep 30 & - wait + # add list of raspi camera into an array + if [ "`vcgencmd get_camera`" = "supported=1 detected=1" ]; then + video_devices+=( "raspi" ) + fi - else - echo "No camera detected, trying again in two minutes" - sleep 120 & - wait + echo "Found video devices:" + printf '%s\n' "${video_devices[@]}" + for scan_mode in "usb" "usb-auto" "raspi" "auto"; do + camera=$scan_mode + if [[ "usb-auto" == "$scan_mode" ]]; then + camera="usb" fi + for ((i=0;i<${#array_camera[@]};i++)); do + if [[ -z ${array_camera_device[${i}]} ]] && [[ $camera == ${array_camera[${i}]} ]]; then + camera_config="${array_camera_config[${i}]}" + usb_options="${array_camera_usb_options[${i}]}" + camera_usb_device="${array_camera_usb_device[${i}]}" + camera_raspi_options="${array_camera_raspi_options[${i}]}" + 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}` + if containsString "$usb_device_path" "${array_camera_device[@]}"; then + if [[ "auto" != ${scan_mode} ]]; then + array_camera_device[${i}]="alredy_in_use" + echo "config file='$camera_config':Video device already in use." + continue + fi + 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" + 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 + if containsString "$video_device" "${array_camera_device[@]}"; then + : #already in use + 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}" + startUsb "${video_device}" + break + fi + fi + done + if [[ -n ${array_camera_device[${i}]} ]]; then + continue + fi + fi + if [[ "raspi" == ${scan_mode} ]] || [[ "auto" == ${scan_mode} ]]; then + video_device="raspi" + if containsString "$video_device" "${array_camera_device[@]}"; then + if [[ "auto" != ${scan_mode} ]]; then + array_camera_device[${i}]="alredy_in_use" + echo "config file='$camera_config':RasPiCam device already in use." + 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}" + startRaspi + sleep 30 & + sleep_pid=$! + wait ${sleep_pid} + fi + fi + 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} + fi done diff --git a/src/modules/octopi/filesystem/root/etc/init.d/webcamd b/src/modules/octopi/filesystem/root/etc/init.d/webcamd deleted file mode 100755 index a7cf3959..00000000 --- a/src/modules/octopi/filesystem/root/etc/init.d/webcamd +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/sh - -### BEGIN INIT INFO -# Provides: webcamd -# Required-Start: $local_fs networking -# Required-Stop: -# Should-Start: -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: webcam daemon -# Description: Starts the OctoPi webcam daemon with the user specified config in -# /etc/default/webcamd. -### END INIT INFO - -# Author: Gina Haeussge - -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DESC="Webcam Daemon" -NAME="webcamd" -DAEMON=/root/bin/webcamd -USER=pi -PIDFILE=/var/run/$NAME.pid -PKGNAME=webcamd -SCRIPTNAME=/etc/init.d/$PKGNAME -LOG=/var/log/webcamd.log - -# Read configuration variable file if it is present -[ -r /etc/default/$PKGNAME ] && . /etc/default/$PKGNAME - -# Exit if the octoprint is not installed -[ -x "$DAEMON" ] || exit 0 - -# Load the VERBOSE setting and other rcS variables -[ -f /etc/default/rcS ] && . /etc/default/rcS - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. -. /lib/lsb/init-functions - -if [ -z "$ENABLED" -o "$ENABLED" != "1" ] -then - log_warning_msg "Not starting $PKGNAME, edit /etc/default/$PKGNAME to start it." - exit 0 -fi - -# -# Function to verify if a pid is alive -# -is_alive() -{ - pid=`cat $1` > /dev/null 2>&1 - kill -0 $pid > /dev/null 2>&1 - return $? -} - -# -# Function that starts the daemon/service -# -do_start() -{ - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - - is_alive $PIDFILE - RETVAL="$?" - - if [ $RETVAL != 0 ]; then - start-stop-daemon --start --background --no-close --quiet --pidfile $PIDFILE --make-pidfile \ - --startas /bin/bash --chuid $USER --user $USER -- -c "exec $DAEMON" >> $LOG 2>&1 - RETVAL="$?" - fi -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - # Return - # 0 if daemon has been stopped - # 1 if daemon was already stopped - # 2 if daemon could not be stopped - # other if a failure occurred - - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $USER --pidfile $PIDFILE - RETVAL="$?" - [ "$RETVAL" = "2" ] && return 2 - - rm -f $PIDFILE - - [ "$RETVAL" = "0" ] && return 0 || return 1 -} - -case "$1" in - start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - do_start - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - restart) - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) log_end_msg 0 ;; - 1) log_end_msg 1 ;; # Old process is still running - *) log_end_msg 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1 - ;; - esac - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2 - exit 3 - ;; -esac - diff --git a/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service b/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service new file mode 100644 index 00000000..0586c8ac --- /dev/null +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service @@ -0,0 +1,11 @@ +[Unit] +Description=the OctoPi webcam daemon with the user specified config + +[Service] +WorkingDirectory=/root/bin +ExecStart=/root/bin/webcamd +Restart=always +Type=forking + +[Install] +WantedBy=multi-user.target diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 92232b7b..d2e88477 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -222,8 +222,7 @@ fi if [ "$OCTOPI_INCLUDE_MJPGSTREAMER" == "yes" ] then - # make webcamd autostart - update-rc.d webcamd defaults + systemctl_if_exists enable webcamd.service else rm /etc/logrotate.d/webcamd rm /etc/init.d/webcamd From 4d44d3f5eeb6df7af695f8eeaf01816d3074ecca Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Tue, 2 Jul 2019 18:44:30 +0300 Subject: [PATCH 028/130] Move octopi.txt back to /boot/octopi.txt #597 #596 --- .../octopi/filesystem/boot/{octopi.conf.d => }/octopi.txt | 0 src/modules/octopi/filesystem/home/root/bin/webcamd | 1 + 2 files changed, 1 insertion(+) rename src/modules/octopi/filesystem/boot/{octopi.conf.d => }/octopi.txt (100%) diff --git a/src/modules/octopi/filesystem/boot/octopi.conf.d/octopi.txt b/src/modules/octopi/filesystem/boot/octopi.txt similarity index 100% rename from src/modules/octopi/filesystem/boot/octopi.conf.d/octopi.txt rename to src/modules/octopi/filesystem/boot/octopi.txt diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 084cc42a..5be0ed74 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -23,6 +23,7 @@ echo "Starting up webcamDaemon..." echo "" cfg_files=() +cfg_files+=/boot/octopi.txt if [[ -d ${config_dir} ]]; then cfg_files+=( `ls ${config_dir}/*.txt` ) fi From e25f12f71d9768225e40ce74ae21ec95224c9efd Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 19 Aug 2019 10:44:40 +0300 Subject: [PATCH 029/130] Move vagrant method to Buster --- src/vagrant/Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vagrant/Vagrantfile b/src/vagrant/Vagrantfile index a4567d95..a5b90944 100644 --- a/src/vagrant/Vagrantfile +++ b/src/vagrant/Vagrantfile @@ -1,7 +1,7 @@ vagrant_root = File.dirname(__FILE__) Vagrant.configure("2") do |o| # o.vm.box = "octopi-build" - o.vm.box= "debian/stretch64" + o.vm.box= "debian/buster64" o.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" o.vm.synced_folder File.read("../custompios_path").gsub("\n",""), "/CustomPiOS", create:true, type: "nfs" o.vm.synced_folder "../", "/distro", create:true, type: "nfs" From c4cb3660a2953b39d87a346705b9ae049c4eb8df Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 19 Aug 2019 10:48:56 +0300 Subject: [PATCH 030/130] Fix avconv is not available in buster #600 --- src/modules/octopi/filesystem/home/pi/.octoprint/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/pi/.octoprint/config.yaml b/src/modules/octopi/filesystem/home/pi/.octoprint/config.yaml index 88361e3e..b6002e8a 100644 --- a/src/modules/octopi/filesystem/home/pi/.octoprint/config.yaml +++ b/src/modules/octopi/filesystem/home/pi/.octoprint/config.yaml @@ -1,7 +1,7 @@ webcam: stream: /webcam/?action=stream snapshot: http://127.0.0.1:8080/?action=snapshot - ffmpeg: /usr/bin/avconv + ffmpeg: /usr/bin/ffmpeg plugins: cura: cura_engine: /usr/local/bin/cura_engine From 6d08ff02284040a9136dceccb3fe630923ce2802 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Tue, 20 Aug 2019 16:48:24 +0300 Subject: [PATCH 031/130] Fixes #602 Chinese Endoscope 8mm --- src/modules/octopi/filesystem/home/root/bin/webcamd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 5be0ed74..668fa51c 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -15,7 +15,7 @@ MJPGSTREAMER_HOME=/home/pi/mjpg-streamer MJPGSTREAMER_INPUT_USB="input_uvc.so" MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so" -brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311") +brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "038f:6001") config_dir="/boot/octopi.conf.d" From 8133cb97144ae1c61f1654490e63a648f9b385ce Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 23 Oct 2019 11:56:28 +0300 Subject: [PATCH 032/130] Remove realpath, comes built in to buster now #609 --- README.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.rst b/README.rst index d855d4dc..5e268e98 100644 --- a/README.rst +++ b/README.rst @@ -65,7 +65,6 @@ Requirements #. root privileges for chroot #. Bash #. git -#. realpath #. sudo (the script itself calls it, running as root without sudo won't work) Build OctoPi From within OctoPi / Raspbian / Debian / Ubuntu @@ -75,7 +74,7 @@ OctoPi can be built from Debian, Ubuntu, Raspbian, or even OctoPi. Build requires about 2.5 GB of free space available. You can build it by issuing the following commands:: - sudo apt-get install gawk util-linux realpath qemu-user-static git p7zip-full python3 + sudo apt-get install gawk util-linux qemu-user-static git p7zip-full python3 git clone https://github.com/guysoft/CustomPiOS.git git clone https://github.com/guysoft/OctoPi.git From 8358499da64aae5fcc0a25a8f53bf3b8fda9339b Mon Sep 17 00:00:00 2001 From: OutsourcedGuru Date: Tue, 5 Nov 2019 09:28:46 -0800 Subject: [PATCH 033/130] Added safemode script to toggle on Safe Mode once --- src/modules/octopi/filesystem/home/pi/scripts/safemode | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 src/modules/octopi/filesystem/home/pi/scripts/safemode diff --git a/src/modules/octopi/filesystem/home/pi/scripts/safemode b/src/modules/octopi/filesystem/home/pi/scripts/safemode new file mode 100755 index 00000000..1965f0c2 --- /dev/null +++ b/src/modules/octopi/filesystem/home/pi/scripts/safemode @@ -0,0 +1,10 @@ +#!/bin/sh + +if grep -q "startOnceInSafeMode" ~/.octoprint/config.yaml; +then + # If found,replace the existing line + sed -i 's/.*startOnceInSafeMode: false.*/\ \ startOnceInSafeMode: true/' ~/.octoprint/config.yaml +else + # Append otherwise + sed -i '/server:/a \ \ startOnceInSafeMode: true' ~/.octoprint/config.yaml +fi From a1bb66c7658804fa632310160a6521b8de78f130 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 13 Nov 2019 16:57:54 +0200 Subject: [PATCH 034/130] Increment version to 0.18.0 --- src/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config b/src/config index f4af2f4b..bd3acbef 100755 --- a/src/config +++ b/src/config @@ -1,4 +1,4 @@ export DIST_NAME=OctoPi -export DIST_VERSION=0.17.0 +export DIST_VERSION=0.18.0 export MODULES="base(raspicam, network, disable-services(octopi), password-for-sudo)" From 33217ff0b1a40e3ed656abb6b8276202e0a1f118 Mon Sep 17 00:00:00 2001 From: David Zingg Date: Tue, 17 Dec 2019 22:16:38 +0100 Subject: [PATCH 035/130] Fix #619 Shutdown requires network --- src/modules/octopi/filesystem/root/etc/init.d/octoprint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/root/etc/init.d/octoprint b/src/modules/octopi/filesystem/root/etc/init.d/octoprint index 3cbecce8..19db9762 100755 --- a/src/modules/octopi/filesystem/root/etc/init.d/octoprint +++ b/src/modules/octopi/filesystem/root/etc/init.d/octoprint @@ -3,7 +3,7 @@ ### BEGIN INIT INFO # Provides: octoprint # Required-Start: $local_fs networking -# Required-Stop: +# Required-Stop: networking # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 From 4556aa31febe7320963c87a8c12c3ac93329154d Mon Sep 17 00:00:00 2001 From: SzopeN111 Date: Tue, 31 Dec 2019 01:29:09 +0100 Subject: [PATCH 036/130] Add workaround for a bug in Raspberry Pi 4 VL805 0x000137ab firmware (streaming issues) The 0x000137ab frimware of VL805 on Raspberry Pi 4 is known to cause problems with USB cameras - stream not working or working only in very low resolution (like QVGA 320x240). Choosing slightly higher resolution 640x480 causes streaming to fail: you can see a lot of "uvcvideo: USB isochronous frame lost (-18)." lines in the dmesg logs and "i: select() timeout" in the mjpg_streamer's output. You may need to enable uvcvideo's tracing to see those errors: echo 0xffff > /sys/module/uvcvideo/parameters/trace For details see: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=244421 --- .../octopi/filesystem/home/root/bin/webcamd | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 668fa51c..71a549fb 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -115,6 +115,37 @@ function goodbye() { # runs MJPG Streamer, using the provided input plugin + configuration function runMjpgStreamer { input=$1 + + # There are problems with 0x000137ab firmware on VL805 (Raspberry Pi 4}). + # Try to autodetect offending firmware and temporarily fix the issue + # by changing power management mode + echo "Checking for VL805 (Raspberry Pi 4)..." + if [[ -f /usr/bin/vl805 ]]; then + VL805_VERSION=$(/usr/bin/vl805) + VL805_VERSION=${VL805_VERSION#*: } + echo " - version 0x${VL805_VERSION} detected" + case "$VL805_VERSION" in + 00013701) + echo " - nothing to be done. It shouldn't cause USB problems." + ;; + 000137ab) + echo -e " - \e[31mThis version is known to cause problems with USB cameras.\e[39m" + echo -e " You may want to downgrade to 0x0013701." + echo -e " - [FIXING] Trying the setpci -s 01:00.0 0xD4.B=0x41 hack to mitigate the" + echo -e " issue. It disables ASPM L1 on the VL805. Your board may (or may not) get" + echo -e " slightly hotter. For details see:" + echo -e " https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=244421" + setpci -s 01:00.0 0xD4.B=0x41 + ;; + *) + echo " - unknown firmware version. Doing nothing." + ;; + esac + else + echo " - It seems that you don't have VL805 (Raspberry Pi 4)." + echo " There should be no problems with USB (a.k.a. select() timeout)" + fi + pushd $MJPGSTREAMER_HOME > /dev/null 2>&1 echo Running ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input" LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input" & From 2d196fdf1621e9ba6c6d8593380650cc8a1e7d17 Mon Sep 17 00:00:00 2001 From: Craig Errington Date: Thu, 9 Jan 2020 18:22:27 +0000 Subject: [PATCH 037/130] fixes link in readme --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 5e268e98..a5eca4ee 100644 --- a/README.rst +++ b/README.rst @@ -41,7 +41,7 @@ OctoPrint is located at `http://octopi.local `_ and also at To install plugins from the commandline instead of OctoPrint's built-in plugin manager, :code:`pip` may be found at :code:`/home/pi/oprint/bin/pip`. Thus, an example install cmd may be: :code:`/home/pi/oprint/bin/pip install ` -If a USB webcam or the Raspberry Pi camera is detected, MJPG-streamer will be started automatically as webcam server. OctoPrint on OctoPi ships with correctly configured stream and snapshot URLs pointing at it. If necessary, you can reach it under `http://octopi.local/webcam/?action=stream `_ and SSL respectively, or directly on its configured port 8080: `http://octopi.local:8080/?action=stream `_. +If a USB webcam or the Raspberry Pi camera is detected, MJPG-streamer will be started automatically as webcam server. OctoPrint on OctoPi ships with correctly configured stream and snapshot URLs pointing at it. If necessary, you can reach it under `http://octopi.local/webcam/?action=stream `_ and SSL respectively, or directly on its configured port 8080: `http://octopi.local:8080/?action=stream `_. CuraEngine is installed and OctoPrint ships pre-configured with the correct path to utilize it for on-board-slicing. Just import a Cura Slicing Profile in OctoPrint's settings and start slicing directly on your Pi. From a3c7da1f163f22f28674fbc91aea4e1655338438 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Thu, 16 Jan 2020 11:27:41 +0200 Subject: [PATCH 038/130] Fixes #627 --- src/modules/octopi/start_chroot_script | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index d2e88477..cad19083 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -32,10 +32,14 @@ apt-get install --reinstall iputils-ping pushd /home/pi - #build virtualenv - sudo -u pi virtualenv oprint - + # build virtualenv + # uncomment when setup tools issue has been fixed + # sudo -u pi virtualenv oprint + # sudo -u pi /home/pi/oprint/bin/pip install --upgrade pip + + sudo -u pi virtualenv --no-setuptools oprint sudo -u pi /home/pi/oprint/bin/pip install --upgrade pip + sudo -u pi /home/pi/oprint/bin/pip install "setuptools<45" # OctoPrint & pyserial if [ "$OCTOPI_INCLUDE_OCTOPRINT" == "yes" ] From 0e1a5207896cd6e6c1d7916947672ccdd68cfa15 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Tue, 21 Apr 2020 14:44:49 +0300 Subject: [PATCH 039/130] Add in variant how docker as the first example --- README.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index a5eca4ee..fe082fac 100644 --- a/README.rst +++ b/README.rst @@ -90,7 +90,11 @@ Building OctoPi Variants OctoPi supports building variants, which are builds with changes from the main release build. An example and other variants are available in `CustomPiOS, folder src/variants/example `_. -To build a variant use:: +docker exec -it mydistro_builder:: + + sudo docker exec -it mydistro_builder build [Variant] + +Or to build a variant inside a container:: sudo bash -x ./build_dist [Variant] From 4295b15bfeabf321c629791c210ecbe2787469cd Mon Sep 17 00:00:00 2001 From: ted Date: Tue, 21 Apr 2020 13:10:07 -0700 Subject: [PATCH 040/130] fix/enable haproxy logging The config sends logs to rsyslog localhost, which isn't listening (even on localhost). Thankfully the chroot mapping is already set up, so simply sending it to /dev/log works fine. Tested locally. --- src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg index e20b80c8..275f6ace 100644 --- a/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg +++ b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg @@ -2,7 +2,7 @@ global maxconn 4096 user haproxy group haproxy - log 127.0.0.1 local1 debug + log /dev/log local1 debug defaults log global From 5a9b63e918cd1f564c1b8363c55f088af18fa4b0 Mon Sep 17 00:00:00 2001 From: ted Date: Thu, 23 Apr 2020 14:31:10 -0700 Subject: [PATCH 041/130] enable compression at haproxy layer This spins out of a discussion at [OctoPrint#3529](https://github.com/OctoPrint/OctoPrint/issues/3529), where @flaviut did the math on how enabling http compression is really helpful, even on a little Pi. It'd be nice if we could get it enabled in Tornado, but this is easier and won't be invalidated by work on Tornado if that gets done. haproxy attempts to compress every mime type, and it is a big win. You can go over to the other issue to see the comparisons. It doesn't seem to support setting a compression level, and [it is cautious](https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#compression), so it should be fine. Tested locally. --- src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg index e20b80c8..1a01b04c 100644 --- a/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg +++ b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg @@ -7,6 +7,7 @@ global defaults log global mode http + compression algo gzip option httplog option dontlognull retries 3 From de12aec9da436b0fa2f6ed13f13b438745f29576 Mon Sep 17 00:00:00 2001 From: Chudsaviet Date: Sun, 26 Apr 2020 18:32:08 -0700 Subject: [PATCH 042/130] Added -j$(nproc) parameter to make calls for automated multithreading. --- src/modules/octopi/start_chroot_script | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index cad19083..d1140504 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -67,7 +67,7 @@ pushd /home/pi gitclone OCTOPI_MJPGSTREAMER_REPO mjpg-streamer pushd mjpg-streamer mv mjpg-streamer-experimental/* . - sudo -u pi make + sudo -u pi make -j$(nproc) # create our custom web folder and add a minimal index.html to it sudo -u pi mkdir www-octopi @@ -98,7 +98,7 @@ EOT sudo -u pi wget -O$zipfile $OCTOPI_CURAENGINE_ARCHIVE sudo -u pi unzip $zipfile pushd $folder - sudo -u pi make CXX=g++-4.9 VERSION=$OCTOPI_CURAENGINE_VERSION + sudo -u pi make -j$(nproc) CXX=g++-4.9 VERSION=$OCTOPI_CURAENGINE_VERSION cp build/CuraEngine /usr/local/bin/cura_engine popd sudo -u pi rm -r $folder $zipfile From 8d7ce3675d28949b270f68283c86bea18237f2da Mon Sep 17 00:00:00 2001 From: Timofei Korostelev Date: Sat, 9 May 2020 10:46:22 -0700 Subject: [PATCH 043/130] Unwrappeg MJPG Streamer Makefile to apply -j option. --- src/modules/octopi/start_chroot_script | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index d1140504..ea6ca79d 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -67,7 +67,19 @@ pushd /home/pi gitclone OCTOPI_MJPGSTREAMER_REPO mjpg-streamer pushd mjpg-streamer mv mjpg-streamer-experimental/* . - sudo -u pi make -j$(nproc) + + # 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 pi:pi ${MJPG_STREAMER_BUILD_DIR}) + [ -f ${MJPG_STREAMER_BUILD_DIR}/Makefile ] || (cd ${MJPG_STREAMER_BUILD_DIR} && \ + sudo -u pi cmake -DCMAKE${MJPG_STREAMER_BUILD_DIR}_TYPE=Release ..) + + sudo -u pi make -j $(nproc) -C ${MJPG_STREAMER_BUILD_DIR} + + sudo -u pi cp ${MJPG_STREAMER_BUILD_DIR}/mjpg_streamer . + sudo -u pi find ${MJPG_STREAMER_BUILD_DIR} -name "*.so" -type f -exec cp {} . \; # create our custom web folder and add a minimal index.html to it sudo -u pi mkdir www-octopi From 35f334033524c763cc54293e103315b8900740fb Mon Sep 17 00:00:00 2001 From: Timofei Korostelev Date: Fri, 22 May 2020 20:35:05 -0700 Subject: [PATCH 044/130] Experimental HLS support. --- src/modules/octopi/config | 3 ++ src/modules/octopi/filesystem/boot/octopi.txt | 8 +++++ .../filesystem/home/root/bin/streamer_select | 32 ++++++++++++++++++ .../root/etc/nginx/sites-available/default | 11 +++++++ .../etc/systemd/system/ffmpeg_hls.service | 33 +++++++++++++++++++ .../systemd/system/streamer_select.service | 10 ++++++ .../root/etc/systemd/system/webcamd.service | 1 + .../root/lib/systemd/system/nginx.service | 20 +++++++++++ src/modules/octopi/start_chroot_script | 22 +++++++++++-- 9 files changed, 137 insertions(+), 3 deletions(-) create mode 100755 src/modules/octopi/filesystem/home/root/bin/streamer_select create mode 100644 src/modules/octopi/filesystem/root/etc/nginx/sites-available/default create mode 100644 src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service create mode 100644 src/modules/octopi/filesystem/root/etc/systemd/system/streamer_select.service create mode 100644 src/modules/octopi/filesystem/root/lib/systemd/system/nginx.service diff --git a/src/modules/octopi/config b/src/modules/octopi/config index fcca2e09..e0d0e7d5 100755 --- a/src/modules/octopi/config +++ b/src/modules/octopi/config @@ -21,6 +21,9 @@ [ -n "$OCTOPI_MJPGSTREAMER_REPO_DEPTH" ] || OCTOPI_MJPGSTREAMER_REPO_DEPTH=1 [ -n "$OCTOPI_INCLUDE_MJPGSTREAMER" ] || OCTOPI_INCLUDE_MJPGSTREAMER=yes +# FFMPEG HLS +[ -n "$OCTOPI_INCLUDE_FFMPEG_HLS" ] || OCTOPI_INCLUDE_FFMPEG_HLS=yes + # HAProxy [ -n "$OCTOPI_INCLUDE_HAPROXY" ] || OCTOPI_INCLUDE_HAPROXY=yes diff --git a/src/modules/octopi/filesystem/boot/octopi.txt b/src/modules/octopi/filesystem/boot/octopi.txt index 12557d9a..b81a1f3f 100644 --- a/src/modules/octopi/filesystem/boot/octopi.txt +++ b/src/modules/octopi/filesystem/boot/octopi.txt @@ -72,3 +72,11 @@ # #camera_http_webroot="./www-octopi" #camera_http_options="-n" + +### EXPERIMENTAL +# Support for different streamer types. +# +# Available options: +# mjpeg [default] - stable MJPG-streamer +# hls - experimental FFMPEG HLS streamer +#camera_streamer=mjpeg diff --git a/src/modules/octopi/filesystem/home/root/bin/streamer_select b/src/modules/octopi/filesystem/home/root/bin/streamer_select new file mode 100755 index 00000000..9d965140 --- /dev/null +++ b/src/modules/octopi/filesystem/home/root/bin/streamer_select @@ -0,0 +1,32 @@ +#!/bin/bash + +# Exit on any error. +set -e + +CONFIG_FILE=/boot/octopi.txt +MJPEG_TYPE=mjpeg +HLS_TYPE=hls +MJPEG_SERVICE=webcamd.service +HLS_SERVICE=ffmpeg_hls.service +DEFAULT_TYPE=${MJPEG_TYPE} +FLAG_DIRECTORY=/etc/octopi_streamer + +source ${CONFIG_FILE} + +if [ -z ${camera_streamer+x} ]; then + echo "No streamer type is set. Defaulting to '${DEFAULT_TYPE}'." + camera_streamer=${DEFAULT_TYPE} +fi + +rm -rf ${FLAG_DIRECTORY} +mkdir -p ${FLAG_DIRECTORY} + +echo "Setting streamer type '${camera_streamer}'." +if [ "${camera_streamer}" = "${MJPEG_TYPE}" ]; then + touch ${FLAG_DIRECTORY}/${MJPEG_TYPE} +elif [ "${camera_streamer}" = "${HLS_TYPE}" ]; then + touch ${FLAG_DIRECTORY}/${HLS_TYPE} +else + echo "Streamer type '${camera_streamer}' is not supported." + exit 1 +fi \ No newline at end of file diff --git a/src/modules/octopi/filesystem/root/etc/nginx/sites-available/default b/src/modules/octopi/filesystem/root/etc/nginx/sites-available/default new file mode 100644 index 00000000..251348f2 --- /dev/null +++ b/src/modules/octopi/filesystem/root/etc/nginx/sites-available/default @@ -0,0 +1,11 @@ +server { + listen 8051 default_server; + + root /tmp/webcam; + + location / { + # First attempt to serve request as file, then + # as directory, then fall back to displaying a 404. + try_files $uri $uri/ =404; + } +} \ No newline at end of file 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 new file mode 100644 index 00000000..520b35be --- /dev/null +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service @@ -0,0 +1,33 @@ +[Unit] +Description=FFMPEG HLS webcam streaming service +ConditionPathExists=/etc/octopi_streamer/hls + +[Service] +User=webcam +Restart=always +RestartSec=5 +Nice=10 +ExecStartPre=/bin/rm -rf /tmp/webcam +ExecStartPre=/bin/mkdir -p /tmp/webcam/hls +ExecStartPre=/bin/mkdir -p /tmp/webcam/jpeg + +ExecStart=/usr/bin/ffmpeg \ + \ + -framerate 30 -video_size 800x600 \ + -i /dev/video0 \ + \ + -c:v mjpeg -q:v 0 \ + -f image2 -update 1 \ + /tmp/webcam/jpeg/frame.jpg \ + \ + -c:v h264_omx -profile:v high \ + -b:v 2048k -flags +cgop \ + -g 30 -keyint_min 30 \ + \ + -f hls -hls_time 1 -hls_flags delete_segments \ + -hls_allow_cache 1 -hls_segment_type fmp4 \ + -hls_list_size 32 -hls_delete_threshold 64 \ + /tmp/webcam/hls/stream.m3u8 + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/src/modules/octopi/filesystem/root/etc/systemd/system/streamer_select.service b/src/modules/octopi/filesystem/root/etc/systemd/system/streamer_select.service new file mode 100644 index 00000000..402fd512 --- /dev/null +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/streamer_select.service @@ -0,0 +1,10 @@ +[Unit] +Description=OctoPi streamer selector +Before=webcamd.service ffmpeg_hls.service nginx.service + +[Service] +Type=oneshot +ExecStart=/root/bin/streamer_select + +[Install] +WantedBy=multi-user.target 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 0586c8ac..53363805 100644 --- a/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service @@ -1,5 +1,6 @@ [Unit] Description=the OctoPi webcam daemon with the user specified config +ConditionPathExists=/etc/octopi_streamer/mjpeg [Service] WorkingDirectory=/root/bin diff --git a/src/modules/octopi/filesystem/root/lib/systemd/system/nginx.service b/src/modules/octopi/filesystem/root/lib/systemd/system/nginx.service new file mode 100644 index 00000000..8ef64228 --- /dev/null +++ b/src/modules/octopi/filesystem/root/lib/systemd/system/nginx.service @@ -0,0 +1,20 @@ +# NGINX service definition based on Debian buster version. +[Unit] +Description=NGINX server for serving HLS and JPEG frames +Documentation=man:nginx(8) +After=network.target nss-lookup.target +ConditionPathExists=/etc/octopi_streamer/hls + +[Service] +Type=forking +PIDFile=/run/nginx.pid +ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;' +ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;' +ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload +ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid +TimeoutStopSec=5 +KillMode=mixed +Nice=10 + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index ea6ca79d..de87db3f 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -11,6 +11,8 @@ export LC_ALL=C source /common.sh +WEBCAM_USER=webcam + ### Script #### unpack /filesystem/home/pi /home/pi pi @@ -29,7 +31,6 @@ apt-get -y --force-yes install python2.7 python-virtualenv python-dev git screen echo " - Reinstall iputils-ping" apt-get install --reinstall iputils-ping - pushd /home/pi # build virtualenv @@ -99,6 +100,14 @@ EOT popd popd fi + + # FFMPEG HLS + if [ "$OCTOPI_INCLUDE_FFMPEG_HLS" == "yes" ] + then + apt-get install -y --force-yes --no-install-recommends ffmpeg nginx + useradd ${WEBCAM_USER} + usermod -aG video ${WEBCAM_USER} + fi #CuraEngine if [ "$OCTOPI_INCLUDE_CURAENGINE" == "yes" ] @@ -234,6 +243,10 @@ then sudo -u pi sed -i -e "s@cura_engine: /usr/local/bin/cura_engine@cura_engine:@g" /home/pi/.octoprint/config.yaml fi +### Streamer select service. + +systemctl_if_exists enable streamer_select.service + ### mjpg_streamer if [ "$OCTOPI_INCLUDE_MJPGSTREAMER" == "yes" ] @@ -241,12 +254,15 @@ then systemctl_if_exists enable webcamd.service else rm /etc/logrotate.d/webcamd - rm /etc/init.d/webcamd + rm /etc/systemd/system/webcamd.service rm /etc/default/webcamd rm /root/bin/webcamd fi +### HLS streamer + +systemctl_if_exists enable ffmpeg_hls.service + #cleanup apt-get clean apt-get autoremove -y - From b23f782ea342126f65b04c2fd8803b89203fe281 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sat, 30 May 2020 19:26:23 +0300 Subject: [PATCH 045/130] Update download url from raspbian to raspios --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index fe082fac..6caff0bc 100644 --- a/README.rst +++ b/README.rst @@ -79,7 +79,7 @@ You can build it by issuing the following commands:: git clone https://github.com/guysoft/CustomPiOS.git git clone https://github.com/guysoft/OctoPi.git cd OctoPi/src/image - wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspbian_lite_latest' + wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_armhf_lates' cd .. ../../CustomPiOS/src/update-custompios-paths sudo modprobe loop From 9465f7417957ff162b73c45b1a104e94d3ed3114 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sat, 30 May 2020 19:28:07 +0300 Subject: [PATCH 046/130] Fix typo --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 6caff0bc..c79069ef 100644 --- a/README.rst +++ b/README.rst @@ -79,7 +79,7 @@ You can build it by issuing the following commands:: git clone https://github.com/guysoft/CustomPiOS.git git clone https://github.com/guysoft/OctoPi.git cd OctoPi/src/image - wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_armhf_lates' + wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_armhf_latest' cd .. ../../CustomPiOS/src/update-custompios-paths sudo modprobe loop From 62eabbf492c42a9e73cd4b094cbb10b7a7e19d64 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 10 Jun 2020 11:00:01 +0300 Subject: [PATCH 047/130] Cura is too old, no one AFAIK is using it, removing, see #654 and #444 --- src/modules/octopi/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/config b/src/modules/octopi/config index e0d0e7d5..c0d3d129 100755 --- a/src/modules/octopi/config +++ b/src/modules/octopi/config @@ -12,7 +12,7 @@ # CuraEngine archive & version [ -n "$OCTOPI_CURAENGINE_VERSION" ] || OCTOPI_CURAENGINE_VERSION=15.04.6 [ -n "$OCTOPI_CURAENGINE_ARCHIVE" ] || OCTOPI_CURAENGINE_ARCHIVE=https://github.com/Ultimaker/CuraEngine/archive/$OCTOPI_CURAENGINE_VERSION.zip -[ -n "$OCTOPI_INCLUDE_CURAENGINE" ] || OCTOPI_INCLUDE_CURAENGINE=yes +[ -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 From 71f9e549bbbe3598e3122fbb72aeefc09f8fcf56 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 28 Jun 2020 22:36:09 +0300 Subject: [PATCH 048/130] Fixes #657 --- src/modules/octopi/filesystem/home/root/bin/webcamd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 71a549fb..565b58a9 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -15,7 +15,7 @@ MJPGSTREAMER_HOME=/home/pi/mjpg-streamer MJPGSTREAMER_INPUT_USB="input_uvc.so" MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so" -brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "038f:6001") +brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "038f:6001", "046d:0825") config_dir="/boot/octopi.conf.d" From 2a5910b24eb1b2c0dc923fa6c46f7c73f2bedc12 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 28 Jun 2020 22:36:58 +0300 Subject: [PATCH 049/130] Fix typo #657 --- src/modules/octopi/filesystem/home/root/bin/webcamd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 565b58a9..62750f37 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -15,7 +15,7 @@ MJPGSTREAMER_HOME=/home/pi/mjpg-streamer MJPGSTREAMER_INPUT_USB="input_uvc.so" MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so" -brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "038f:6001", "046d:0825") +brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "038f:6001" "046d:0825") config_dir="/boot/octopi.conf.d" From 7f6170adb5150a1c8ffe19dbd0328b9cdb8fd877 Mon Sep 17 00:00:00 2001 From: Gina Haeussge Date: Fri, 3 Jul 2020 14:12:40 +0200 Subject: [PATCH 050/130] Switch to Python 3 Closes #604 --- src/modules/octopi/config | 2 +- src/modules/octopi/start_chroot_script | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/modules/octopi/config b/src/modules/octopi/config index c0d3d129..ade885f4 100755 --- a/src/modules/octopi/config +++ b/src/modules/octopi/config @@ -7,7 +7,7 @@ [ -n "$OCTOPI_INCLUDE_OCTOPRINT" ] || OCTOPI_INCLUDE_OCTOPRINT=yes # PyBonjour archive -[ -n "$OCTOPI_PYBONJOUR_ARCHIVE" ] || OCTOPI_PYBONJOUR_ARCHIVE=https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/pybonjour/pybonjour-1.1.1.tar.gz +[ -n "$OCTOPI_PYBONJOUR_ARCHIVE" ] || OCTOPI_PYBONJOUR_ARCHIVE=https://github.com/OctoPrint/pybonjour-python3/archive/master.zip # CuraEngine archive & version [ -n "$OCTOPI_CURAENGINE_VERSION" ] || OCTOPI_CURAENGINE_VERSION=15.04.6 diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index de87db3f..eb77a28e 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -26,7 +26,7 @@ echo "removing:" $remove_extra apt-get remove -y --purge $remove_extra apt-get autoremove -y -apt-get -y --force-yes install python2.7 python-virtualenv python-dev git screen subversion cmake checkinstall avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev +apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake checkinstall avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev echo " - Reinstall iputils-ping" apt-get install --reinstall iputils-ping @@ -34,13 +34,8 @@ apt-get install --reinstall iputils-ping pushd /home/pi # build virtualenv - # uncomment when setup tools issue has been fixed - # sudo -u pi virtualenv oprint - # sudo -u pi /home/pi/oprint/bin/pip install --upgrade pip - - sudo -u pi virtualenv --no-setuptools oprint + sudo -u pi python3 -m virtualenv --python=python3 oprint sudo -u pi /home/pi/oprint/bin/pip install --upgrade pip - sudo -u pi /home/pi/oprint/bin/pip install "setuptools<45" # OctoPrint & pyserial if [ "$OCTOPI_INCLUDE_OCTOPRINT" == "yes" ] From 9909aaed21e898102ff8e446df667c0b3026fa94 Mon Sep 17 00:00:00 2001 From: Gina Haeussge Date: Fri, 3 Jul 2020 19:08:46 +0200 Subject: [PATCH 051/130] Switch OctoPrint to systemd unit It was still runing on a sys-v initscript. Startup parameter changes no longer are done via /etc/default/octoprint (no such thing in systemd) but should instead be done through systemd mechanisms. See https://askubuntu.com/a/659268 for examples on how. --- .../filesystem/root/etc/default/octoprint | 22 --- .../filesystem/root/etc/init.d/octoprint | 141 ------------------ .../root/etc/systemd/system/octoprint.service | 14 ++ src/modules/octopi/start_chroot_script | 7 +- 4 files changed, 17 insertions(+), 167 deletions(-) delete mode 100644 src/modules/octopi/filesystem/root/etc/default/octoprint delete mode 100755 src/modules/octopi/filesystem/root/etc/init.d/octoprint create mode 100644 src/modules/octopi/filesystem/root/etc/systemd/system/octoprint.service diff --git a/src/modules/octopi/filesystem/root/etc/default/octoprint b/src/modules/octopi/filesystem/root/etc/default/octoprint deleted file mode 100644 index 5389e9c5..00000000 --- a/src/modules/octopi/filesystem/root/etc/default/octoprint +++ /dev/null @@ -1,22 +0,0 @@ -# Configuration for /etc/init.d/octoprint - -# The init.d script will only run if this variable non-empty. -OCTOPRINT_USER=pi - -# To what host to bind daemon, default is 127.0.0.1 -HOST=127.0.0.1 - -# On what port to run daemon, default is 5000 -PORT=5000 - -# Path to the OctoPrint executable, use this to override the default setting "/usr/bin/octoprint" -DAEMON=/home/pi/oprint/bin/octoprint - -# What arguments to pass to octoprint, usually no need to touch this -DAEMON_ARGS="--host=$HOST --port=$PORT" - -# Umask of files octoprint generates, Change this to 000 if running octoprint as its own, separate user -UMASK=022 - -# Should we run at startup? -START=yes diff --git a/src/modules/octopi/filesystem/root/etc/init.d/octoprint b/src/modules/octopi/filesystem/root/etc/init.d/octoprint deleted file mode 100755 index 19db9762..00000000 --- a/src/modules/octopi/filesystem/root/etc/init.d/octoprint +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/sh - -### BEGIN INIT INFO -# Provides: octoprint -# Required-Start: $local_fs networking -# Required-Stop: networking -# Should-Start: -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: OctoPrint daemon -# Description: Starts the OctoPrint daemon with the user specified in -# /etc/default/octoprint. -### END INIT INFO - -# Author: Sami Olmari - -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -DESC="OctoPrint Daemon" -NAME="OctoPrint" -DAEMON=/usr/bin/octoprint -PIDFILE=/var/run/$NAME.pid -PKGNAME=octoprint -SCRIPTNAME=/etc/init.d/$PKGNAME - -# Read configuration variable file if it is present -[ -r /etc/default/$PKGNAME ] && . /etc/default/$PKGNAME - -# Exit if the octoprint is not installed -[ -x "$DAEMON" ] || exit 0 - -# Load the VERBOSE setting and other rcS variables -[ -f /etc/default/rcS ] && . /etc/default/rcS - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. -. /lib/lsb/init-functions - -if [ -z "$START" -o "$START" != "yes" ] -then - log_warning_msg "Not starting $PKGNAME, edit /etc/default/$PKGNAME to start it." - exit 0 -fi - -if [ -z "$OCTOPRINT_USER" ] -then - log_warning_msg "Not starting $PKGNAME, OCTOPRINT_USER not set in /etc/default/$PKGNAME." - exit 0 -fi - -# -# Function to verify if a pid is alive -# -is_alive() -{ - pid=`cat $1` > /dev/null 2>&1 - kill -0 $pid > /dev/null 2>&1 - return $? -} - -# -# Function that starts the daemon/service -# -do_start() -{ - # Return - # 0 if daemon has been started - # 1 if daemon was already running - # 2 if daemon could not be started - - is_alive $PIDFILE - RETVAL="$?" - - if [ $RETVAL != 0 ]; then - start-stop-daemon --start --background --quiet --pidfile $PIDFILE --make-pidfile \ - --exec $DAEMON --chuid $OCTOPRINT_USER --user $OCTOPRINT_USER --umask $UMASK -- serve $DAEMON_ARGS - RETVAL="$?" - fi -} - -# -# Function that stops the daemon/service -# -do_stop() -{ - # Return - # 0 if daemon has been stopped - # 1 if daemon was already stopped - # 2 if daemon could not be stopped - # other if a failure occurred - - start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --user $OCTOPRINT_USER --pidfile $PIDFILE - RETVAL="$?" - [ "$RETVAL" = "2" ] && return 2 - - rm -f $PIDFILE - - [ "$RETVAL" = "0" ] && return 0 || return 1 -} - -case "$1" in - start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - do_start - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; - esac - ;; - restart) - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) log_end_msg 0 ;; - 1) log_end_msg 1 ;; # Old process is still running - *) log_end_msg 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1 - ;; - esac - ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2 - exit 3 - ;; -esac - diff --git a/src/modules/octopi/filesystem/root/etc/systemd/system/octoprint.service b/src/modules/octopi/filesystem/root/etc/systemd/system/octoprint.service new file mode 100644 index 00000000..191f4e05 --- /dev/null +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/octoprint.service @@ -0,0 +1,14 @@ +[Unit] +Description=The snappy web interface for your 3D printer +After=network.online.target +Wants=network.online.target + +[Service] +Environment="HOST=127.0.0.1" +Environment="PORT=5000" +Type=simple +User=pi +ExecStart=/home/pi/oprint/bin/octoprint serve --host=${HOST} --port=${PORT} + +[Install] +WantedBy=multi-user.target diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index de87db3f..7138fe44 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -214,11 +214,10 @@ update-rc.d change_hostname defaults if [ "$OCTOPI_INCLUDE_OCTOPRINT" == "yes" ] then - update-rc.d octoprint defaults 95 + systemctl_if_exists enable octoprint.service else # let's remove the configs for system services we don't need - rm /etc/init.d/octoprint - rm /etc/default/octoprint + rm /etc/systemd/system/octoprint.service fi ### haproxy @@ -232,7 +231,7 @@ else # also we need to make OctoPrint bind to all interfaces because otherwise # it will be unaccessible... - [ -f /etc/default/octoprint ] && sed -i "s@HOST=127.0.0.1@HOST=0.0.0.0@" /etc/default/octoprint + [ -f /etc/systemd/system/octoprint.service ] && sed -i "s@HOST=127.0.0.1@HOST=0.0.0.0@" /etc/systemd/system/octoprint.service fi ### CuraEngine From 7acd71e2491e658444f436677c1d05099fdd32cd Mon Sep 17 00:00:00 2001 From: Gina Haeussge Date: Fri, 3 Jul 2020 19:10:57 +0200 Subject: [PATCH 052/130] Fix webcamd issues Removed left over references to sysv init stuff. Fixed logging to /var/log/webcamd.log. --- .../octopi/filesystem/root/etc/default/webcamd | 13 ------------- .../octopi/filesystem/root/etc/logrotate.d/webcamd | 2 +- .../root/etc/systemd/system/webcamd.service | 2 ++ src/modules/octopi/start_chroot_script | 1 - 4 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 src/modules/octopi/filesystem/root/etc/default/webcamd diff --git a/src/modules/octopi/filesystem/root/etc/default/webcamd b/src/modules/octopi/filesystem/root/etc/default/webcamd deleted file mode 100644 index cdbae578..00000000 --- a/src/modules/octopi/filesystem/root/etc/default/webcamd +++ /dev/null @@ -1,13 +0,0 @@ -# Configuration for /etc/init.d/webcamd - -# Daemon -DAEMON=/root/bin/webcamd - -# Log file to use -LOG=/var/log/webcamd.log - -# User to run under -USER=pi - -# Should we run at startup? -ENABLED=1 diff --git a/src/modules/octopi/filesystem/root/etc/logrotate.d/webcamd b/src/modules/octopi/filesystem/root/etc/logrotate.d/webcamd index 5c148ac0..2c5b5c68 100644 --- a/src/modules/octopi/filesystem/root/etc/logrotate.d/webcamd +++ b/src/modules/octopi/filesystem/root/etc/logrotate.d/webcamd @@ -1,4 +1,4 @@ -/var/log/webcam.log +/var/log/webcamd.log { rotate 4 weekly 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 53363805..2416f578 100644 --- a/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service @@ -4,6 +4,8 @@ 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 diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index de87db3f..4d595b8f 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -255,7 +255,6 @@ then else rm /etc/logrotate.d/webcamd rm /etc/systemd/system/webcamd.service - rm /etc/default/webcamd rm /root/bin/webcamd fi From 87241e56d38ab9169544e66f04de443d67e6d6f3 Mon Sep 17 00:00:00 2001 From: Gina Haeussge Date: Fri, 3 Jul 2020 15:39:37 +0200 Subject: [PATCH 053/130] Build image via Github Actions Will build an image on push and daily at 00:00Z. Resulting image gets timestamped and attached to the build as build artifact. --- .github/workflows/build.yml | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..7980a67d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,60 @@ +name: Build Image + +on: + push: + schedule: + - cron: '0 0 * * *' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install Dependencies + run: | + sudo apt update + sudo apt install coreutils p7zip-full qemu-user-static + + - name: Checkout CustomPiOS + uses: actions/checkout@v2 + with: + repository: 'guysoft/CustomPiOS' + path: CustomPiOS + + - name: Checkout Project Repository + uses: actions/checkout@v2 + with: + path: repository + submodules: true + + - name: Download Raspbian Image + run: | + cd repository/src/image + wget -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_armhf_latest' + + - name: Update CustomPiOS Paths + run: | + cd repository/src + ../../CustomPiOS/src/update-custompios-paths + + - name: Build Image + run: | + sudo modprobe loop + cd repository/src + sudo bash -x ./build_dist + + - name: Copy output + id: copy + run: | + source repository/src/config + NOW=$(date +"%Y-%m-%d-%H%M") + IMAGE=$NOW-octopi-$DIST_VERSION + + cp repository/src/workspace/*.img $IMAGE.img + + echo "::set-output name=image::$IMAGE" + + # artifact upload will take care of zipping for us + - uses: actions/upload-artifact@v1 + with: + name: ${{ steps.copy.outputs.image }} + path: ${{ steps.copy.outputs.image }}.img \ No newline at end of file From 8cf4b4100dd2f4626d6d91f7fec7cf9d76afb865 Mon Sep 17 00:00:00 2001 From: Gina Haeussge Date: Fri, 3 Jul 2020 18:24:44 +0200 Subject: [PATCH 054/130] Add method to work around apt mirror hiccups Apparently some of the ones on Raspbian's mirror list are unreliable. --- .github/workflows/build.yml | 4 ++++ src/modules/octopi/config | 3 +++ src/modules/octopi/start_chroot_script | 13 +++++++++++++ 3 files changed, 20 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7980a67d..41c0a0d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,10 @@ jobs: run: | cd repository/src ../../CustomPiOS/src/update-custompios-paths + + - name: Force apt mirror to work around intermittent mirror hiccups + run: | + echo "OCTOPI_APTMIRROR=http://mirror.us.leaseweb.net/raspbian/raspbian" > repository/src/config.local - name: Build Image run: | diff --git a/src/modules/octopi/config b/src/modules/octopi/config index c0d3d129..664bdcd1 100755 --- a/src/modules/octopi/config +++ b/src/modules/octopi/config @@ -34,3 +34,6 @@ [ -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 ,) [ -n "$OCTOPI_COMMIT" ] || OCTOPI_COMMIT=`pushd "${DIST_PATH}" > /dev/null ; git rev-parse HEAD ; popd > /dev/null` + +# Fixed apt mirror +[ -n "$OCTOPI_APTMIRROR" ] || OCTOPI_APTMIRROR= \ No newline at end of file diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index de87db3f..7f9fe69c 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -11,6 +11,13 @@ export LC_ALL=C source /common.sh +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 + sed -i "s@http://raspbian.raspberrypi.org/raspbian/@$OCTOPI_APTMIRROR@g" /etc/apt/sources.list +fi + WEBCAM_USER=webcam ### Script #### @@ -266,3 +273,9 @@ systemctl_if_exists enable ffmpeg_hls.service #cleanup apt-get clean apt-get autoremove -y + +if [ -n "$OCTOPI_APTMIRROR" ]; +then + echo "Reverting /etc/apt/sources.list" + mv /etc/apt/sources.list.backup /etc/apt/sources.list +fi From b64a5441b807f449417b8bcedb41b2703adf89e9 Mon Sep 17 00:00:00 2001 From: Gina Haeussge Date: Fri, 3 Jul 2020 19:47:45 +0200 Subject: [PATCH 055/130] Add 046d:0994 to broken fps devices As reported in #641. Closes #641 --- src/modules/octopi/filesystem/home/root/bin/webcamd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 62750f37..7e488bbe 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -15,7 +15,7 @@ MJPGSTREAMER_HOME=/home/pi/mjpg-streamer MJPGSTREAMER_INPUT_USB="input_uvc.so" MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so" -brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "038f:6001" "046d:0825") +brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "038f:6001" "046d:0825" "046d:0994") config_dir="/boot/octopi.conf.d" From 87864d3f208fbeadaf0ebee1c66c4f7f95cca958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 9 Jul 2020 11:31:55 +0200 Subject: [PATCH 056/130] Limit artifact persistence to scheduled builds --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 41c0a0d1..09781709 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,6 +59,7 @@ jobs: # artifact upload will take care of zipping for us - uses: actions/upload-artifact@v1 + if: github.event_name == 'schedule' with: name: ${{ steps.copy.outputs.image }} path: ${{ steps.copy.outputs.image }}.img \ No newline at end of file From f3ca1335bb8d72fca54a1d0a3948750174835982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 9 Jul 2020 11:34:04 +0200 Subject: [PATCH 057/130] Add vscode & idea folders to gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index caa2b02e..386e2ff8 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ src/workspace src/build.log src/vagrant/*.log src/vagrant/.vagrant +.vscode +.idea From 0d0ea3751e3866d7f893699894691025e33a7757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 9 Jul 2020 11:38:34 +0200 Subject: [PATCH 058/130] Add two brokenfps devices 046d:0804 & 0ac8:3450 Closes #622 Closes #638 --- src/modules/octopi/filesystem/home/root/bin/webcamd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index 7e488bbe..b60bc0e7 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -15,7 +15,7 @@ MJPGSTREAMER_HOME=/home/pi/mjpg-streamer MJPGSTREAMER_INPUT_USB="input_uvc.so" MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so" -brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "038f:6001" "046d:0825" "046d:0994") +brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "038f:6001" "046d:0804" "046d:0825" "046d:0994" "0ac8:3450") config_dir="/boot/octopi.conf.d" From 8d0887f6ad8dc84ce68115159cd39d30dae017c4 Mon Sep 17 00:00:00 2001 From: Timofei Korostelev Date: Sun, 26 Jul 2020 10:32:10 -0700 Subject: [PATCH 059/130] Proxied HLS through HAProxy. Made JPEG frames writing atomic. Tuned HLS stream. --- .../etc/haproxy/errors/503-no-webcam-hls.http | 68 +++++++++++++++++++ .../filesystem/root/etc/haproxy/haproxy.cfg | 5 ++ .../root/etc/nginx/sites-available/default | 2 +- .../etc/systemd/system/ffmpeg_hls.service | 7 +- 4 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 src/modules/octopi/filesystem/root/etc/haproxy/errors/503-no-webcam-hls.http diff --git a/src/modules/octopi/filesystem/root/etc/haproxy/errors/503-no-webcam-hls.http b/src/modules/octopi/filesystem/root/etc/haproxy/errors/503-no-webcam-hls.http new file mode 100644 index 00000000..e94373b1 --- /dev/null +++ b/src/modules/octopi/filesystem/root/etc/haproxy/errors/503-no-webcam-hls.http @@ -0,0 +1,68 @@ +HTTP/1.0 503 Service Unavailable +Cache-Control: no-cache +Connection: close +Content-Type: text/html + + + + HLS Webcam server is currently not running + + + +
+

The HLS webcam server is currently not running

+
+ + + diff --git a/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg index 34b21fab..06b533dd 100644 --- a/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg +++ b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg @@ -24,6 +24,8 @@ frontend public 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 @@ -41,3 +43,6 @@ backend webcam 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/filesystem/root/etc/nginx/sites-available/default b/src/modules/octopi/filesystem/root/etc/nginx/sites-available/default index 251348f2..3ca36780 100644 --- a/src/modules/octopi/filesystem/root/etc/nginx/sites-available/default +++ b/src/modules/octopi/filesystem/root/etc/nginx/sites-available/default @@ -1,5 +1,5 @@ server { - listen 8051 default_server; + listen 127.0.0.1:28126; root /tmp/webcam; 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 520b35be..35846d15 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 @@ -17,15 +17,16 @@ ExecStart=/usr/bin/ffmpeg \ -i /dev/video0 \ \ -c:v mjpeg -q:v 0 \ - -f image2 -update 1 \ + -f image2 -update 1 -atomic_writing 1 \ /tmp/webcam/jpeg/frame.jpg \ \ -c:v h264_omx -profile:v high \ -b:v 2048k -flags +cgop \ -g 30 -keyint_min 30 \ \ - -f hls -hls_time 1 -hls_flags delete_segments \ - -hls_allow_cache 1 -hls_segment_type fmp4 \ + -f hls -hls_time 1 \ + -hls_flags delete_segments+program_date_time+temp_file+independent_segments \ + -hls_allow_cache 0 -hls_segment_type fmp4 \ -hls_list_size 32 -hls_delete_threshold 64 \ /tmp/webcam/hls/stream.m3u8 From 7afaf01365df9c8c0960f7ae54e01a2e6ddf597b Mon Sep 17 00:00:00 2001 From: Nigel2x4 Date: Wed, 26 Aug 2020 09:57:25 -0400 Subject: [PATCH 060/130] added default listener to localhost for webcamd --- src/modules/octopi/filesystem/home/root/bin/webcamd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index b60bc0e7..f51a8c52 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -46,7 +46,7 @@ for cfg_file in ${cfg_files[@]}; do camera_usb_options="-r 640x480 -f 10" camera_raspi_options="-fps 10" camera_http_webroot="./www-octopi" - camera_http_options="-n" + camera_http_options="-n --listen 127.0.0.1" additional_brokenfps_usb_devices=() if [[ -e ${cfg_file} ]]; then From adab4e6b9f6ac4cf13b8ea1323b66b792a8d03fc Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Tue, 29 Sep 2020 10:51:33 +0300 Subject: [PATCH 061/130] Remove checkinstall that is not needed anymore, missed in this commit https://github.com/guysoft/OctoPi/commit/d3a8991879e5ae5c9c6d21e0bcaf55b3356e02b7 --- 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 c5879180..966a756d 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 checkinstall avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev +apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen subversion cmake avahi-daemon libavahi-compat-libdnssd1 libffi-dev libssl-dev echo " - Reinstall iputils-ping" apt-get install --reinstall iputils-ping From d2a7016c8b1760dcb10d0c14e1b049f173579c86 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Tue, 29 Sep 2020 11:42:51 +0300 Subject: [PATCH 062/130] Install extra dependencies if needed due to arm64 --- 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 966a756d..216e08aa 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -138,7 +138,7 @@ EOT if [ "$OCTOPI_INCLUDE_WIRINGPI" == "yes" ] then echo "--- Installing WiringPi" - apt-get install wiringpi + apt-get -y install wiringpi fi # fetch current yq build and install to /usr/local/bin From 4003dbd388263676a63e20e72291e14419659597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 30 Sep 2020 13:17:27 +0200 Subject: [PATCH 063/130] Remove pybonjour dependency install OctoPrint no longer depends on it (it's no longer maintained and also not compatible to Python 3) and instead now uses zeroconf. As it's incompatible to Python 3 anyhow, installing it no longer makes sense. --- src/modules/octopi/config | 6 ++---- src/modules/octopi/start_chroot_script | 7 +------ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/modules/octopi/config b/src/modules/octopi/config index 996b1bc9..e9f3d064 100755 --- a/src/modules/octopi/config +++ b/src/modules/octopi/config @@ -6,9 +6,6 @@ [ -n "$OCTOPI_OCTOPRINT_REPO_SHIP" ] || OCTOPI_OCTOPRINT_REPO_SHIP=https://github.com/foosel/OctoPrint.git [ -n "$OCTOPI_INCLUDE_OCTOPRINT" ] || OCTOPI_INCLUDE_OCTOPRINT=yes -# PyBonjour archive -[ -n "$OCTOPI_PYBONJOUR_ARCHIVE" ] || OCTOPI_PYBONJOUR_ARCHIVE=https://github.com/OctoPrint/pybonjour-python3/archive/master.zip - # CuraEngine archive & version [ -n "$OCTOPI_CURAENGINE_VERSION" ] || OCTOPI_CURAENGINE_VERSION=15.04.6 [ -n "$OCTOPI_CURAENGINE_ARCHIVE" ] || OCTOPI_CURAENGINE_ARCHIVE=https://github.com/Ultimaker/CuraEngine/archive/$OCTOPI_CURAENGINE_VERSION.zip @@ -36,4 +33,5 @@ [ -n "$OCTOPI_COMMIT" ] || OCTOPI_COMMIT=`pushd "${DIST_PATH}" > /dev/null ; git rev-parse HEAD ; popd > /dev/null` # Fixed apt mirror -[ -n "$OCTOPI_APTMIRROR" ] || OCTOPI_APTMIRROR= \ No newline at end of file +[ -n "$OCTOPI_APTMIRROR" ] || OCTOPI_APTMIRROR= + diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 216e08aa..ded78331 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -44,15 +44,10 @@ pushd /home/pi sudo -u pi python3 -m virtualenv --python=python3 oprint sudo -u pi /home/pi/oprint/bin/pip install --upgrade pip - # OctoPrint & pyserial + # OctoPrint if [ "$OCTOPI_INCLUDE_OCTOPRINT" == "yes" ] then echo "--- Installing OctoPrint" - - #pybonjour (for mdns discovery) - sudo -u pi /home/pi/oprint/bin/pip install $OCTOPI_PYBONJOUR_ARCHIVE - - #OctoPrint PIP_DEFAULT_TIMEOUT=60 sudo -u pi /home/pi/oprint/bin/pip install $OCTOPI_OCTOPRINT_ARCHIVE fi From 1bd2ffabcacbf78305e08c9f7daae8c5cb0dc2d6 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Fri, 2 Oct 2020 15:08:10 +0300 Subject: [PATCH 064/130] Fixes #678 --- src/modules/octopi/filesystem/home/root/bin/webcamd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/home/root/bin/webcamd b/src/modules/octopi/filesystem/home/root/bin/webcamd index f51a8c52..effdfbe2 100755 --- a/src/modules/octopi/filesystem/home/root/bin/webcamd +++ b/src/modules/octopi/filesystem/home/root/bin/webcamd @@ -15,7 +15,7 @@ MJPGSTREAMER_HOME=/home/pi/mjpg-streamer MJPGSTREAMER_INPUT_USB="input_uvc.so" MJPGSTREAMER_INPUT_RASPICAM="input_raspicam.so" -brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "1e4e:0102" "0471:0311" "038f:6001" "046d:0804" "046d:0825" "046d:0994" "0ac8:3450") +brokenfps_usb_devices=("046d:082b" "1908:2310" "0458:708c" "0458:6006" "1e4e:0102" "0471:0311" "038f:6001" "046d:0804" "046d:0825" "046d:0994" "0ac8:3450") config_dir="/boot/octopi.conf.d" From 623efdd49dc5f9d589b385f4e03da01409818006 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Fri, 2 Oct 2020 15:22:09 +0300 Subject: [PATCH 065/130] Fixes #676 and adds deps to install numpy from wheel --- 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 ded78331..596015b4 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 +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 echo " - Reinstall iputils-ping" apt-get install --reinstall iputils-ping From 0e6de698a840a4d44e29cb9fac8019f6d88079bf Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 7 Oct 2020 13:49:30 +0300 Subject: [PATCH 066/130] Add arm64 builds, remove bananapi builds --- src/nightly_build_scripts/generate_nightly_page.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/nightly_build_scripts/generate_nightly_page.js b/src/nightly_build_scripts/generate_nightly_page.js index 2d25ceb7..5d761ab8 100644 --- a/src/nightly_build_scripts/generate_nightly_page.js +++ b/src/nightly_build_scripts/generate_nightly_page.js @@ -162,7 +162,7 @@ var outputPage = function(files, s) { var output = new StringStream(); - output.write(""); + output.write(""); output.write("

Raspberry Pi

\n"); @@ -174,18 +174,18 @@ var outputPage = function(files, s) { output.write("

Nightly Builds

\n"); output.write("Warning: These builds are untested and can be unstable and/or broken. If in doubt use a stable build."); - outputTable(filterNameByRegex(files.filter(function (obj) { return !obj.name.startsWith("stable/") && !obj.name.startsWith("bananapi-m1/") }), /octopi-(wheezy|jessie|stretch|buster)-/), + outputTable(filterNameByRegex(files.filter(function (obj) { return !obj.name.startsWith("stable/") && !obj.name.startsWith("bananapi-m1/") }), /octopi-(wheezy|jessie|stretch|buster)-armhf/), output, function(name) { return name }, 14); - output.write("

Banana Pi M1

\n") + output.write("

64Bit Nightly Builds

\n") - output.write("

Nightly Builds

\n"); + output.write("

Nightly Builds arm64

\n"); output.write("Warning: These builds are untested and can be unstable and/or broken."); - outputTable(filterNameByRegex(files, /^bananapi-m1\//), + outputTable(filterNameByRegex(files.filter(function (obj) { return !obj.name.startsWith("stable/") && !obj.name.startsWith("bananapi-m1/") }), /octopi-(wheezy|jessie|stretch|buster)-arm64/), output, - function(name) { return stripLeading(name, "bananapi-m1/") }, + function(name) { return name }, 14); var content = output.buffer; @@ -212,3 +212,4 @@ client.getFiles(container, function (err, files) { var stream = fs.createWriteStream(outputfile); outputPage(filterByExtension(files, [".zip"]), stream); }); + From 582617b8398e8df5596056b2bde8b017a7aa6388 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 12 Oct 2020 09:47:24 +0300 Subject: [PATCH 067/130] Add raspios_lite_arm64 build variant image folder and update README --- .gitignore | 1 + src/image-raspios_lite_arm64/README | 5 +++++ src/image/README | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 src/image-raspios_lite_arm64/README diff --git a/.gitignore b/.gitignore index 386e2ff8..1638832a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ src/config.local src/custompios_path src/image/*.zip +src/image-raspios_lite_arm64/*.zip src/image-variants/*.zip **/key.json src/nightly_build_scripts/index.html diff --git a/src/image-raspios_lite_arm64/README b/src/image-raspios_lite_arm64/README new file mode 100644 index 00000000..e5aa7b03 --- /dev/null +++ b/src/image-raspios_lite_arm64/README @@ -0,0 +1,5 @@ +Place zipped Raspberry Pi OS 64bit image here. + +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 +here. diff --git a/src/image/README b/src/image/README index 8c07825f..a536aca2 100644 --- a/src/image/README +++ b/src/image/README @@ -1,5 +1,5 @@ -Place zipped Rasbian image here. +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" located +recent zip file matching the file name pattern "*-raspbian.zip" or "*-rpios.zip" located here. From 68dc378e2f053fb7798063d769d645ed9abac18b Mon Sep 17 00:00:00 2001 From: AJRepo Date: Sun, 18 Oct 2020 15:14:43 -0500 Subject: [PATCH 068/130] Fix for 'haprocy -c -f haproxy.cfg' warning HA-Proxy version on RasPi Buster is HA-Proxy version 1.8.19-1+rpi1 2019/03/14 Running a test of the config file sudo haproxy -c -f /etc/haproxy/haproxy.cfg Generates the warning ``` [WARNING] 291/152612 (2843) : Setting tune.ssl.default-dh-param to 1024 by default, if your workload permits it you should set it to at least 2048. Please set a value >= 1024 to make this warning disappear. ``` Documentation for this feature states that higher values might increase server load. Higher values increase CPU load and may not be supported by some clients (IE:Java 7). Tested with values both at 1024 and 2048 Assuming that the use-case for OctoPrint is usually one user at a time, tested on a RasPi 3B with `ab -n 20 -c 1 ...` and also tested by firefox browser by refreshing the home page at about 1 request per second. Load tests showed no measureable difference in user load (uptime) between a value of 1024 and the recommend value 2048. Tests using `ab` showed no measurable difference in response time or failure rate between 1024 and 2048 (2048 was actually faster, but might have been due to caching). Adding `tune.ssl.default-hd-param 2048` to haproxy.cfg file gets rid of warning message and does not measurably impact performance --- src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg index 06b533dd..443dd002 100644 --- a/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg +++ b/src/modules/octopi/filesystem/root/etc/haproxy/haproxy.cfg @@ -3,6 +3,7 @@ global user haproxy group haproxy log /dev/log local1 debug + tune.ssl.default-dh-param 2048 defaults log global From fb178084339bb91ede9e5132c806bfd332667564 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Fri, 23 Oct 2020 02:04:05 +0300 Subject: [PATCH 069/130] Update nightly builds location --- README.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index c79069ef..1a2b2a2f 100644 --- a/README.rst +++ b/README.rst @@ -19,7 +19,11 @@ Download the latest stable build via this button: Official mirror is `here `_ -Nightly builds are available `here `_ +Nightly builds are available `here `_ + +64bit 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 3ba8ad7b026a44322bf5cfea7f5e3b74ec053be4 Mon Sep 17 00:00:00 2001 From: Chudsaviet Date: Sun, 25 Oct 2020 23:42:49 -0700 Subject: [PATCH 070/130] Made HLS stream adaptive. --- .../etc/systemd/system/ffmpeg_hls.service | 22 ++++++++++++++++--- .../root/var/lib/ffmpeg_hls/stream.m3u8 | 6 +++++ 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 src/modules/octopi/filesystem/root/var/lib/ffmpeg_hls/stream.m3u8 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 35846d15..c2a7b494 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 @@ -9,26 +9,42 @@ RestartSec=5 Nice=10 ExecStartPre=/bin/rm -rf /tmp/webcam ExecStartPre=/bin/mkdir -p /tmp/webcam/hls +ExecStartPre=/bin/mkdir -p /tmp/webcam/hls/240p +ExecStartPre=/bin/mkdir -p /tmp/webcam/hls/480p ExecStartPre=/bin/mkdir -p /tmp/webcam/jpeg +ExecStartPre=/bin/cp /var/lib/ffmpeg_hls/stream.m3u8 /tmp/webcam/hls/stream.m3u8 ExecStart=/usr/bin/ffmpeg \ \ - -framerate 30 -video_size 800x600 \ + -framerate 30 -video_size 640x480 \ -i /dev/video0 \ + -pix_fmt yuv420p \ \ -c:v mjpeg -q:v 0 \ -f image2 -update 1 -atomic_writing 1 \ /tmp/webcam/jpeg/frame.jpg \ \ -c:v h264_omx -profile:v high \ - -b:v 2048k -flags +cgop \ + -b:v 1264k -flags +cgop \ -g 30 -keyint_min 30 \ \ -f hls -hls_time 1 \ -hls_flags delete_segments+program_date_time+temp_file+independent_segments \ -hls_allow_cache 0 -hls_segment_type fmp4 \ -hls_list_size 32 -hls_delete_threshold 64 \ - /tmp/webcam/hls/stream.m3u8 + /tmp/webcam/hls/480p/stream.m3u8 \ + \ + -vf scale=-1:240 \ + \ + -c:v h264_omx -profile:v high \ + -b:v 240k -flags +cgop \ + -g 30 -keyint_min 30 \ + \ + -f hls -hls_time 1 \ + -hls_flags delete_segments+program_date_time+temp_file+independent_segments \ + -hls_allow_cache 0 -hls_segment_type fmp4 \ + -hls_list_size 32 -hls_delete_threshold 64 \ + /tmp/webcam/hls/240p/stream.m3u8 [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/src/modules/octopi/filesystem/root/var/lib/ffmpeg_hls/stream.m3u8 b/src/modules/octopi/filesystem/root/var/lib/ffmpeg_hls/stream.m3u8 new file mode 100644 index 00000000..a28b385e --- /dev/null +++ b/src/modules/octopi/filesystem/root/var/lib/ffmpeg_hls/stream.m3u8 @@ -0,0 +1,6 @@ +#EXTM3U +#EXT-X-VERSION:3 +#EXT-X-STREAM-INF:BANDWIDTH=245760,RESOLUTION=320x240 +240p/stream.m3u8 +#EXT-X-STREAM-INF:BANDWIDTH=1294336,RESOLUTION=640x480 +480p/stream.m3u8 \ No newline at end of file From 56f7e587a4be5dac5f74f8b4bcda29748e696a4b Mon Sep 17 00:00:00 2001 From: Patrick Fowler Date: Wed, 28 Oct 2020 16:21:28 -0700 Subject: [PATCH 071/130] Update octopi.txt Add note about problem with raspi cams reporting as usb and config options not being used. --- src/modules/octopi/filesystem/boot/octopi.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/octopi/filesystem/boot/octopi.txt b/src/modules/octopi/filesystem/boot/octopi.txt index b81a1f3f..bc015399 100644 --- a/src/modules/octopi/filesystem/boot/octopi.txt +++ b/src/modules/octopi/filesystem/boot/octopi.txt @@ -53,7 +53,10 @@ ### Additional options to supply to MJPG Streamer for the RasPi Cam # -# See https://faq.octoprint.org/mjpg-streamer-config for available options +# See https://faq.octoprint.org/mjpg-streamer-config for available options. +# +# NOTE: Newer raspi cam modules are reporting as usb devices causing these +# options to be ignored. Set `camera="raspi"` to avoid these issues. # # Defaults to 10fps # From 8aa44187aafa52e487f2b6661007a5aad35c62a6 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Thu, 10 Dec 2020 12:46:41 +0200 Subject: [PATCH 072/130] Fixes #703 --- .../filesystem/root/{ => usr}/lib/systemd/system/nginx.service | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/modules/octopi/filesystem/root/{ => usr}/lib/systemd/system/nginx.service (100%) diff --git a/src/modules/octopi/filesystem/root/lib/systemd/system/nginx.service b/src/modules/octopi/filesystem/root/usr/lib/systemd/system/nginx.service similarity index 100% rename from src/modules/octopi/filesystem/root/lib/systemd/system/nginx.service rename to src/modules/octopi/filesystem/root/usr/lib/systemd/system/nginx.service From ddfc9f500b6e798feae0870fed35f367c2bfd714 Mon Sep 17 00:00:00 2001 From: coliss86 Date: Fri, 18 Dec 2020 18:09:45 +0100 Subject: [PATCH 073/130] Increase restart time to 1 second by default, when the service crash, it is restarted within 100 ms. This patch increase the time in order to eventually let the usb device to be ready. --- .../octopi/filesystem/root/etc/systemd/system/webcamd.service | 1 + 1 file changed, 1 insertion(+) 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 2416f578..ea494e40 100644 --- a/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service +++ b/src/modules/octopi/filesystem/root/etc/systemd/system/webcamd.service @@ -9,6 +9,7 @@ StandardError=append:/var/log/webcamd.log ExecStart=/root/bin/webcamd Restart=always Type=forking +RestartSec=1 [Install] WantedBy=multi-user.target From 4a1864b94421d1b667dfa9afb89d48d8bd5442f5 Mon Sep 17 00:00:00 2001 From: Charlie Powell <31997505+cp2004@users.noreply.github.com> Date: Sun, 27 Dec 2020 15:58:15 +0000 Subject: [PATCH 074/130] Remove preinstalled cura reference See https://github.com/guysoft/OctoPi/issues/692#issuecomment-751482637 and https://github.com/guysoft/OctoPi/commit/62eabbf492c42a9e73cd4b094cbb10b7a7e19d64 --- README.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.rst b/README.rst index 1a2b2a2f..6091ecc9 100644 --- a/README.rst +++ b/README.rst @@ -47,7 +47,6 @@ To install plugins from the commandline instead of OctoPrint's built-in plugin m If a USB webcam or the Raspberry Pi camera is detected, MJPG-streamer will be started automatically as webcam server. OctoPrint on OctoPi ships with correctly configured stream and snapshot URLs pointing at it. If necessary, you can reach it under `http://octopi.local/webcam/?action=stream `_ and SSL respectively, or directly on its configured port 8080: `http://octopi.local:8080/?action=stream `_. -CuraEngine is installed and OctoPrint ships pre-configured with the correct path to utilize it for on-board-slicing. Just import a Cura Slicing Profile in OctoPrint's settings and start slicing directly on your Pi. Features -------- @@ -55,7 +54,6 @@ Features * `OctoPrint `_ host software for 3d printers out of the box * `Raspbian `_ tweaked for maximum performance for printing out of the box * `mjpg-streamer with RaspiCam support `_ for live viewing of prints and timelapse video creation. -* `CuraEngine `_ pre-installed for slicing directly on the Raspberry Pi Developing ---------- From b3b2d456df395478e6c076dc6e08d57df0ad9380 Mon Sep 17 00:00:00 2001 From: Timofei Korostelev Date: Thu, 31 Dec 2020 11:40:59 -0800 Subject: [PATCH 075/130] Changed HLS root directory from `/tmp` to `/run`. --- .../root/etc/nginx/sites-available/default | 2 +- .../etc/systemd/system/ffmpeg_hls.service | 25 +++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/modules/octopi/filesystem/root/etc/nginx/sites-available/default b/src/modules/octopi/filesystem/root/etc/nginx/sites-available/default index 3ca36780..a4183d87 100644 --- a/src/modules/octopi/filesystem/root/etc/nginx/sites-available/default +++ b/src/modules/octopi/filesystem/root/etc/nginx/sites-available/default @@ -1,7 +1,7 @@ server { listen 127.0.0.1:28126; - root /tmp/webcam; + root /run/webcam; location / { # First attempt to serve request as file, then 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 c2a7b494..b3a4d9ce 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 @@ -3,18 +3,21 @@ Description=FFMPEG HLS webcam streaming service ConditionPathExists=/etc/octopi_streamer/hls [Service] -User=webcam +User=root Restart=always RestartSec=5 Nice=10 -ExecStartPre=/bin/rm -rf /tmp/webcam -ExecStartPre=/bin/mkdir -p /tmp/webcam/hls -ExecStartPre=/bin/mkdir -p /tmp/webcam/hls/240p -ExecStartPre=/bin/mkdir -p /tmp/webcam/hls/480p -ExecStartPre=/bin/mkdir -p /tmp/webcam/jpeg -ExecStartPre=/bin/cp /var/lib/ffmpeg_hls/stream.m3u8 /tmp/webcam/hls/stream.m3u8 +ExecStartPre=/bin/rm -rf /run/webcam +ExecStartPre=/bin/mkdir -p /run/webcam/hls +ExecStartPre=/bin/mkdir -p /run/webcam/hls/240p +ExecStartPre=/bin/mkdir -p /run/webcam/hls/480p +ExecStartPre=/bin/mkdir -p /run/webcam/jpeg +ExecStartPre=/bin/cp /var/lib/ffmpeg_hls/stream.m3u8 /run/webcam/hls/stream.m3u8 +ExecStartPre=/bin/chown -R webcam:webcam /run/webcam +ExecStartPre=/bin/chmod -R 0755 /run/webcam -ExecStart=/usr/bin/ffmpeg \ +ExecStart=/usr/bin/sudo -u webcam \ + /usr/bin/ffmpeg \ \ -framerate 30 -video_size 640x480 \ -i /dev/video0 \ @@ -22,7 +25,7 @@ ExecStart=/usr/bin/ffmpeg \ \ -c:v mjpeg -q:v 0 \ -f image2 -update 1 -atomic_writing 1 \ - /tmp/webcam/jpeg/frame.jpg \ + /run/webcam/jpeg/frame.jpg \ \ -c:v h264_omx -profile:v high \ -b:v 1264k -flags +cgop \ @@ -32,7 +35,7 @@ ExecStart=/usr/bin/ffmpeg \ -hls_flags delete_segments+program_date_time+temp_file+independent_segments \ -hls_allow_cache 0 -hls_segment_type fmp4 \ -hls_list_size 32 -hls_delete_threshold 64 \ - /tmp/webcam/hls/480p/stream.m3u8 \ + /run/webcam/hls/480p/stream.m3u8 \ \ -vf scale=-1:240 \ \ @@ -44,7 +47,7 @@ ExecStart=/usr/bin/ffmpeg \ -hls_flags delete_segments+program_date_time+temp_file+independent_segments \ -hls_allow_cache 0 -hls_segment_type fmp4 \ -hls_list_size 32 -hls_delete_threshold 64 \ - /tmp/webcam/hls/240p/stream.m3u8 + /run/webcam/hls/240p/stream.m3u8 [Install] WantedBy=multi-user.target \ No newline at end of file From 3445351397fd179cd62e0dbe5d2b9aea4f5fd57a Mon Sep 17 00:00:00 2001 From: Timofei Korostelev Date: Sat, 2 Jan 2021 14:53:33 -0800 Subject: [PATCH 076/130] Made HLS stream restart every 6 hours. --- .../octopi/filesystem/root/etc/systemd/system/ffmpeg_hls.service | 1 + 1 file changed, 1 insertion(+) 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 c2a7b494..b628ee6e 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 @@ -6,6 +6,7 @@ ConditionPathExists=/etc/octopi_streamer/hls User=webcam Restart=always RestartSec=5 +WatchdogSec=21600 Nice=10 ExecStartPre=/bin/rm -rf /tmp/webcam ExecStartPre=/bin/mkdir -p /tmp/webcam/hls From 2f51ef2dcb60508f25b47c4c2bc070ffe2b363df Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 6 Jan 2021 21:15:12 +0200 Subject: [PATCH 077/130] Switch user pi to BASE_USER --- src/modules/octopi/start_chroot_script | 48 +++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index 596015b4..6398aea4 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -22,7 +22,7 @@ WEBCAM_USER=webcam ### Script #### -unpack /filesystem/home/pi /home/pi pi +unpack /filesystem/home/pi /home/"${BASE_USER}" "${BASE_USER}" unpack /filesystem/home/root /root root unpack /filesystem/boot /boot apt-get update @@ -38,17 +38,17 @@ apt-get -y --force-yes install python3 python3-virtualenv python3-dev git screen echo " - Reinstall iputils-ping" apt-get install --reinstall iputils-ping -pushd /home/pi +pushd /home/"${BASE_USER}" # build virtualenv - sudo -u pi python3 -m virtualenv --python=python3 oprint - sudo -u pi /home/pi/oprint/bin/pip install --upgrade pip + sudo -u "${BASE_USER}" python3 -m virtualenv --python=python3 oprint + sudo -u "${BASE_USER}" /home/"${BASE_USER}"/oprint/bin/pip install --upgrade pip # OctoPrint if [ "$OCTOPI_INCLUDE_OCTOPRINT" == "yes" ] then echo "--- Installing OctoPrint" - PIP_DEFAULT_TIMEOUT=60 sudo -u pi /home/pi/oprint/bin/pip install $OCTOPI_OCTOPRINT_ARCHIVE + PIP_DEFAULT_TIMEOUT=60 sudo -u "${BASE_USER}" /home/"${BASE_USER}"/oprint/bin/pip install $OCTOPI_OCTOPRINT_ARCHIVE fi #mjpg-streamer @@ -70,17 +70,17 @@ pushd /home/pi # 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 pi:pi ${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 pi cmake -DCMAKE${MJPG_STREAMER_BUILD_DIR}_TYPE=Release ..) + sudo -u "${BASE_USER}" cmake -DCMAKE${MJPG_STREAMER_BUILD_DIR}_TYPE=Release ..) - sudo -u pi make -j $(nproc) -C ${MJPG_STREAMER_BUILD_DIR} + sudo -u "${BASE_USER}" make -j $(nproc) -C ${MJPG_STREAMER_BUILD_DIR} - sudo -u pi cp ${MJPG_STREAMER_BUILD_DIR}/mjpg_streamer . - sudo -u pi find ${MJPG_STREAMER_BUILD_DIR} -name "*.so" -type f -exec cp {} . \; + 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 {} . \; # create our custom web folder and add a minimal index.html to it - sudo -u pi mkdir www-octopi + sudo -u "${BASE_USER}" mkdir www-octopi pushd www-octopi cat <> index.html @@ -113,13 +113,13 @@ EOT folder=CuraEngine-$OCTOPI_CURAENGINE_VERSION zipfile=$folder.zip apt-get -y install gcc-4.9 g++-4.9 - sudo -u pi wget -O$zipfile $OCTOPI_CURAENGINE_ARCHIVE - sudo -u pi unzip $zipfile + sudo -u "${BASE_USER}" wget -O$zipfile $OCTOPI_CURAENGINE_ARCHIVE + sudo -u "${BASE_USER}" unzip $zipfile pushd $folder - sudo -u pi make -j$(nproc) CXX=g++-4.9 VERSION=$OCTOPI_CURAENGINE_VERSION + sudo -u "${BASE_USER}" make -j$(nproc) CXX=g++-4.9 VERSION=$OCTOPI_CURAENGINE_VERSION cp build/CuraEngine /usr/local/bin/cura_engine popd - sudo -u pi rm -r $folder $zipfile + sudo -u "${BASE_USER}" rm -r $folder $zipfile fi #setup haproxy for http and https, and webcam @@ -141,9 +141,9 @@ EOT popd -#Make sure user pi has access to serial ports -usermod -a -G tty pi -usermod -a -G dialout pi +#Make sure user pi / ${BASE_USER} has access to serial ports +usermod -a -G tty "${BASE_USER}" +usermod -a -G dialout "${BASE_USER}" # store octopi commit used to build this image echo "$OCTOPI_COMMIT" > /etc/octopi_commit @@ -151,9 +151,9 @@ echo "$OCTOPI_COMMIT" > /etc/octopi_commit # Keep legacy compatibility ln -s /etc/custompios_buildbase /etc/octopi_buildbase -# allow pi user to run shutdown and service commands -echo "pi ALL=NOPASSWD: /sbin/shutdown" > /etc/sudoers.d/octoprint-shutdown -echo "pi ALL=NOPASSWD: /usr/sbin/service" > /etc/sudoers.d/octoprint-service +# allow pi / ${BASE_USER} user to run shutdown and service commands +echo "${BASE_USER} ALL=NOPASSWD: /sbin/shutdown" > /etc/sudoers.d/octoprint-shutdown +echo "${BASE_USER} ALL=NOPASSWD: /usr/sbin/service" > /etc/sudoers.d/octoprint-service #make sure users don't run git with sudo, thus breaking permissions, by adding /root/bin to the #default sudo path and placing a git wrapper script there that checks if it's run as root @@ -191,8 +191,8 @@ EOT echo 'exit 0' >> /etc/rc.local -# add a longer welcome text to ~pi/.bashrc -echo "source /home/pi/scripts/welcome" >> /home/pi/.bashrc +# add a longer welcome text to ~pi/.bashrc / ~${BASE_USER}/.bashrc +echo "source /home/${BASE_USER}/scripts/welcome" >> /home/${BASE_USER}/.bashrc #unpack root in the end, so etc file are not overwritten, might need to add two roots int he future unpack /filesystem/root / @@ -236,7 +236,7 @@ fi if [ ! "$OCTOPI_INCLUDE_CURAENGINE" == "yes" ] then # unconfigure the cura engine path in octoprint's config.yaml - sudo -u pi sed -i -e "s@cura_engine: /usr/local/bin/cura_engine@cura_engine:@g" /home/pi/.octoprint/config.yaml + sudo -u "${BASE_USER}" sed -i -e "s@cura_engine: /usr/local/bin/cura_engine@cura_engine:@g" /home/"${BASE_USER}"/.octoprint/config.yaml fi ### Streamer select service. From ff9f931753db5bb8388a541015f1474af3872456 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Thu, 7 Jan 2021 13:18:39 +0200 Subject: [PATCH 078/130] Add Ubuntu arm64bit variant --- src/variants/ubuntu_arm64/config | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100755 src/variants/ubuntu_arm64/config diff --git a/src/variants/ubuntu_arm64/config b/src/variants/ubuntu_arm64/config new file mode 100755 index 00000000..5fa90462 --- /dev/null +++ b/src/variants/ubuntu_arm64/config @@ -0,0 +1,8 @@ +export BASE_ARCH=aarch64 +export BASE_DISTRO=ubuntu + +export BASE_IMAGE_PATH=${DIST_PATH}/image-ubuntu_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 From 4267ec6f07776d07829c1abc90c2dee606162208 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Mon, 11 Jan 2021 12:00:12 +0200 Subject: [PATCH 079/130] Add install libraspberrypi-bin for vcgencmd --- src/variants/ubuntu_arm64/post_chroot_script | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/variants/ubuntu_arm64/post_chroot_script diff --git a/src/variants/ubuntu_arm64/post_chroot_script b/src/variants/ubuntu_arm64/post_chroot_script new file mode 100644 index 00000000..ff0ed505 --- /dev/null +++ b/src/variants/ubuntu_arm64/post_chroot_script @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -x +set -e + +export LC_ALL=C + +source /common.sh +install_cleanup_trap + + +# add-apt-repository ppa:ubuntu-raspi2/ppa -y +apt-get update +apt-get -y --force-yes install libraspberrypi-bin +apt-get clean +apt-get autoremove -y From 1fe451932a5783c00274bf48348991a6a39dc2d1 Mon Sep 17 00:00:00 2001 From: Benjamin Urban Date: Sat, 23 Jan 2021 19:56:00 +0100 Subject: [PATCH 080/130] Add explanation of git wrapper script --- src/modules/octopi/filesystem/home/root/bin/git | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/modules/octopi/filesystem/home/root/bin/git b/src/modules/octopi/filesystem/home/root/bin/git index 39a0e07b..4e8a986a 100644 --- a/src/modules/octopi/filesystem/home/root/bin/git +++ b/src/modules/octopi/filesystem/home/root/bin/git @@ -3,6 +3,8 @@ if [ "$(id -u)" == "0" ] then echo "Please do not run git as root, your regular user account is enough :)" + echo "The rationale behind this restriction is to prevent cloning the OctoPrint" + echo "repository as root, which will most likely break some functionality." echo echo "If you need to run git with root rights for some other application than" echo "what comes preinstalled on this image you can remove this sanity check:" From b6b7f3623aa59021513693596537543b725aff04 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 31 Jan 2021 16:01:04 +0200 Subject: [PATCH 081/130] 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 082/130] 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 083/130] 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 084/130] 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 085/130] 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 086/130] 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 087/130] 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 088/130] 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 089/130] 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 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 a6Z{80o*0GGKAEQg0000 Date: Sun, 14 Mar 2021 21:36:59 +0100 Subject: [PATCH 090/130] Add a network monitoring for wifi connections --- src/modules/octopi/filesystem/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 091/130] 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 092/130] 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 093/130] 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 094/130] 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 095/130] =?UTF-8?q?=F0=9F=90=9B=20Restore=20120s=20daemon?= =?UTF-8?q?=20loop=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 096/130] =?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 097/130] =?UTF-8?q?=F0=9F=90=9B=20Fix=20handling=20of=20no?= =?UTF-8?q?n-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 098/130] =?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 099/130] =?UTF-8?q?=F0=9F=90=9B=20Add=20haproxy.cfg=20for?= =?UTF-8?q?=202.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 100/130] =?UTF-8?q?=F0=9F=90=9B=20Remove=20mjpg-streamer?= =?UTF-8?q?=20from=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 101/130] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Install=20OctoPrin?= =?UTF-8?q?t=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 102/130] 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 103/130] 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 104/130] 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 105/130] 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 106/130] 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 107/130] 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 108/130] 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 109/130] 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 110/130] :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 111/130] 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 112/130] 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 113/130] 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 114/130] 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 115/130] 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 116/130] 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 117/130] 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 118/130] 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 119/130] 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 120/130] 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 121/130] 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 122/130] 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 123/130] 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 124/130] 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 125/130] 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 126/130] 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 127/130] 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 128/130] 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 129/130] 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 130/130] 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"