forked from ungleich-public/cdist
		
	Fix SC2002
This commit is contained in:
		
					parent
					
						
							
								3757e8c2c5
							
						
					
				
			
			
				commit
				
					
						44acfcdd12
					
				
			
		
					 10 changed files with 11 additions and 11 deletions
				
			
		|  | @ -30,9 +30,9 @@ case "$os" in | ||||||
| 
 | 
 | ||||||
|     *) |     *) | ||||||
|     if [ -r /proc/cpuinfo ]; then |     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 |         if [ ${sockets} -eq 0 ]; then | ||||||
|             sockets="$(cat /proc/cpuinfo | grep "processor" | wc -l)" |             sockets="$(grep -c "processor" /proc/cpuinfo)" | ||||||
|         fi |         fi | ||||||
|         echo "${sockets}" |         echo "${sockets}" | ||||||
|     fi |     fi | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ if [ -d "/proc/vz" -a ! -d "/proc/bc" ]; then | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| if [ -e "/proc/1/environ" ] && | 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 |     echo lxc | ||||||
|     exit |     exit | ||||||
| fi | fi | ||||||
|  |  | ||||||
|  | @ -22,7 +22,7 @@ name="$__object_id" | ||||||
| state="$(cat "$__object/parameter/state")" | state="$(cat "$__object/parameter/state")" | ||||||
| source="$(cat "$__object/parameter/source")" | source="$(cat "$__object/parameter/source")" | ||||||
| destination="$(cat "$__object/parameter/destination")" | destination="$(cat "$__object/parameter/destination")" | ||||||
| ccollectconf="$(cat "$__object/parameter/ccollectconf" | sed 's,/$,,')" | ccollectconf="$(sed 's,/$,,' "$__object/parameter/ccollectconf")" | ||||||
| 
 | 
 | ||||||
| sourcedir="$ccollectconf/sources" | sourcedir="$ccollectconf/sources" | ||||||
| basedir="$sourcedir/$name" | basedir="$sourcedir/$name" | ||||||
|  |  | ||||||
|  | @ -39,7 +39,7 @@ version_dir="$versions_dir/$version" | ||||||
| 
 | 
 | ||||||
| source=$(cat "$version_dir/source") | source=$(cat "$version_dir/source") | ||||||
| source_file_name="${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 | cat << eof | ||||||
|     tmpdir=\$(mktemp -d --tmpdir="/tmp" "${__type##*/}.XXXXXXXXXX") |     tmpdir=\$(mktemp -d --tmpdir="/tmp" "${__type##*/}.XXXXXXXXXX") | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| version=$(cat "$__object/parameter/version") | 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") | machine=$(cat "$__global/explorer/machine") | ||||||
| case $machine in | case $machine in | ||||||
| 	x86_64|amd64) | 	x86_64|amd64) | ||||||
|  |  | ||||||
|  | @ -19,7 +19,7 @@ | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| # extract the keytype and base64 encoded key ignoring any options and comment | # 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 | # 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. | # in greping everything in file and all entries from file are removed. | ||||||
| if [ -n "${type_and_key}" ] | if [ -n "${type_and_key}" ] | ||||||
|  |  | ||||||
|  | @ -59,7 +59,7 @@ mkdir "$__object/files" | ||||||
| ( | ( | ||||||
|    if [ -f "$__object/parameter/option" ]; then |    if [ -f "$__object/parameter/option" ]; then | ||||||
|       # comma seperated list of options |       # comma seperated list of options | ||||||
|       options="$(cat "$__object/parameter/option" | tr '\n' ',')" |       options="$(tr '\n' ',' < "$__object/parameter/option")" | ||||||
|       printf '%s ' "${options%*,}" |       printf '%s ' "${options%*,}" | ||||||
|    fi |    fi | ||||||
|    if [ -f "$__object/parameter/comment" ]; then |    if [ -f "$__object/parameter/comment" ]; then | ||||||
|  |  | ||||||
|  | @ -74,7 +74,7 @@ fetch_and_prepare_file() { | ||||||
| cat << DONE | cat << DONE | ||||||
| verify_cksum() { | verify_cksum() { | ||||||
|    cksum_is="\$(cksum "$stage_file" | cut -d' ' -f1,2)" |    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 |    if [ "\$cksum_is" = "\$cksum_should" ]; then | ||||||
|       return 0 |       return 0 | ||||||
|    else |    else | ||||||
|  |  | ||||||
|  | @ -46,7 +46,7 @@ exp_uri="$(cat "$__object/explorer/service_uri")" | ||||||
| exp_id="$(cat "$__object/explorer/service_id")" | exp_id="$(cat "$__object/explorer/service_id")" | ||||||
| 
 | 
 | ||||||
| # we need this list to remove ids, but we must do this in reverse order | # 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 | if [ "$uri" = "$exp_uri" ] ; then | ||||||
|     state_is="present" |     state_is="present" | ||||||
|  |  | ||||||
|  | @ -47,7 +47,7 @@ fi | ||||||
| [ "$state_is" = "$state_should" ] && exit 0 | [ "$state_is" = "$state_should" ] && exit 0 | ||||||
| 
 | 
 | ||||||
| # we need this list to remove ids, but we must do this in reverse order | # 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 | # boolean parameter | ||||||
| if [ -f "$__object/parameter/remove-all-repos" ]; then | if [ -f "$__object/parameter/remove-all-repos" ]; then | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue