diff --git a/salt/common/tools/sbin/so-airgap-hotfixapply b/salt/common/tools/sbin/so-airgap-hotfixapply index e57ea50fe..0149cdf61 100644 --- a/salt/common/tools/sbin/so-airgap-hotfixapply +++ b/salt/common/tools/sbin/so-airgap-hotfixapply @@ -17,7 +17,7 @@ . /usr/sbin/so-common -HOTFIXDIR=/tmp/sohotfixapply +UPDATE_DIR=/tmp/sohotfixapply if [ -z "$1" ]; then echo "No tarball given. Please provide the filename so I can run the hotfix" @@ -29,13 +29,13 @@ else exit 1 else echo "Determining if we need to apply this hotfix" - rm -rf $HOTFIXDIR - mkdir -p $HOTFIXDIR - tar xvf $1 -C $HOTFIXDIR + rm -rf $UPDATE_DIR + mkdir -p $UPDATE_DIR + tar xvf $1 -C $UPDATE_DIR # Compare some versions - NEWVERSION=$(cat $HOTFIXDIR/VERSION) - HOTFIXVERSION=$(cat $HOTFIXDIR/HOTFIX) + NEWVERSION=$(cat $UPDATE_DIR/VERSION) + HOTFIXVERSION=$(cat $UPDATE_DIR/HOTFIX) CURRENTHOTFIX=$(cat /etc/sohotfix) INSTALLEDVERSION=$(cat /etc/soversion) @@ -43,24 +43,21 @@ else echo "Checking to see if there are hotfixes needed" if [ "$HOTFIXVERSION" == "$CURRENTHOTFIX" ]; then echo "You are already running the latest version of Security Onion." - rm -rf $HOTFIXDIR + rm -rf $UPDATE_DIR exit 1 else echo "We need to apply a hotfix" - cd $HOTFIXDIR - DEFAULT_SALT_DIR=/opt/so/saltstack/default copy_new_files echo $HOTFIXVERSION > /etc/sohotfix salt-call state.highstate -l info queue=True echo "The Hotfix $HOTFIXVERSION has been applied" # Clean up - cd /tmp - rm -rf $HOTFIXDIR + rm -rf $UPDATE_DIR exit 0 fi else echo "This hotfix is not compatible with your current version. Download the latest ISO and run soup" - rm -rf $HOTFIXDIR + rm -rf $UPDATE_DIR fi fi diff --git a/salt/common/tools/sbin/so-common b/salt/common/tools/sbin/so-common index 6aff0269a..22c7543ea 100755 --- a/salt/common/tools/sbin/so-common +++ b/salt/common/tools/sbin/so-common @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +DEFAULT_SALT_DIR=/opt/so/saltstack/default + # Check for prerequisites if [ "$(id -u)" -ne 0 ]; then echo "This script must be run using sudo!" @@ -124,10 +126,12 @@ check_elastic_license() { copy_new_files() { # Copy new files over to the salt dir + cd $UPDATE_DIR rsync -a salt $DEFAULT_SALT_DIR/ rsync -a pillar $DEFAULT_SALT_DIR/ chown -R socore:socore $DEFAULT_SALT_DIR/ chmod 755 $DEFAULT_SALT_DIR/pillar/firewall/addfirewall.sh + cd /tmp } disable_fastestmirror() { diff --git a/salt/common/tools/sbin/soup b/salt/common/tools/sbin/soup index ebf2562b0..9dcaaf1e1 100755 --- a/salt/common/tools/sbin/soup +++ b/salt/common/tools/sbin/soup @@ -21,7 +21,6 @@ UPDATE_DIR=/tmp/sogh/securityonion INSTALLEDVERSION=$(cat /etc/soversion) POSTVERSION=$INSTALLEDVERSION INSTALLEDSALTVERSION=$(salt --versions-report | grep Salt: | awk {'print $2'}) -DEFAULT_SALT_DIR=/opt/so/saltstack/default BATCHSIZE=5 SOUP_LOG=/root/soup.log WHATWOULDYOUSAYYAHDOHERE=soup @@ -714,9 +713,7 @@ upgrade_check_salt if [[ $is_hotfix ]]; then echo "Applying $HOTFIXVERSION" - cd $UPDATE_DIR copy_new_files - cd /tmp echo "" update_version salt-call state.highstate -l info queue=True @@ -787,7 +784,6 @@ else echo "" echo "Copying new Security Onion code from $UPDATE_DIR to $DEFAULT_SALT_DIR." copy_new_files - cd /tmp echo "" update_version