octopi removeall condition

This commit is contained in:
paukstelis
2022-06-11 20:56:56 -04:00
parent 54e2aa19c9
commit d1cf07bf65

View File

@@ -720,7 +720,8 @@ prepare () {
#Add this is as an option #Add this is as an option
echo echo
echo echo
echo 'You now have the option of setting up haproxy. This binds instances to a name on port 80 instead of having to type the port.' echo 'You now have the option of setting up haproxy.'
echo 'This binds instances to a name on port 80 instead of having to type the port.'
echo 'If you intend to use this machine only for OctoPrint, it is safe to select yes.' echo 'If you intend to use this machine only for OctoPrint, it is safe to select yes.'
echo echo
echo echo
@@ -824,7 +825,7 @@ prepare () {
firstrun() { firstrun() {
echo 'The template instance can be configured at this time.' echo 'The template instance can be configured at this time.'
echo 'This includes setting up admin user and the various wizards.' echo 'This includes setting up the admin user and finishing the startup wizards.'
echo 'This avoids you having to connect to the template to set these up.' echo 'This avoids you having to connect to the template to set these up.'
if prompt_confirm "Do you want to setup your admin user now?"; then if prompt_confirm "Do you want to setup your admin user now?"; then
@@ -887,6 +888,7 @@ check_sn() {
} }
remove_everything() { remove_everything() {
get_settings
if prompt_confirm "Remove everything?"; then if prompt_confirm "Remove everything?"; then
readarray -t instances < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p') readarray -t instances < <(cat /etc/octoprint_instances | sed -n -e 's/^instance:\([[:alnum:]]*\) .*/\1/p')
for instance in "${instances[@]}"; do for instance in "${instances[@]}"; do
@@ -919,6 +921,11 @@ remove_everything() {
rm -rf /home/$user/OctoPrint rm -rf /home/$user/OctoPrint
systemctl restart haproxy.service systemctl restart haproxy.service
systemctl daemon-reload systemctl daemon-reload
#if using OctoPi, restart tempalte
if [ "$TYPE" == octopi ]; then
systemctl restart octoprint.service
fi
fi fi
} }