mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
[refactor] Run all changes inside whiptail progress, use grep -q
This commit is contained in:
@@ -766,12 +766,12 @@ detect_os() {
|
||||
|
||||
disable_auto_start() {
|
||||
|
||||
if crontab -l -u $INSTALLUSERNAME 2>&1 | grep so-setup > /dev/null 2>&1; then
|
||||
if crontab -l -u $INSTALLUSERNAME 2>&1 | grep -q so-setup; then
|
||||
# Remove the automated setup script from crontab, if it exists
|
||||
logCmd "crontab -u $INSTALLUSERNAME -r"
|
||||
fi
|
||||
|
||||
if grep so-setup /home/$INSTALLUSERNAME/.bash_profile > /dev/null 2>&1; then
|
||||
if grep -q so-setup /home/$INSTALLUSERNAME/.bash_profile; then
|
||||
# Truncate last line of the bash profile
|
||||
info "Removing auto-run of setup from bash profile"
|
||||
sed -i '$ d' /home/$INSTALLUSERNAME/.bash_profile >> "$setup_log" 2>&1
|
||||
|
||||
117
setup/so-setup
117
setup/so-setup
@@ -428,63 +428,7 @@ whiptail_make_changes
|
||||
# From here on changes will be made.
|
||||
echo "1" > /root/accept_changes
|
||||
|
||||
if [[ $is_reinstall ]]; then
|
||||
reinstall_init
|
||||
fi
|
||||
|
||||
if [[ -n "$TURBO" ]]; then
|
||||
use_turbo_proxy
|
||||
fi
|
||||
|
||||
if [[ "$setup_type" == 'iso' ]]; then
|
||||
# Init networking so rest of install works
|
||||
set_hostname
|
||||
set_management_interface
|
||||
fi
|
||||
|
||||
disable_ipv6
|
||||
disable_auto_start
|
||||
|
||||
if [[ "$setup_type" != 'iso' ]]; then
|
||||
set_hostname
|
||||
fi
|
||||
|
||||
if [[ $is_minion ]]; then
|
||||
add_mngr_ip_to_hosts
|
||||
fi
|
||||
|
||||
{
|
||||
mark_version;
|
||||
clear_manager;
|
||||
} >> $setup_log 2>&1
|
||||
|
||||
|
||||
if [[ $is_manager || $is_import ]]; then
|
||||
{
|
||||
generate_passwords;
|
||||
secrets_pillar;
|
||||
add_socore_user_manager;
|
||||
} >> $setup_log 2>&1
|
||||
fi
|
||||
|
||||
if [[ $is_manager && ! $is_eval ]]; then
|
||||
add_soremote_user_manager >> $setup_log 2>&1
|
||||
fi
|
||||
|
||||
{
|
||||
set_main_ip;
|
||||
set_redirect;
|
||||
} >> $setup_log 2>&1
|
||||
|
||||
host_pillar >> $setup_log 2>&1
|
||||
|
||||
if [[ $is_minion || $is_import ]]; then
|
||||
set_updates >> $setup_log 2>&1
|
||||
[ "$automated" == no ] && copy_ssh_key >> $setup_log 2>&1
|
||||
fi
|
||||
|
||||
|
||||
# Exit parent script if
|
||||
# Set up handler for setup to exit early (use `kill -SIGUSR1 "$(ps --pid $$ -oppid=)"; exit 1` in child scripts)
|
||||
trap 'catch $LINENO' SIGUSR1
|
||||
|
||||
catch() {
|
||||
@@ -497,8 +441,67 @@ catch() {
|
||||
{
|
||||
# Set initial percentage to 0
|
||||
export percentage=0
|
||||
|
||||
# Show initial progress message
|
||||
set_progress_str 0 'Running initial configuration steps'
|
||||
|
||||
set_path
|
||||
|
||||
if [[ $is_reinstall ]]; then
|
||||
reinstall_init
|
||||
fi
|
||||
|
||||
if [[ -n "$TURBO" ]]; then
|
||||
use_turbo_proxy
|
||||
fi
|
||||
|
||||
if [[ "$setup_type" == 'iso' ]]; then
|
||||
# Init networking so rest of install works
|
||||
set_hostname >> $setup_log 2>&1
|
||||
set_management_interface
|
||||
fi
|
||||
|
||||
disable_ipv6
|
||||
disable_auto_start
|
||||
|
||||
if [[ "$setup_type" != 'iso' ]]; then
|
||||
set_hostname >> $setup_log 2>&1
|
||||
fi
|
||||
|
||||
if [[ $is_minion ]]; then
|
||||
add_mngr_ip_to_hosts
|
||||
fi
|
||||
|
||||
{
|
||||
mark_version;
|
||||
clear_manager;
|
||||
} >> $setup_log 2>&1
|
||||
|
||||
|
||||
if [[ $is_manager || $is_import ]]; then
|
||||
{
|
||||
generate_passwords;
|
||||
secrets_pillar;
|
||||
add_socore_user_manager;
|
||||
} >> $setup_log 2>&1
|
||||
fi
|
||||
|
||||
if [[ $is_manager && ! $is_eval ]]; then
|
||||
add_soremote_user_manager >> $setup_log 2>&1
|
||||
fi
|
||||
|
||||
{
|
||||
set_main_ip;
|
||||
set_redirect;
|
||||
} >> $setup_log 2>&1
|
||||
|
||||
host_pillar >> $setup_log 2>&1
|
||||
|
||||
if [[ $is_minion || $is_import ]]; then
|
||||
set_updates >> $setup_log 2>&1
|
||||
[ "$automated" == no ] && copy_ssh_key >> $setup_log 2>&1
|
||||
fi
|
||||
|
||||
if [[ $is_manager && $is_airgap ]]; then
|
||||
info "Creating airgap repo"
|
||||
create_repo >> $setup_log 2>&1
|
||||
|
||||
Reference in New Issue
Block a user