diff --git a/TODO.md b/TODO.md index 674cb2d..9adeb9a 100644 --- a/TODO.md +++ b/TODO.md @@ -3,6 +3,7 @@ ## First time/Octo-Config - Change OctoPrint listening address and port - Change frontend listening address and port +- Add plugin menu ## Frontend - Autodetect OctoPrint port if hosted locally diff --git a/stage2/04-octoprint/01-run.sh b/stage2/04-octoprint/01-run.sh index b0def11..7663e86 100755 --- a/stage2/04-octoprint/01-run.sh +++ b/stage2/04-octoprint/01-run.sh @@ -12,6 +12,7 @@ if ! pip list | grep -F octoprint; then source venv/bin/activate || exit 1 pip install pip --upgrade || exit 1 pip install octoprint || exit 1 + pip install "https://github.com/BillyBlaze/OctoPrint-TouchUI/archive/master.zip" || exit 1 fi fi EOF diff --git a/stage2/05-utils/files/first-time.sh b/stage2/05-utils/files/first-time.sh index 2dab3de..ecc1955 100755 --- a/stage2/05-utils/files/first-time.sh +++ b/stage2/05-utils/files/first-time.sh @@ -2,12 +2,13 @@ if [ "$EUID" -ne 0 ]; then echo "This image has not been configured properly. Please complain to Logan" + bash exit 1 fi change_password () { local PASSWORD="$(whiptail --title "Change Password" --nocancel --passwordbox "Enter new password for user \"pi\"" 10 50 3>&1 1>&2 2>&3)" - if [[ $? != 0 ]]; then return 1; fi + if [[ $? != 0 ]]; then change_password; return 0; fi if [[ "$PASSWORD" == "raspberry" ]]; then whiptail --title "Change Password" --nocancel --msgbox "That password sucks. Please use a different one :)" 10 50 change_password diff --git a/stage2/05-utils/files/octo-config b/stage2/05-utils/files/octo-config index cb07ff9..11730dd 100755 --- a/stage2/05-utils/files/octo-config +++ b/stage2/05-utils/files/octo-config @@ -1,8 +1,14 @@ #!/bin/bash +if [ "$EUID" -ne 0 ]; then + echo "This script needs to be run as root." + exit 1 +fi + + change_password () { local PASSWORD="$(whiptail --title "Change Password" --nocancel --passwordbox "Enter new password for user \"pi\"" 10 50 3>&1 1>&2 2>&3)" - if [[ $? != 0 ]]; then return 1; fi + if [[ $? -eq 0 ]] || [[ $PASSWORD == "" ]]; then return 1; fi if [[ "$PASSWORD" == "raspberry" ]]; then whiptail --title "Change Password" --nocancel --msgbox "That password sucks. Please use a different one :)" 10 50 change_password @@ -16,13 +22,7 @@ change_password () { change_password return 0 fi - local OCTOPASS="$(cat /dev/urandom | tr -dc _A-Z-a-z-0-9 | head -c20)" - echo -e "octoprint:$OCTOPASS" | chpasswd - local ROOTPASS="$(cat /dev/urandom | tr -dc _A-Z-a-z-0-9 | head -c20)" - echo -e "root:$ROOTPASS" | chpasswd - unset OCTOPASS - unset ROOTPASS - unset PASSWORD + unset $PASSWORD } service_select () { @@ -104,8 +104,8 @@ main_menu () { case $MAINMENU in "1") nmtui; main_menu; return 0;; - "2") service_select; main_menu; return 0;; - "3") change_password; main_menu; return 0;; + "2") change_password; main_menu; return 0;; + "3") service_select; main_menu; return 0;; "4") screen_timeout; main_menu; return 0;; "5") return 0;; esac