From 6d3bc4ec1dd1d36cd68057fbc1abf145102cf394 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Sat, 18 Apr 2020 18:08:33 -0400 Subject: [PATCH] [refactor] grep file instead of piping cat to grep --- setup/so-functions | 1 + setup/so-setup | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index 2b00f9781..3bf62df5c 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -314,6 +314,7 @@ collect_webuser_inputs() { fi done } + configure_minion() { # You have to pass the TYPE to this function so it knows if its a master or not diff --git a/setup/so-setup b/setup/so-setup index 60772aba0..ae0e84e11 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -34,11 +34,11 @@ 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}$//'` +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=$(cat /proc/cpuinfo | grep processor | wc -l) -LISTCORES=$(cat /proc/cpuinfo | grep processor | awk '{print $3 " \"" "core" "\""}') -RANDOMUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1) +CPUCORES=$(grep -c "processor" /proc/cpuinfo) +LISTCORES=$(grep "processor" /proc/cpuinfo | awk '{print $3 " \"" "core" "\""}') +RANDOMUID=$(