From 081d7e3a09ac306ca3e02e1df44b3c4c455c4652 Mon Sep 17 00:00:00 2001 From: Mike Reeves Date: Tue, 12 Apr 2022 11:20:26 -0400 Subject: [PATCH] Replace salt code on a saltstack update --- salt/common/tools/sbin/so-saltstack-update | 6 ++++++ setup/so-functions | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/salt/common/tools/sbin/so-saltstack-update b/salt/common/tools/sbin/so-saltstack-update index e68af9a7d..f15a65a26 100755 --- a/salt/common/tools/sbin/so-saltstack-update +++ b/salt/common/tools/sbin/so-saltstack-update @@ -31,12 +31,18 @@ copy_new_files() { # Copy new files over to the salt dir cd /tmp/sogh/securityonion + VERSION=$(cat VERSION) git checkout $BRANCH + # We need to overwrite if there is a repo file + if [ -d /opt/so/repo ]; then + tar -czf /opt/so/repo/"$VERSION".tar.gz -C "$(pwd)/.." . + fi rsync -a salt $default_salt_dir/ rsync -a pillar $default_salt_dir/ chown -R socore:socore $default_salt_dir/salt chown -R socore:socore $default_salt_dir/pillar chmod 755 $default_salt_dir/pillar/firewall/addfirewall.sh + rm -rf /tmp/sogh } diff --git a/setup/so-functions b/setup/so-functions index d80fb391b..60c236395 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1510,7 +1510,7 @@ generate_passwords(){ } generate_repo_tarball() { - mkdir /opt/so/repo + mkdir -p /opt/so/repo tar -czf /opt/so/repo/"$SOVERSION".tar.gz -C "$(pwd)/.." . }