mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
[refactor] Move variables to their own file
This commit is contained in:
@@ -32,16 +32,6 @@ fi
|
||||
# Allow execution of SO tools during setup
|
||||
export PATH=$PATH:../salt/common/tools/sbin
|
||||
|
||||
# Global Variables
|
||||
HOSTNAME=$(cat /etc/hostname)
|
||||
TOTAL_MEM=$(grep MemTotal /proc/meminfo | awk '{print $2}' | sed -r 's/.{3}$//')
|
||||
NICS=$(ip link | awk -F: '$0 !~ "lo|vir|veth|br|docker|wl|^[^0-9]"{print $2 " \"" "Interface" "\"" " OFF"}')
|
||||
CPUCORES=$(grep -c "processor" /proc/cpuinfo | grep -cv KVM)
|
||||
LISTCORES=$(grep "processor" /proc/cpuinfo | awk '{print $3 " \"" "core" "\""}')
|
||||
RANDOMUID=$(</dev/urandom tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
|
||||
NODE_ES_PORT="9200"
|
||||
SETUPLOG="/root/sosetup.log"
|
||||
# End Global Variables
|
||||
|
||||
# Reset the Install Log
|
||||
date -u > $SETUPLOG 2>&1
|
||||
|
||||
36
setup/so-variables
Normal file
36
setup/so-variables
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
export total_mem
|
||||
total_mem=$(grep MemTotal /proc/meminfo | awk '{print $2}' | sed -r 's/.{3}$//')
|
||||
|
||||
export hostname
|
||||
hostname=$(cat /etc/hostname)
|
||||
|
||||
export all_nics
|
||||
all_nics=$(ip link | awk -F: '$0 !~ "lo|vir|veth|br|docker|wl|^[^0-9]"{print $2 " \"" "Interface" "\"" " OFF"}')
|
||||
|
||||
export cpu_cores
|
||||
cpu_cores=$(grep -c "processor" /proc/cpuinfo | grep -v "KVM")
|
||||
|
||||
export cpu_core_list
|
||||
cpu_core_list=$(grep "processor" /proc/cpuinfo | grep -v "KVM" | awk '{print $3 " \"" "core" "\""}')
|
||||
|
||||
export random_uid
|
||||
random_uid=$(</dev/urandom tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
|
||||
|
||||
export node_es_port
|
||||
node_es_port=9200
|
||||
|
||||
export setup_log
|
||||
setup_log="/root/sosetup.log"
|
||||
|
||||
export filesystem_root
|
||||
filesystem_root=$(df / | awk '$3 ~ /[0-9]+/ { print $2 * 1000 }')
|
||||
|
||||
mkdir -p /nsm
|
||||
export filesystem_nsm
|
||||
filesystem_nsm=$(df /nsm | awk '$3 ~ /[0-9]+/ { print $2 * 1000 }')
|
||||
|
||||
mkdir -p /root/installtmp/pillar/minions
|
||||
export temp_install_dir=/root/installtmp
|
||||
|
||||
Reference in New Issue
Block a user