Octo-Config and first-time improvements
Added root check to Octo-Config Added blank password check to password dialog Installs TouchUI plugin for OctoPrint by default Updated TODO
This commit is contained in:
parent
ce6b2a628b
commit
0126ec25ba
4 changed files with 14 additions and 11 deletions
1
TODO.md
1
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue