Merge pull request #698 from darko-poljak/SC2002

Fix SC2002
This commit is contained in:
Darko Poljak 2018-10-03 14:51:12 +02:00 committed by GitHub
commit 4403392869
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 11 additions and 11 deletions

View file

@ -30,9 +30,9 @@ case "$os" in
*)
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="$(cat /proc/cpuinfo | grep "processor" | wc -l)"
sockets="$(grep -c "processor" /proc/cpuinfo)"
fi
echo "${sockets}"
fi

View file

@ -28,7 +28,7 @@ if [ -d "/proc/vz" -a ! -d "/proc/bc" ]; then
fi
if [ -e "/proc/1/environ" ] &&
cat "/proc/1/environ" | tr '\000' '\n' | grep -Eiq '^container='; then
tr '\000' '\n' < "/proc/1/environ" | grep -Eiq '^container='; then
echo lxc
exit
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="$(cat "$__object/parameter/ccollectconf" | sed 's,/$,,')"
ccollectconf="$(sed 's,/$,,' "$__object/parameter/ccollectconf")"
sourcedir="$ccollectconf/sources"
basedir="$sourcedir/$name"

View file

@ -39,7 +39,7 @@ version_dir="$versions_dir/$version"
source=$(cat "$version_dir/source")
source_file_name="${source##*/}"
cksum_should=$(cat "$version_dir/cksum" | cut -d' ' -f1,2)
cksum_should=$(cut -d' ' -f1,2 "$version_dir/cksum")
cat << eof
tmpdir=\$(mktemp -d --tmpdir="/tmp" "${__type##*/}.XXXXXXXXXX")

View file

@ -2,7 +2,7 @@
version=$(cat "$__object/parameter/version")
kernel_name=$(cat "$__global/explorer/kernel_name" | tr '[:upper:]' '[:lower:]')
kernel_name=$(tr '[:upper:]' '[:lower:]' < "$__global/explorer/kernel_name")
machine=$(cat "$__global/explorer/machine")
case $machine in
x86_64|amd64)

View file

@ -19,7 +19,7 @@
#
# extract the keytype and base64 encoded key ignoring any options and comment
type_and_key="$(cat "$__object/parameter/key" | tr ' ' '\n' | awk '/^(ssh|ecdsa)-[^ ]+/ { printf $1" "; getline; printf $1 }')"
type_and_key="$(tr ' ' '\n' < "$__object/parameter/key"| awk '/^(ssh|ecdsa)-[^ ]+/ { printf $1" "; getline; printf $1 }')"
# If type_and_key is empty, which is the case with an invalid key, do not grep $file because it results
# in greping everything in file and all entries from file are removed.
if [ -n "${type_and_key}" ]

View file

@ -59,7 +59,7 @@ mkdir "$__object/files"
(
if [ -f "$__object/parameter/option" ]; then
# comma seperated list of options
options="$(cat "$__object/parameter/option" | tr '\n' ',')"
options="$(tr '\n' ',' < "$__object/parameter/option")"
printf '%s ' "${options%*,}"
fi
if [ -f "$__object/parameter/comment" ]; then

View file

@ -74,7 +74,7 @@ fetch_and_prepare_file() {
cat << DONE
verify_cksum() {
cksum_is="\$(cksum "$stage_file" | cut -d' ' -f1,2)"
cksum_should="$(cat "$__object/parameter/cksum" | cut -d' ' -f1,2)"
cksum_should="$(cut -d' ' -f1,2 "$__object/parameter/cksum")"
if [ "\$cksum_is" = "\$cksum_should" ]; then
return 0
else

View file

@ -46,7 +46,7 @@ exp_uri="$(cat "$__object/explorer/service_uri")"
exp_id="$(cat "$__object/explorer/service_id")"
# we need this list to remove ids, but we must do this in reverse order
exp_ids="$(cat "$__object/explorer/service_ids" | rev)"
exp_ids="$(rev "$__object/explorer/service_ids")"
if [ "$uri" = "$exp_uri" ] ; then
state_is="present"

View file

@ -47,7 +47,7 @@ fi
[ "$state_is" = "$state_should" ] && exit 0
# we need this list to remove ids, but we must do this in reverse order
exp_repos="$(cat "$__object/explorer/repo_ids" | rev)"
exp_repos="$(rev "$__object/explorer/repo_ids")"
# boolean parameter
if [ -f "$__object/parameter/remove-all-repos" ]; then