Applying uqam-fob's suggestions.

This commit is contained in:
Darko Poljak 2017-11-21 23:32:04 +01:00
parent 775d3dfc2c
commit b55520e987
7 changed files with 11 additions and 11 deletions

View file

@ -25,14 +25,14 @@
os=$("$__explorer/os")
case "$os" in
"macosx")
system_profiler SPHardwareDataType | grep "Number of Processors" | awk -F': ' '{print $2}'
system_profiler SPHardwareDataType | grep "Number of Processors" | awk -F ': ' '/Number of Processors/ {print $2}'
;;
*)
if [ -r /proc/cpuinfo ]; then
sockets="$(grep "physical id" /proc/cpuinfo | sort | uniq | wc -l)"
sockets=$(grep "physical id" /proc/cpuinfo | sort -u | wc -l)
if [ "${sockets}" -eq 0 ]; then
sockets="$(grep -c "processor" /proc/cpuinfo)"
sockets=$(grep -cE "^processor\s+:" /proc/cpuinfo)
fi
echo "${sockets}"
fi

View file

@ -22,7 +22,7 @@ name="$__object_id"
state="$(cat "$__object/parameter/state")"
source="$(cat "$__object/parameter/source")"
destination="$(cat "$__object/parameter/destination")"
ccollectconf="$(sed 's,/$,,' "$__object/parameter/ccollectconf")"
ccollectconf="$(sed -E 's,/+$,,' "$__object/parameter/ccollectconf")"
sourcedir="$ccollectconf/sources"
basedir="$sourcedir/$name"

View file

@ -24,8 +24,8 @@ state="$(cat "$__object/parameter/state")"
if [ "${state}" = "present" ]; then
# Download docker-compose file
echo 'curl -L "https://github.com/docker/compose/releases/download/'"${version}"'/docker-compose-$(uname -s)-$(uname -m)" -o /tmp/docker-compose'
echo 'mv /tmp/docker-compose /usr/local/bin/docker-compose'
echo "curl -L 'https://github.com/docker/compose/releases/download/${version}/docker-compose-$(uname -s)-$(uname -m)' -o /tmp/docker-compose"
echo 'mv /tmp/docker-compose /usr/local/bin/docker-compose'
# Change permissions
echo 'chmod +x /usr/local/bin/docker-compose'
fi

View file

@ -21,4 +21,4 @@
# set defaults
# options="$(cat "$__object/parameter/options" 2>/dev/null \
# || echo "" | tee "$__object/parameter/options")"
cat "$__object/parameter/options" 2>/dev/null 1>/dev/null || echo "" > "$__object/parameter/options"
[ -f "$__object/parameter/options" ] || touch "$__object/parameter/options"

View file

@ -29,9 +29,9 @@ fi
# Don't produce "no pkgs installed" output -- breaks things
PKG_OUTPUT=$(pkg info 2>&1)
printf "%s" "$(echo "$PKG_OUTPUT" \
printf "%s" "$PKG_OUTPUT" \
| awk '{print $1}' \
| sed 's/^\(.*\)-\([^-]*\)$/name:\1 ver:\2/g' \
| grep "name:$name ver:" \
| sed 's/^.*ver:\(.*\)/\1/g')"
| sed 's/^.*ver:\(.*\)/\1/g'

View file

@ -28,7 +28,7 @@ if [ "$user" = "root" ]; then
echo absent
fi
else
if su - "$user" -c "[ -d \"\$HOME/.rvm\" ]" ; then
if su -l "$user" -c "[ -d \"\$HOME/.rvm\" ]" ; then
echo "present"
else
echo "absent"

View file

@ -61,7 +61,7 @@ fetch_file() {
}
fetch_and_prepare_file() {
printf 'tmpdir="$(TMPDIR="/tmp" mktemp -d "%s")"\n' "${__type##*/}.XXXXXXXXXX"
printf 'tmpdir="$(TMPDIR=${TMPDIR:-/tmp} mktemp -d "%s")"\n' "${__type##*/}.XXXXXXXXXX"
printf 'cd "$tmpdir"\n'
printf "$fetch_command > \"%s\"\n" "$source" "$source_file_name"
prepare_command="$(cat "$__object/parameter/prepare-command")"