diff --git a/TODO.md b/TODO.md index 2793607..b10dc8b 100644 --- a/TODO.md +++ b/TODO.md @@ -13,3 +13,5 @@ - Wayland using labwc/waybox - Python 3 - Detect if frontend did not load correctly (probably not easy) +- HTTP/Port 80 redirect + diff --git a/stage2/04-octoprint/00-packages b/stage2/04-octoprint/00-packages index 3b88333..10d9e90 100644 --- a/stage2/04-octoprint/00-packages +++ b/stage2/04-octoprint/00-packages @@ -4,4 +4,5 @@ python-setuptools python-virtualenv git libyaml-dev -nginx +nginx +ffmpeg diff --git a/stage2/04-octoprint/01-run.sh b/stage2/04-octoprint/01-run.sh index 0832f57..ae23e9c 100755 --- a/stage2/04-octoprint/01-run.sh +++ b/stage2/04-octoprint/01-run.sh @@ -7,12 +7,10 @@ echo -e "listen 443;" > ${ROOTFS_DIR}/etc/nginx/listen.conf on_chroot << EOF # If OctoPrint already exists, skip this (for debugging) -if [[ ! -f /srv/octoprint/venv/bin/octoprint ]]; then - if [[ ! -d /srv/octoprint ]]; then mkdir -p /srv/octoprint; fi - cd /srv/octoprint || exit 1 - # https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337/ - virtualenv venv || exit 1 - source venv/bin/activate || exit 1 +if [[ ! -f /srv/octoprint/bin/octoprint ]]; then + cd /srv/ || exit 1 + virtualenv octoprint || exit 1 + source octoprint/bin/activate || exit 1 pip install pip --upgrade pip install octoprint || exit 1 # Fix permissions diff --git a/stage2/04-octoprint/files/nginx.conf b/stage2/04-octoprint/files/nginx.conf index e889dc5..f220cd9 100644 --- a/stage2/04-octoprint/files/nginx.conf +++ b/stage2/04-octoprint/files/nginx.conf @@ -22,12 +22,13 @@ upstream "mjpg-streamer" { server 127.0.0.1:8080; } - + server { include /etc/nginx/listen.conf; ssl on; ssl_certificate /etc/ssl/certs/nginx-octoprint.crt; ssl_certificate_key /etc/ssl/private/nginx-octoprint.key; + add_header Strict-Transport-Security "max-age=63072000; includeSubdomains"; server_name localhost; location / { diff --git a/stage2/04-octoprint/files/octoprint.service b/stage2/04-octoprint/files/octoprint.service index 5e086e1..75326d1 100644 --- a/stage2/04-octoprint/files/octoprint.service +++ b/stage2/04-octoprint/files/octoprint.service @@ -6,7 +6,7 @@ Wants=nginx.service Type=simple User=octoprint Group=octoprint -ExecStart=/srv/octoprint/venv/bin/octoprint --host localhost --port 5000 +ExecStart=/srv/octoprint/bin/octoprint --host localhost --port 5000 [Install] WantedBy=multi-user.target diff --git a/stage2/05-mjpgstreamer/01-run.sh b/stage2/05-mjpgstreamer/01-run.sh index a478316..3193dff 100755 --- a/stage2/05-mjpgstreamer/01-run.sh +++ b/stage2/05-mjpgstreamer/01-run.sh @@ -16,6 +16,10 @@ if ! which mjpg_streamer; then cd / # Cleanup rm -rf /tmp/mjpg-streamer + # Create needed folder + mkdir -p /var/www/mjpg + # Permissions + chown octoprint:octoprint /var/www/mjpg fi EOF diff --git a/stage2/05-mjpgstreamer/files/start-mjpg b/stage2/05-mjpgstreamer/files/start-mjpg index 24b2340..149a7d1 100644 --- a/stage2/05-mjpgstreamer/files/start-mjpg +++ b/stage2/05-mjpgstreamer/files/start-mjpg @@ -1,2 +1,2 @@ #!/bin/bash -/usr/local/bin/mjpg_streamer -i input_uvc.so -o "output_http.so --port 8080" +/usr/local/bin/mjpg_streamer -i input_uvc.so -o "output_http.so --port 8080 -w /var/www/mjpg" diff --git a/stage2/06-utils/files/first-time.sh b/stage2/06-utils/files/first-time.sh index 7abc85b..c4770f7 100755 --- a/stage2/06-utils/files/first-time.sh +++ b/stage2/06-utils/files/first-time.sh @@ -12,7 +12,7 @@ source /usr/local/lib/octo-lib.sh install_package () { echo "==========Installing $1==========" >>/home/pi/install.log - source /srv/octoprint/venv/bin/activate || return 1 + source /srv/octoprint/bin/activate || return 1 pip install $1 2>&1 >>/home/pi/install.log || return 1 } @@ -72,6 +72,9 @@ change_password dialog --title "Network Configuration" --nocancel --msgbox "Setup will now open nmtui, a program to help configure your ethernet/wireless interfaces. Hit Quit when you are done." 10 50 nmtui +# Configure the timezone +dpkg-reconfigure tzdata + # Enable/disable OctoPrint, GUI, MJPG and SSH service_select