[refactor][fix] Remove old so-* containers, make fs changes after whiptail menus

This commit is contained in:
William Wernert
2020-11-03 18:10:16 -05:00
parent 3bf57382ce
commit db31cf3083
2 changed files with 17 additions and 14 deletions

View File

@@ -1414,13 +1414,8 @@ reserve_group_ids() {
reinstall_init() {
local minion_config=/etc/salt/minion
is_reinstall=0
export is_reinstall
# Move last setup log to backup
mv $setup_log $setup_log.bak
info "Putting system in state to run setup again"
info "Some commands may fail depending on whether setup previously succeeded"
{
# Remove startup_states from minion config so we don't immediately highstate when salt starts back up
@@ -1429,11 +1424,12 @@ reinstall_init() {
# Disable schedule so highstate doesn't start running during the install
salt-call -l info schedule.disable
# Stop all containers so files can be changed with more safety
docker stop $(docker ps -a -q)
# Stop and remove all so-* containers so files can be changed with more safety
docker stop $(docker ps -a -q --filter "name=so-")
docker rm $(docker ps -a -q --filter "name=so-")
# Remove /opt/so since we'll be rebuilding this directory during setup
rm -rf /opt/so
# Backup /opt/so since we'll be rebuilding this directory during setup
mv /opt/so /opt/so_old
} >> $setup_log 2>&1
}

View File

@@ -54,13 +54,16 @@ while [[ $# -gt 0 ]]; do
esac
done
if [[ -f $setup_log ]]; then
is_reinstall=true
# Move last setup log to backup
mv $setup_log $setup_log.bak
fi
# Begin Installation pre-processing
parse_install_username
if [[ -f $setup_log ]]; then
reinstall_init
fi
title "Initializing Setup"
info "Installing as the $INSTALLUSERNAME user"
@@ -425,6 +428,10 @@ whiptail_make_changes
# From here on changes will be made.
if [[ $is_reinstall ]]; then
reinstall_init
fi
if [[ -n "$TURBO" ]]; then
use_turbo_proxy
fi