#!/bin/bash

# change name of om-wizard.py to setup. Exit if om-wizard.py does not exist.
if [ -f om-wizard.py ]; then
    cp om-wizard.py wizard
	mv wizard /etc/scripts
else
    echo
    echo "File om-wizard.py does not exist. Copy om-wizard.py into the same directory as wizard-setup.sh then try again."
    echo
    exit 1 
fi

# Make script executable
chmod +x /etc/scripts/wizard

# Add /etc/scripts to path by appending 001_userenv.sh
# This ensures the $PATH is set at each login
echo 'export PATH=$PATH:/etc/scripts' >> /etc/profile.d/001_userenv.sh
echo
echo 'Script successfully run. Log out and log back in to apply changes.'
echo
echo 'Run command wizard to start script after logging back in.'
echo

# Add login message by appending 004_wizard_msg.sh
echo '#!\bin\bash
echo 
echo "Type wizard to enter the configuration wizard menu."
echo 
' >> /etc/profile.d/004_wizard_msg.sh