MJPG, OctoPrint build, first-time and Nginx improvements

First-time will now ask you to configure your timezone

MJPG Streamer now has -w because that was needed according to the
internet

OctoPrint build now no longer makes useless folder

Nginx now has HSTS header to save some typing

FFmpeg is now installed
This commit is contained in:
Logan G 2020-08-16 16:15:54 -06:00
parent 4550badacd
commit a3fff10d3f
Signed by: logan
GPG key ID: E328528C921E7A7A
8 changed files with 20 additions and 11 deletions

View file

@ -13,3 +13,5 @@
- Wayland using labwc/waybox
- Python 3
- Detect if frontend did not load correctly (probably not easy)
- HTTP/Port 80 redirect

View file

@ -5,3 +5,4 @@ python-virtualenv
git
libyaml-dev
nginx
ffmpeg

View file

@ -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

View file

@ -28,6 +28,7 @@
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 / {

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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