Merge pull request #696 from thriqon/shellcheck-party-SC2086
Fix SC2086 on all scripts
This commit is contained in:
		
				commit
				
					
						49bb041330
					
				
			
		
					 68 changed files with 171 additions and 171 deletions
				
			
		|  | @ -31,7 +31,7 @@ case "$os" in | ||||||
|     *) |     *) | ||||||
|         if [ -r /proc/cpuinfo ]; then |         if [ -r /proc/cpuinfo ]; then | ||||||
|             cores="$(grep "core id" /proc/cpuinfo | sort | uniq | wc -l)" |             cores="$(grep "core id" /proc/cpuinfo | sort | uniq | wc -l)" | ||||||
|             if [ ${cores} -eq 0 ]; then |             if [ "${cores}" -eq 0 ]; then | ||||||
|                 cores="1" |                 cores="1" | ||||||
|             fi |             fi | ||||||
|             echo "$cores" |             echo "$cores" | ||||||
|  |  | ||||||
|  | @ -31,7 +31,7 @@ case "$os" in | ||||||
|     *) |     *) | ||||||
|     if [ -r /proc/cpuinfo ]; then |     if [ -r /proc/cpuinfo ]; then | ||||||
|         sockets="$(grep "physical id" /proc/cpuinfo | sort -u | wc -l)" |         sockets="$(grep "physical id" /proc/cpuinfo | sort -u | wc -l)" | ||||||
|         if [ ${sockets} -eq 0 ]; then |         if [ "${sockets}" -eq 0 ]; then | ||||||
|             sockets="$(grep -c "processor" /proc/cpuinfo)" |             sockets="$(grep -c "processor" /proc/cpuinfo)" | ||||||
|         fi |         fi | ||||||
|         echo "${sockets}" |         echo "${sockets}" | ||||||
|  |  | ||||||
|  | @ -20,7 +20,7 @@ | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| set +e | set +e | ||||||
| case "$($__explorer/os)" in | case "$("$__explorer/os")" in | ||||||
|    openwrt) |    openwrt) | ||||||
|       (. /etc/openwrt_release && echo "$DISTRIB_CODENAME") |       (. /etc/openwrt_release && echo "$DISTRIB_CODENAME") | ||||||
|    ;; |    ;; | ||||||
|  |  | ||||||
|  | @ -20,7 +20,7 @@ | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| set +e | set +e | ||||||
| case "$($__explorer/os)" in | case "$("$__explorer/os")" in | ||||||
|    openwrt) |    openwrt) | ||||||
|       (. /etc/openwrt_release && echo "$DISTRIB_DESCRIPTION") |       (. /etc/openwrt_release && echo "$DISTRIB_DESCRIPTION") | ||||||
|    ;; |    ;; | ||||||
|  |  | ||||||
|  | @ -20,7 +20,7 @@ | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| set +e | set +e | ||||||
| case "$($__explorer/os)" in | case "$("$__explorer/os")" in | ||||||
|    openwrt) |    openwrt) | ||||||
|       (. /etc/openwrt_release && echo "$DISTRIB_ID") |       (. /etc/openwrt_release && echo "$DISTRIB_ID") | ||||||
|    ;; |    ;; | ||||||
|  |  | ||||||
|  | @ -20,7 +20,7 @@ | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| set +e | set +e | ||||||
| case "$($__explorer/os)" in | case "$("$__explorer/os")" in | ||||||
|    openwrt) |    openwrt) | ||||||
|       (. /etc/openwrt_release && echo "$DISTRIB_RELEASE") |       (. /etc/openwrt_release && echo "$DISTRIB_RELEASE") | ||||||
|    ;; |    ;; | ||||||
|  |  | ||||||
|  | @ -22,7 +22,7 @@ | ||||||
| # | # | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| case "$($__explorer/os)" in | case "$("$__explorer/os")" in | ||||||
|    amazon) |    amazon) | ||||||
|       cat /etc/system-release |       cat /etc/system-release | ||||||
|    ;; |    ;; | ||||||
|  |  | ||||||
|  | @ -29,9 +29,9 @@ fi | ||||||
| 
 | 
 | ||||||
| case "$state_should" in | case "$state_should" in | ||||||
|    present) |    present) | ||||||
|       echo add-apt-repository \"$name\" |       echo "add-apt-repository '$name'" | ||||||
|    ;; |    ;; | ||||||
|    absent) |    absent) | ||||||
|       echo remove-apt-repository \"$name\" |       echo "remove-apt-repository '$name'" | ||||||
|    ;; |    ;; | ||||||
| esac | esac | ||||||
|  |  | ||||||
|  | @ -42,18 +42,18 @@ get_current_value() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| set_group() { | set_group() { | ||||||
|     echo chgrp \"$1\" \"$destination\" |     echo "chgrp '$1' '$destination'" | ||||||
|     echo chgrp $1 >> "$__messages_out" |     echo "chgrp '$1'" >> "$__messages_out" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| set_owner() { | set_owner() { | ||||||
|     echo chown \"$1\" \"$destination\" |     echo "chown '$1' '$destination'" | ||||||
|     echo chown $1 >> "$__messages_out" |     echo "chown '$1'" >> "$__messages_out" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| set_mode() { | set_mode() { | ||||||
|    echo chmod \"$1\" \"$destination\" |    echo "chmod '$1' '$destination'" | ||||||
|    echo chmod $1 >> "$__messages_out" |    echo "chmod '$1'" >> "$__messages_out" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| case "$state_should" in | case "$state_should" in | ||||||
|  | @ -66,7 +66,7 @@ case "$state_should" in | ||||||
| 
 | 
 | ||||||
|             # change 0xxx format to xxx format => same as stat returns |             # change 0xxx format to xxx format => same as stat returns | ||||||
|             if [ "$attribute" = mode ]; then |             if [ "$attribute" = mode ]; then | ||||||
|                 value_should="$(echo $value_should | sed 's/^0\(...\)/\1/')" |                 value_should="$(echo "$value_should" | sed 's/^0\(...\)/\1/')" | ||||||
|             fi |             fi | ||||||
|              |              | ||||||
|             value_is="$(get_current_value "$attribute" "$value_should")" |             value_is="$(get_current_value "$attribute" "$value_should")" | ||||||
|  | @ -80,7 +80,7 @@ case "$state_should" in | ||||||
| 
 | 
 | ||||||
|     absent) |     absent) | ||||||
|         if [ "$type" = "file" ]; then |         if [ "$type" = "file" ]; then | ||||||
|             echo rm -f \"$destination\" |             echo "rm -f '$destination'" | ||||||
|             echo remove >> "$__messages_out" |             echo remove >> "$__messages_out" | ||||||
|         fi |         fi | ||||||
|     ;; |     ;; | ||||||
|  |  | ||||||
|  | @ -55,5 +55,5 @@ if [ -f "$__object/parameter/exclude" ]; then | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| if [ -f "$__object/parameter/create-destination" ]; then | if [ -f "$__object/parameter/create-destination" ]; then | ||||||
|     __directory "${destination}" --parents --state ${state} |     __directory "${destination}" --parents --state "${state}" | ||||||
| fi | fi | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ user="$(cat "$__object/parameter/user")" | ||||||
| 
 | 
 | ||||||
| if [ -f "$__object/parameter/raw_command" ]; then | if [ -f "$__object/parameter/raw_command" ]; then | ||||||
|     command="$(cat "$__object/parameter/command")" |     command="$(cat "$__object/parameter/command")" | ||||||
|     crontab -u $user -l 2>/dev/null | grep "^$command\$" || true |     crontab -u "$user" -l 2>/dev/null | grep "^$command\$" || true | ||||||
| else | else | ||||||
|     crontab -u $user -l 2>/dev/null | grep "# $name\$" || true |     crontab -u "$user" -l 2>/dev/null | grep "# $name\$" || true | ||||||
| fi | fi | ||||||
|  |  | ||||||
|  | @ -3,8 +3,8 @@ | ||||||
| pkg=$(cat "$__object/parameter/from-package") | pkg=$(cat "$__object/parameter/from-package") | ||||||
| servicedir=$(cat "$__object/parameter/servicedir") | servicedir=$(cat "$__object/parameter/servicedir") | ||||||
| 
 | 
 | ||||||
| __package $pkg | __package "$pkg" | ||||||
| __directory $servicedir --mode 700 | __directory "$servicedir" --mode 700 | ||||||
| 
 | 
 | ||||||
| os=$(cat "$__global/explorer/os") | os=$(cat "$__global/explorer/os") | ||||||
| init=$(cat "$__global/explorer/init") | init=$(cat "$__global/explorer/init") | ||||||
|  |  | ||||||
|  | @ -25,14 +25,14 @@ badusage() { | ||||||
| [ -z "$run$runfile" ] && badusage | [ -z "$run$runfile" ] && badusage | ||||||
| [ -n "$run" ] && [ -n "$runfile" ] && badusage | [ -n "$run" ] && [ -n "$runfile" ] && badusage | ||||||
| 
 | 
 | ||||||
| __directory $servicedir/$name/log/main --parents | __directory "$servicedir/$name/log/main" --parents | ||||||
| 
 | 
 | ||||||
| echo "$RUN_PREFIX$run" | require="__directory/$servicedir/$name/log/main" __config_file "$servicedir/$name/run" \ | echo "$RUN_PREFIX$run" | require="__directory/$servicedir/$name/log/main" __config_file "$servicedir/$name/run" \ | ||||||
| 	--onchange "svc -t '$servicedir/$name' 2>/dev/null" \ | 	--onchange "svc -t '$servicedir/$name' 2>/dev/null" \ | ||||||
| 	--mode 755 \ | 	--mode 755 \ | ||||||
| 	--source "${runfile:--}" | 	--source "${runfile:--}" | ||||||
| 
 | 
 | ||||||
| echo "$RUN_PREFIX$logrun" | require="__directory/$servicedir/$name/log/main" __config_file $servicedir/$name/log/run \ | echo "$RUN_PREFIX$logrun" | require="__directory/$servicedir/$name/log/main" __config_file "$servicedir/$name/log/run" \ | ||||||
| 	--onchange "svc -t '$servicedir/$name/log' 2>/dev/null" \ | 	--onchange "svc -t '$servicedir/$name/log' 2>/dev/null" \ | ||||||
| 	--mode 755 \ | 	--mode 755 \ | ||||||
| 	--source "-" | 	--source "-" | ||||||
|  |  | ||||||
|  | @ -57,18 +57,18 @@ get_current_value() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| set_group() { | set_group() { | ||||||
|     echo chgrp $recursive \"$1\" \"$destination\" |     echo "chgrp $recursive '$1' '$destination'" | ||||||
|     echo chgrp $recursive $1 >> "$__messages_out" |     echo "chgrp $recursive '$1'" >> "$__messages_out" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| set_owner() { | set_owner() { | ||||||
|     echo chown $recursive \"$1\" \"$destination\" |     echo "chown $recursive '$1' '$destination'" | ||||||
|     echo chown $recursive $1 >> "$__messages_out" |     echo "chown $recursive '$1'" >> "$__messages_out" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| set_mode() { | set_mode() { | ||||||
|     echo chmod $recursive \"$1\" \"$destination\" |     echo "chmod $recursive '$1' '$destination'" | ||||||
|     echo chmod $recursive $1 >> "$__messages_out" |     echo "chmod $recursive '$1'" >> "$__messages_out" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| case "$state_should" in | case "$state_should" in | ||||||
|  | @ -78,10 +78,10 @@ case "$state_should" in | ||||||
|          if [ "$type" != "none" ]; then |          if [ "$type" != "none" ]; then | ||||||
|             # our destination is not a directory, remove whatever is there |             # our destination is not a directory, remove whatever is there | ||||||
|             # and then create our directory and set all attributes |             # and then create our directory and set all attributes | ||||||
|             echo rm -f "\"$destination\"" |             echo "rm -f '$destination'" | ||||||
|             echo "remove non directory" >> "$__messages_out" |             echo "remove non directory" >> "$__messages_out" | ||||||
|          fi |          fi | ||||||
|          echo "mkdir $mkdiropt \"$destination\"" |          echo "mkdir $mkdiropt '$destination'" | ||||||
|          echo "create" >> "$__messages_out" |          echo "create" >> "$__messages_out" | ||||||
|       fi |       fi | ||||||
| 
 | 
 | ||||||
|  | @ -94,7 +94,7 @@ case "$state_should" in | ||||||
| 
 | 
 | ||||||
|             # change 0xxx format to xxx format => same as stat returns |             # change 0xxx format to xxx format => same as stat returns | ||||||
|             if [ "$attribute" = mode ]; then |             if [ "$attribute" = mode ]; then | ||||||
|                 value_should="$(echo $value_should | sed 's/^0\(...\)/\1/')" |                 value_should="$(echo "$value_should" | sed 's/^0\(...\)/\1/')" | ||||||
|             fi |             fi | ||||||
| 
 | 
 | ||||||
|             if [ "$set_attributes" = 1 ] || [ "$value_should" != "$value_is" ]; then |             if [ "$set_attributes" = 1 ] || [ "$value_should" != "$value_is" ]; then | ||||||
|  | @ -105,7 +105,7 @@ case "$state_should" in | ||||||
|    ;; |    ;; | ||||||
|    absent) |    absent) | ||||||
|         if [ "$type" = "directory" ]; then |         if [ "$type" = "directory" ]; then | ||||||
|             echo rm -rf \"$destination\" |             echo "rm -rf '$destination'" | ||||||
|             echo remove >> "$__messages_out" |             echo remove >> "$__messages_out" | ||||||
|         fi |         fi | ||||||
|    ;; |    ;; | ||||||
|  |  | ||||||
|  | @ -31,8 +31,8 @@ case "$os" in | ||||||
|             --enabled \ |             --enabled \ | ||||||
|             --gpgcheck 1 \ |             --gpgcheck 1 \ | ||||||
|             --gpgkey 'https://download.docker.com/linux/centos/gpg' \ |             --gpgkey 'https://download.docker.com/linux/centos/gpg' \ | ||||||
|             --state ${state} |             --state "${state}" | ||||||
|           require="__yum_repo/docker-ce-stable" __package docker-ce --state ${state} |           require="__yum_repo/docker-ce-stable" __package docker-ce --state "${state}" | ||||||
|         else |         else | ||||||
|           echo "CentOS version 7 is required!" >&2 |           echo "CentOS version 7 is required!" >&2 | ||||||
|           exit 1 |           exit 1 | ||||||
|  | @ -45,14 +45,14 @@ case "$os" in | ||||||
|         __package gnupg2 |         __package gnupg2 | ||||||
|       fi |       fi | ||||||
|       __apt_key_uri docker --name "Docker Release (CE deb) <docker@docker.com>" \ |       __apt_key_uri docker --name "Docker Release (CE deb) <docker@docker.com>" \ | ||||||
|         --uri "https://download.docker.com/linux/${os}/gpg" --state ${state} |         --uri "https://download.docker.com/linux/${os}/gpg" --state "${state}" | ||||||
|       export CDIST_ORDER_DEPENDENCY=on |       export CDIST_ORDER_DEPENDENCY=on | ||||||
|       __apt_source docker \ |       __apt_source docker \ | ||||||
|          --uri "https://download.docker.com/linux/${os}" \ |          --uri "https://download.docker.com/linux/${os}" \ | ||||||
|          --distribution "$(cat "$__global/explorer/lsb_codename")" \ |          --distribution "$(cat "$__global/explorer/lsb_codename")" \ | ||||||
|          --state ${state} \ |          --state "${state}" \ | ||||||
|          --component "stable" |          --component "stable" | ||||||
|       __package docker-ce --state ${state} |       __package docker-ce --state "${state}" | ||||||
|       unset CDIST_ORDER_DEPENDENCY |       unset CDIST_ORDER_DEPENDENCY | ||||||
|    ;; |    ;; | ||||||
|    *) |    *) | ||||||
|  |  | ||||||
|  | @ -22,9 +22,9 @@ | ||||||
| version="$(cat "$__object/parameter/version")" | version="$(cat "$__object/parameter/version")" | ||||||
| state="$(cat "$__object/parameter/state")" | state="$(cat "$__object/parameter/state")" | ||||||
| 
 | 
 | ||||||
| if [ ${state} = "present" ]; then | if [ "${state}" = "present" ]; then | ||||||
|     # Download docker-compose file |     # 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 '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 'mv /tmp/docker-compose /usr/local/bin/docker-compose' | ||||||
|     # Change permissions |     # Change permissions | ||||||
|     echo 'chmod +x /usr/local/bin/docker-compose' |     echo 'chmod +x /usr/local/bin/docker-compose' | ||||||
|  |  | ||||||
|  | @ -22,10 +22,10 @@ | ||||||
| state="$(cat "$__object/parameter/state")" | state="$(cat "$__object/parameter/state")" | ||||||
| 
 | 
 | ||||||
| # Needed packages | # Needed packages | ||||||
| if [ ${state} = "present" ]; then | if [ "${state}" = "present" ]; then | ||||||
|     __docker |     __docker | ||||||
|     __package curl |     __package curl | ||||||
| elif [ ${state} = "absent" ]; then | elif [ "${state}" = "absent" ]; then | ||||||
|     __file /usr/local/bin/docker-compose --state absent |     __file /usr/local/bin/docker-compose --state absent | ||||||
| else | else | ||||||
|     echo "Unknown state: ${state}" >&2 |     echo "Unknown state: ${state}" >&2 | ||||||
|  |  | ||||||
|  | @ -43,18 +43,18 @@ get_current_value() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| set_group() { | set_group() { | ||||||
|     echo chgrp \"$1\" \"$destination\" |     echo "chgrp '$1' '$destination'" | ||||||
|     echo chgrp $1 >> "$__messages_out" |     echo "chgrp '$1'" >> "$__messages_out" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| set_owner() { | set_owner() { | ||||||
|     echo chown \"$1\" \"$destination\" |     echo "chown '$1' '$destination'" | ||||||
|     echo chown $1 >> "$__messages_out" |     echo "chown '$1'" >> "$__messages_out" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| set_mode() { | set_mode() { | ||||||
|    echo chmod \"$1\" \"$destination\" |    echo "chmod '$1' '$destination'" | ||||||
|    echo chmod $1 >> "$__messages_out" |    echo "chmod '$1'" >> "$__messages_out" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| case "$state_should" in | case "$state_should" in | ||||||
|  | @ -67,7 +67,7 @@ case "$state_should" in | ||||||
| 
 | 
 | ||||||
|             # change 0xxx format to xxx format => same as stat returns |             # change 0xxx format to xxx format => same as stat returns | ||||||
|             if [ "$attribute" = mode ]; then |             if [ "$attribute" = mode ]; then | ||||||
|                 value_should="$(echo $value_should | sed 's/^0\(...\)/\1/')" |                 value_should="$(echo "$value_should" | sed 's/^0\(...\)/\1/')" | ||||||
|             fi |             fi | ||||||
|              |              | ||||||
|             value_is="$(get_current_value "$attribute" "$value_should")" |             value_is="$(get_current_value "$attribute" "$value_should")" | ||||||
|  | @ -81,7 +81,7 @@ case "$state_should" in | ||||||
| 
 | 
 | ||||||
|     absent) |     absent) | ||||||
|         if [ "$type" = "file" ]; then |         if [ "$type" = "file" ]; then | ||||||
|             echo rm -f \"$destination\" |             echo "rm -f '$destination'" | ||||||
|             echo remove >> "$__messages_out" |             echo remove >> "$__messages_out" | ||||||
|         fi |         fi | ||||||
|     ;; |     ;; | ||||||
|  |  | ||||||
|  | @ -25,7 +25,7 @@ chain="$(cat "$__object/parameter/chain")" | ||||||
| priority="$(cat "$__object/parameter/priority")" | priority="$(cat "$__object/parameter/priority")" | ||||||
| rule="$(cat "$__object/parameter/rule")" | rule="$(cat "$__object/parameter/rule")" | ||||||
| 
 | 
 | ||||||
| if firewall-cmd --permanent --direct --query-rule "$protocol" "$table" "$chain" "$priority" $rule >/dev/null; then | if firewall-cmd --permanent --direct --query-rule "$protocol" "$table" "$chain" "$priority" "$rule" >/dev/null; then | ||||||
|     echo present |     echo present | ||||||
| else | else | ||||||
|     echo absent |     echo absent | ||||||
|  |  | ||||||
|  | @ -32,13 +32,13 @@ rule="$(cat "$__object/parameter/rule")" | ||||||
| 
 | 
 | ||||||
| case "$state_should" in | case "$state_should" in | ||||||
|     present) |     present) | ||||||
|         echo firewall-cmd --quiet --permanent --direct --add-rule \"$protocol\" \"$table\" \"$chain\" \"$priority\" $rule |         echo "firewall-cmd --quiet --permanent --direct --add-rule '$protocol' '$table' '$chain' '$priority' $rule" | ||||||
|         echo firewall-cmd --quiet --direct --add-rule \"$protocol\" \"$table\" \"$chain\" \"$priority\" $rule |         echo "firewall-cmd --quiet --direct --add-rule '$protocol' '$table' '$chain' '$priority' $rule" | ||||||
|     ;; |     ;; | ||||||
| 
 | 
 | ||||||
|     absent) |     absent) | ||||||
|         echo firewall-cmd --quiet --permanent --direct --remove-rule \"$protocol\" \"$table\" \"$chain\" \"$priority\" $rule |         echo "firewall-cmd --quiet --permanent --direct --remove-rule '$protocol' '$table' '$chain' '$priority' $rule" | ||||||
|         echo firewall-cmd --quiet --direct --remove-rule \"$protocol\" \"$table\" \"$chain\" \"$priority\" $rule |         echo "firewall-cmd --quiet --direct --remove-rule '$protocol' '$table' '$chain' '$priority' $rule" | ||||||
|     ;; |     ;; | ||||||
|     *) |     *) | ||||||
|         echo "Unknown state $state_should" >&2 |         echo "Unknown state $state_should" >&2 | ||||||
|  |  | ||||||
|  | @ -2,4 +2,4 @@ | ||||||
| 
 | 
 | ||||||
| destination="/$__object_id/.git" | destination="/$__object_id/.git" | ||||||
| 
 | 
 | ||||||
| stat --print "%G" ${destination} 2>/dev/null || exit 0 | stat --print "%G" "${destination}" 2>/dev/null || exit 0 | ||||||
|  |  | ||||||
|  | @ -2,4 +2,4 @@ | ||||||
| 
 | 
 | ||||||
| destination="/$__object_id/.git" | destination="/$__object_id/.git" | ||||||
| 
 | 
 | ||||||
| stat --print "%U" ${destination} 2>/dev/null || exit 0 | stat --print "%U" "${destination}" 2>/dev/null || exit 0 | ||||||
|  |  | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| #!/bin/sh -e | #!/bin/sh -e | ||||||
| 
 | 
 | ||||||
| os=$(cat $__global/explorer/os) | os=$(cat "$__global/explorer/os") | ||||||
| os_version=$(cat $__global/explorer/os_version) | os_version=$(cat "$__global/explorer/os_version") | ||||||
| 
 | 
 | ||||||
| case $os in | case $os in | ||||||
|     debian|devuan) |     debian|devuan) | ||||||
|  |  | ||||||
|  | @ -22,7 +22,7 @@ | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| name=$__object_id | name=$__object_id | ||||||
| os="$($__explorer/os)" | os="$("$__explorer/os")" | ||||||
| 
 | 
 | ||||||
| case "$os" in | case "$os" in | ||||||
|     "freebsd"|"netbsd") |     "freebsd"|"netbsd") | ||||||
|  |  | ||||||
|  | @ -61,8 +61,8 @@ if [ "$state" = "present" ]; then | ||||||
|                ;; |                ;; | ||||||
|             esac |             esac | ||||||
|             if [ "$new_value" != "$current_value" ]; then |             if [ "$new_value" != "$current_value" ]; then | ||||||
|                set -- "$@" "$(shorten_property $property)" \'$new_value\' |                set -- "$@" "$(shorten_property "$property")" \'"$new_value"\' | ||||||
|                echo change $property $new_value $current_value >> "$__messages_out" |                echo "change $property $new_value $current_value" >> "$__messages_out" | ||||||
|             fi |             fi | ||||||
|          fi |          fi | ||||||
|       done |       done | ||||||
|  | @ -81,9 +81,9 @@ if [ "$state" = "present" ]; then | ||||||
|             new_value="$(cat "$__object/parameter/$property")" |             new_value="$(cat "$__object/parameter/$property")" | ||||||
|             if [ -z "$new_value" ]; then |             if [ -z "$new_value" ]; then | ||||||
|                # Boolean parameters have no value |                # Boolean parameters have no value | ||||||
|                set -- "$@" "$(shorten_property $property)" |                set -- "$@" "$(shorten_property "$property")" | ||||||
|             else |             else | ||||||
|                set -- "$@" "$(shorten_property $property)" \'$new_value\' |                set -- "$@" "$(shorten_property "$property")" \'"$new_value"\' | ||||||
|             fi |             fi | ||||||
|          fi |          fi | ||||||
|       done |       done | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ install_script="$__object/files/install_script" | ||||||
| # Link file descriptor #6 with stdout | # Link file descriptor #6 with stdout | ||||||
| exec 6>&1 | exec 6>&1 | ||||||
| # Link stdout with $install_script | # Link stdout with $install_script | ||||||
| exec > $install_script | exec > "$install_script" | ||||||
| 
 | 
 | ||||||
| # Generate script to install bootloader on distro | # Generate script to install bootloader on distro | ||||||
| printf '#!/bin/sh -l\n' | printf '#!/bin/sh -l\n' | ||||||
|  |  | ||||||
|  | @ -23,7 +23,7 @@ cat "$__type/files/fstab.header" > "$destination" | ||||||
| 
 | 
 | ||||||
| mkdir "$__object/files" | mkdir "$__object/files" | ||||||
| # get current UUID's from target_host | # get current UUID's from target_host | ||||||
| $__remote_exec $__target_host blkid > "$__object/files/blkid" | $__remote_exec "$__target_host" blkid > "$__object/files/blkid" | ||||||
| 
 | 
 | ||||||
| for object in $(find "$__global/object/__install_mount" -type d -name "$__cdist_object_marker"); do | for object in $(find "$__global/object/__install_mount" -type d -name "$__cdist_object_marker"); do | ||||||
|    device="$(cat "$object/parameter/device")" |    device="$(cat "$object/parameter/device")" | ||||||
|  | @ -53,7 +53,7 @@ for object in $(find "$__global/object/__install_mount" -type d -name "$__cdist_ | ||||||
|       ;; |       ;; | ||||||
|    esac |    esac | ||||||
|    if [ -f "$__object/parameter/uuid" ]; then |    if [ -f "$__object/parameter/uuid" ]; then | ||||||
|       uuid="$(grep -w $device "$__object/files/blkid" | awk '{print $2}')" |       uuid="$(grep -w "$device" "$__object/files/blkid" | awk '{print $2}')" | ||||||
|       if [ -n "$uuid" ]; then |       if [ -n "$uuid" ]; then | ||||||
|          echo "# $dir was on $device during installation" >> "$destination" |          echo "# $dir was on $device during installation" >> "$destination" | ||||||
|          device="$uuid" |          device="$uuid" | ||||||
|  |  | ||||||
|  | @ -34,9 +34,9 @@ size_to_mb() { | ||||||
|    size=$1 |    size=$1 | ||||||
|    available_size="$2" |    available_size="$2" | ||||||
| 
 | 
 | ||||||
|    number_suffix="$(echo ${size} | sed -e 's:\.[0-9]\+::' -e 's:\([0-9]\+\)\([KkMmGg%]\)[Bb]\?:\1|\2:')" |    number_suffix="$(echo "${size}" | sed -e 's:\.[0-9]\+::' -e 's:\([0-9]\+\)\([KkMmGg%]\)[Bb]\?:\1|\2:')" | ||||||
|    number="$(echo ${number_suffix} | cut -d '|' -f1)" |    number="$(echo "${number_suffix}" | cut -d '|' -f1)" | ||||||
|    suffix="$(echo ${number_suffix} | cut -d '|' -f2)" |    suffix="$(echo "${number_suffix}" | cut -d '|' -f2)" | ||||||
| 
 | 
 | ||||||
|    case "$suffix" in |    case "$suffix" in | ||||||
|       K|k) |       K|k) | ||||||
|  | @ -62,10 +62,10 @@ get_objects() { | ||||||
|    for object in $(find "$__global/object/__install_partition_msdos" -type d -name "$__cdist_object_marker"); do |    for object in $(find "$__global/object/__install_partition_msdos" -type d -name "$__cdist_object_marker"); do | ||||||
|       object_device="$(cat "$object/parameter/device")" |       object_device="$(cat "$object/parameter/device")" | ||||||
|       object_minor="$(cat "$object/parameter/minor")" |       object_minor="$(cat "$object/parameter/minor")" | ||||||
|       echo "$object_device $object_minor $object" >> $objects_file |       echo "$object_device $object_minor $object" >> "$objects_file" | ||||||
|    done |    done | ||||||
|    sort -k 1,2 $objects_file | cut -d' ' -f 3 |    sort -k 1,2 "$objects_file" | cut -d' ' -f 3 | ||||||
|    rm $objects_file |    rm "$objects_file" | ||||||
|    unset objects_file |    unset objects_file | ||||||
|    unset object |    unset object | ||||||
|    unset object_device |    unset object_device | ||||||
|  | @ -85,9 +85,9 @@ primary_count=0 | ||||||
| for object in $objects; do | for object in $objects; do | ||||||
|    device="$(cat "$object/parameter/device")" |    device="$(cat "$object/parameter/device")" | ||||||
|    if [ "$current_device" != "$device" ]; then |    if [ "$current_device" != "$device" ]; then | ||||||
|       echo "create_disklabel \"$device\" || die 'Failed to create disklabel for $device'" |       echo "create_disklabel '$device' || die 'Failed to create disklabel for $device'" | ||||||
|       current_device="$device" |       current_device="$device" | ||||||
|       device_name=$(echo ${device} | sed -e 's:^/dev/::;s:/:\\/:g') |       device_name=$(echo "${device}" | sed -e 's:^/dev/::;s:/:\\/:g') | ||||||
|       available_device_size=$(( $(awk "/${device_name}\$/ { print \$3; }" "$partitions") / 1024)) |       available_device_size=$(( $(awk "/${device_name}\$/ { print \$3; }" "$partitions") / 1024)) | ||||||
|       # make sure we don't go past the end of the drive |       # make sure we don't go past the end of the drive | ||||||
|       available_device_size=$((available_device_size - 2)) |       available_device_size=$((available_device_size - 2)) | ||||||
|  |  | ||||||
|  | @ -35,7 +35,7 @@ fi | ||||||
| 
 | 
 | ||||||
| jaildir="$(cat "$__object/parameter/jaildir")" | jaildir="$(cat "$__object/parameter/jaildir")" | ||||||
| 
 | 
 | ||||||
| __directory ${jaildir} --parents | __directory "${jaildir}" --parents | ||||||
| 
 | 
 | ||||||
| set -- "$@" "$__object_id" "--state" "$state" | set -- "$@" "$__object_id" "--state" "$state" | ||||||
| cd "$__object/parameter" | cd "$__object/parameter" | ||||||
|  |  | ||||||
|  | @ -32,7 +32,7 @@ elif [ -f "$destination" ]; then | ||||||
|    case "$type" in |    case "$type" in | ||||||
|       hard) |       hard) | ||||||
|          link_count=$(ls -l "$destination" | awk '{ print $2 }') |          link_count=$(ls -l "$destination" | awk '{ print $2 }') | ||||||
|          if [ $link_count -gt 1 ]; then |          if [ "$link_count" -gt 1 ]; then | ||||||
|             echo hardlink |             echo hardlink | ||||||
|             exit 0 |             exit 0 | ||||||
|          fi |          fi | ||||||
|  |  | ||||||
|  | @ -21,7 +21,7 @@ | ||||||
| # Retrieve the status of a package - parsed dpkg output | # Retrieve the status of a package - parsed dpkg output | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| if [ "$($__explorer/os)" = "freebsd" ]; then | if [ "$("$__explorer/os")" = "freebsd" ]; then | ||||||
|    command -v pkg |    command -v pkg | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -77,11 +77,11 @@ case "$state_should" in | ||||||
|         if [ -n "$version" ]; then |         if [ -n "$version" ]; then | ||||||
|             name="${name}=${version}" |             name="${name}=${version}" | ||||||
|         fi |         fi | ||||||
|         echo "$aptget install $target_release \"$name\"" |         echo "$aptget install $target_release '$name'" | ||||||
|         echo "installed" >> "$__messages_out" |         echo "installed" >> "$__messages_out" | ||||||
|     ;; |     ;; | ||||||
|     absent) |     absent) | ||||||
|         echo "$aptget remove $purgeparam \"$name\"" |         echo "$aptget remove $purgeparam '$name'" | ||||||
|         echo "removed" >> "$__messages_out" |         echo "removed" >> "$__messages_out" | ||||||
|     ;; |     ;; | ||||||
|     *) |     *) | ||||||
|  |  | ||||||
|  | @ -63,10 +63,10 @@ fi | ||||||
| 
 | 
 | ||||||
| case "$state_should" in | case "$state_should" in | ||||||
|    present) |    present) | ||||||
|         echo "emerge \"$name\" &>/dev/null || exit 1" |         echo "emerge '$name' &>/dev/null || exit 1" | ||||||
|         ;; |         ;; | ||||||
|    absent) |    absent) | ||||||
|         echo "emerge -C \"$name\" &>/dev/null || exit 1" |         echo "emerge -C '$name' &>/dev/null || exit 1" | ||||||
|         ;; |         ;; | ||||||
|    *) |    *) | ||||||
|         echo "Unknown state: $state_should" >&2 |         echo "Unknown state: $state_should" >&2 | ||||||
|  |  | ||||||
|  | @ -42,10 +42,10 @@ fi | ||||||
| 
 | 
 | ||||||
| case "$state_should" in | case "$state_should" in | ||||||
|     present) |     present) | ||||||
|         echo luarocks install \"$name\" |         echo "luarocks install '$name'" | ||||||
|     ;; |     ;; | ||||||
|     absent) |     absent) | ||||||
|         echo luarocks remove \"$name\" |         echo "luarocks remove '$name'" | ||||||
|     ;; |     ;; | ||||||
|     *) |     *) | ||||||
|         echo "Unknown state: $state_should" >&2 |         echo "Unknown state: $state_should" >&2 | ||||||
|  |  | ||||||
|  | @ -45,10 +45,10 @@ case "$state_should" in | ||||||
|         if [ "$present" = "notpresent" ]; then |         if [ "$present" = "notpresent" ]; then | ||||||
|             echo opkg --verbosity=0 update |             echo opkg --verbosity=0 update | ||||||
|         fi |         fi | ||||||
|         echo opkg --verbosity=0 install \"$name\" |         echo "opkg --verbosity=0 install '$name'" | ||||||
|     ;; |     ;; | ||||||
|     absent) |     absent) | ||||||
|         echo opkg --verbosity=0 remove \"$name\" |         echo "opkg --verbosity=0 remove '$name'" | ||||||
|     ;; |     ;; | ||||||
|     *) |     *) | ||||||
|         echo "Unknown state: $state" >&2 |         echo "Unknown state: $state" >&2 | ||||||
|  |  | ||||||
|  | @ -45,10 +45,10 @@ fi | ||||||
| 
 | 
 | ||||||
| case "$state_should" in | case "$state_should" in | ||||||
|    present) |    present) | ||||||
|          echo pacman --needed --noconfirm --noprogressbar -S \"$name\" |          echo "pacman --needed --noconfirm --noprogressbar -S '$name'" | ||||||
|    ;; |    ;; | ||||||
|    absent) |    absent) | ||||||
|          echo pacman --noconfirm --noprogressbar -R \"$name\" |          echo "pacman --noconfirm --noprogressbar -R '$name'" | ||||||
|    ;; |    ;; | ||||||
|    *) |    *) | ||||||
|       echo "Unknown state: $state_should" >&2 |       echo "Unknown state: $state_should" >&2 | ||||||
|  |  | ||||||
|  | @ -53,7 +53,7 @@ case "$state_should" in | ||||||
|     present) |     present) | ||||||
|         if [ "$runas" ] |         if [ "$runas" ] | ||||||
|         then |         then | ||||||
|             echo "su -c \"$pip install -q $name\" $runas" |             echo "su -c '$pip install -q $name' $runas" | ||||||
|         else |         else | ||||||
|             echo $pip install -q "$name" |             echo $pip install -q "$name" | ||||||
|         fi |         fi | ||||||
|  | @ -61,7 +61,7 @@ case "$state_should" in | ||||||
|     absent) |     absent) | ||||||
|         if [ "$runas" ] |         if [ "$runas" ] | ||||||
|         then |         then | ||||||
|             echo "su -c \"$pip uninstall -q -y $name\" $runas" |             echo "su -c '$pip uninstall -q -y $name' $runas" | ||||||
|         else |         else | ||||||
|             echo $pip uninstall -q -y "$name" |             echo $pip uninstall -q -y "$name" | ||||||
|         fi |         fi | ||||||
|  |  | ||||||
|  | @ -33,7 +33,7 @@ assert ()                 #  If condition false, | ||||||
| 
 | 
 | ||||||
| 	lineno=$2 | 	lineno=$2 | ||||||
| 
 | 
 | ||||||
| 	if [ ! $1 ]  | 	if [ ! "$1" ] | ||||||
| 	then | 	then | ||||||
| 		echo "Assertion failed:  \"$1\"" | 		echo "Assertion failed:  \"$1\"" | ||||||
| 		echo "File \"$0\", line $lineno, called by $(caller 0)" | 		echo "File \"$0\", line $lineno, called by $(caller 0)" | ||||||
|  |  | ||||||
|  | @ -39,10 +39,10 @@ fi | ||||||
| 
 | 
 | ||||||
| case "$state_should" in | case "$state_should" in | ||||||
|     present) |     present) | ||||||
|         echo gem install \"$name\" --no-ri --no-rdoc |         echo "gem install '$name' --no-ri --no-rdoc" | ||||||
|     ;; |     ;; | ||||||
|     absent) |     absent) | ||||||
|         echo gem uninstall \"$name\" |         echo "gem uninstall '$name'" | ||||||
|     ;; |     ;; | ||||||
|     *) |     *) | ||||||
|         echo "Unknown state: $state_should" >&2 |         echo "Unknown state: $state_should" >&2 | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ | ||||||
| # You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | ||||||
| # along with cdist. If not, see <http://www.gnu.org/licenses/>. | # along with cdist. If not, see <http://www.gnu.org/licenses/>. | ||||||
| 
 | 
 | ||||||
| type="$($__type_explorer/type)" | type="$("$__type_explorer/type")" | ||||||
| 
 | 
 | ||||||
| case "$type" in | case "$type" in | ||||||
|     apt) |     apt) | ||||||
|  |  | ||||||
|  | @ -21,7 +21,7 @@ if [ -f "$__object/parameter/type" ]; then | ||||||
|     cat "$__object/parameter/type" |     cat "$__object/parameter/type" | ||||||
| else | else | ||||||
|     # By default determine package manager based on operating system |     # By default determine package manager based on operating system | ||||||
|     os="$($__explorer/os)" |     os="$("$__explorer/os")" | ||||||
|     case "$os" in |     case "$os" in | ||||||
|         amazon|scientific|centos|fedora|redhat) echo "yum" ;; |         amazon|scientific|centos|fedora|redhat) echo "yum" ;; | ||||||
|         debian|ubuntu|devuan) echo "apt" ;; |         debian|ubuntu|devuan) echo "apt" ;; | ||||||
|  |  | ||||||
|  | @ -31,7 +31,7 @@ if [ -n "$maxage" ]; then | ||||||
|     if [ "$type" != "apt" ] && [ "$type" != "pacman" ]; then |     if [ "$type" != "apt" ] && [ "$type" != "pacman" ]; then | ||||||
|         echo "ERROR: \"--maxage\" only supported for \"apt\" or \"pacman\" pkg-manager." >&2 |         echo "ERROR: \"--maxage\" only supported for \"apt\" or \"pacman\" pkg-manager." >&2 | ||||||
|         exit 1 |         exit 1 | ||||||
|     elif [ $currage -lt $maxage ]; then |     elif [ "$currage" -lt "$maxage" ]; then | ||||||
|         exit 0 # no need to update |         exit 0 # no need to update | ||||||
|     fi |     fi | ||||||
| fi | fi | ||||||
|  |  | ||||||
|  | @ -53,8 +53,8 @@ case "$type" in | ||||||
|         ;; |         ;; | ||||||
|     apt) |     apt) | ||||||
|         if [ -f "$apt_dist_upgrade" ] |         if [ -f "$apt_dist_upgrade" ] | ||||||
|         then echo $aptget dist-upgrade |         then echo "$aptget dist-upgrade" | ||||||
|         else echo $aptget upgrade |         else echo "$aptget upgrade" | ||||||
|         fi |         fi | ||||||
| 
 | 
 | ||||||
|         if [ -f "$apt_clean" ] |         if [ -f "$apt_clean" ] | ||||||
|  |  | ||||||
|  | @ -60,10 +60,10 @@ fi | ||||||
| 
 | 
 | ||||||
| case "$state_should" in | case "$state_should" in | ||||||
|     present) |     present) | ||||||
|         echo yum $opts install \"$install_name\" |         echo "yum $opts install '$install_name'" | ||||||
|     ;; |     ;; | ||||||
|     absent) |     absent) | ||||||
|         echo yum $opts remove \"$name\" |         echo "yum $opts remove '$name'" | ||||||
|     ;; |     ;; | ||||||
|     *) |     *) | ||||||
|         echo "Unknown state: $state_should" >&2 |         echo "Unknown state: $state_should" >&2 | ||||||
|  |  | ||||||
|  | @ -61,15 +61,15 @@ case "$state_should" in | ||||||
|     present) |     present) | ||||||
|         if [ -z "$version_should" ]; then |         if [ -z "$version_should" ]; then | ||||||
|             [ "$state_is" = "present" ] && exit 0 # if state is present, we dont need to do anything |             [ "$state_is" = "present" ] && exit 0 # if state is present, we dont need to do anything | ||||||
|             echo zypper $globalopts install --type \"$ptype\" --auto-agree-with-licenses \"$name\" ">/dev/null" |             echo "zypper $globalopts install --type '$ptype' --auto-agree-with-licenses '$name' >/dev/null" | ||||||
|         else |         else | ||||||
|             [ "$state_is" = "present" ] && [ "$version_should" = "$version_is" ] && exit 0 # if state is present and version is correct, we dont need to do anything |             [ "$state_is" = "present" ] && [ "$version_should" = "$version_is" ] && exit 0 # if state is present and version is correct, we dont need to do anything | ||||||
|             echo zypper $globalopts install --oldpackage --type \"$ptype\" --auto-agree-with-licenses \"$name\" = \"$version_should\" ">/dev/null" |             echo "zypper $globalopts install --oldpackage --type '$ptype' --auto-agree-with-licenses '$name' = '$version_should' >/dev/null" | ||||||
|         fi |         fi | ||||||
|     ;; |     ;; | ||||||
|     absent) |     absent) | ||||||
|         [ "$state_is" = "absent" ] && exit 0 # if state is absent, we dont need to do anything |         [ "$state_is" = "absent" ] && exit 0 # if state is absent, we dont need to do anything | ||||||
|         echo zypper $globalopts remove --type \"$ptype\" \"$name\" ">/dev/null" |         echo "zypper $globalopts remove --type '$ptype' '$name' >/dev/null" | ||||||
|     ;; |     ;; | ||||||
|     *) |     *) | ||||||
|         echo "Unknown state: $state_should" >&2 |         echo "Unknown state: $state_should" >&2 | ||||||
|  |  | ||||||
|  | @ -59,13 +59,13 @@ if [ "${file}" ]; then | ||||||
| 
 | 
 | ||||||
|     if [ "${state}" = "present" ]; then |     if [ "${state}" = "present" ]; then | ||||||
| 
 | 
 | ||||||
|         require="__file/${sec_path}/plain_file_${file}" __key_value ${file}_${key}\ |         require="__file/${sec_path}/plain_file_${file}" __key_value "${file}_${key}" \ | ||||||
|             --file ${sec_path}/plain_file_${file} --key ${key} --value ${value} --delimiter ' = ' |             --file "${sec_path}/plain_file_${file}" --key "${key}" --value "${value}" --delimiter ' = ' | ||||||
| 
 | 
 | ||||||
|         exit 0 |         exit 0 | ||||||
| 
 | 
 | ||||||
|     elif [ "${state}" = "absent" ]; then |     elif [ "${state}" = "absent" ]; then | ||||||
|         require="__file/${sec_path}/plain_file_${file}" __key_value ${file}_${key}\ |         require="__file/${sec_path}/plain_file_${file}" __key_value "${file}_${key}" \ | ||||||
|                 --state absent |                 --state absent | ||||||
|         exit 0 |         exit 0 | ||||||
| 
 | 
 | ||||||
|  | @ -87,19 +87,19 @@ eof | ||||||
| 
 | 
 | ||||||
|     if [ "${MATCH}" -eq 1 ]; then |     if [ "${MATCH}" -eq 1 ]; then | ||||||
|         if [ "${value}" = "on" ]; then |         if [ "${value}" = "on" ]; then | ||||||
|             require="__file/${sec_path}/${section}" __line ${key}_${value}\ |             require="__file/${sec_path}/${section}" __line "${key}_${value}" \ | ||||||
|                 --file ${sec_path}/${section} --line ${key} |                 --file "${sec_path}/${section}" --line "${key}" | ||||||
|         elif [ "${value}" = "off" ]; then |         elif [ "${value}" = "off" ]; then | ||||||
|             require="__file/${sec_path}/${section}" __line ${key}_${value}\ |             require="__file/${sec_path}/${section}" __line "${key}_${value}" \ | ||||||
|                 --file ${sec_path}/${section} --line ${key} --state absent |                 --file "${sec_path}/${section}" --line "${key}" --state absent | ||||||
|         fi |         fi | ||||||
|          |          | ||||||
|     else |     else | ||||||
|         contains_element "${key}" "${allowed_option_keys}" |         contains_element "${key}" "${allowed_option_keys}" | ||||||
| 
 | 
 | ||||||
|         if [ "${MATCH}" -eq 1 ]; then |         if [ "${MATCH}" -eq 1 ]; then | ||||||
|             require="__file/${sec_path}/${section}" __key_value ${section}_${key}\ |             require="__file/${sec_path}/${section}" __key_value "${section}_${key}" \ | ||||||
|                     --file ${sec_path}/${section} --key ${key} --value ${value} --delimiter ' = ' |                     --file "${sec_path}/${section}" --key "${key}" --value "${value}" --delimiter ' = ' | ||||||
|         else |         else | ||||||
|             echo "Key: ${key} is not valid. Have a look at man pacman.conf" >&2 |             echo "Key: ${key} is not valid. Have a look at man pacman.conf" >&2 | ||||||
|         fi |         fi | ||||||
|  | @ -118,12 +118,12 @@ eof | ||||||
|             exit |             exit | ||||||
|         fi |         fi | ||||||
|      |      | ||||||
|         require="__file/${sec_path}/repo_${section}" __key_value ${section}_${key}\ |         require="__file/${sec_path}/repo_${section}" __key_value "${section}_${key}" \ | ||||||
|                 --file ${sec_path}/repo_${section} --key ${key} --value ${value} --delimiter ' = ' |                 --file "${sec_path}/repo_${section}" --key "${key}" --value "${value}" --delimiter ' = ' | ||||||
| 
 | 
 | ||||||
|     elif [ "${state}" = "absent" ]; then |     elif [ "${state}" = "absent" ]; then | ||||||
| 
 | 
 | ||||||
|         require="__file/${sec_path}/repo_${section}" __key_value ${section}_${key}\ |         require="__file/${sec_path}/repo_${section}" __key_value "${section}_${key}" \ | ||||||
|             --state absent |             --state absent | ||||||
| 
 | 
 | ||||||
|     else |     else | ||||||
|  |  | ||||||
|  | @ -18,14 +18,14 @@ | ||||||
| # along with cdist. If not, see <http://www.gnu.org/licenses/>. | # along with cdist. If not, see <http://www.gnu.org/licenses/>. | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| state=$(cat $__object/parameter/state 2>/dev/null) | state=$(cat "$__object/parameter/state" 2>/dev/null) | ||||||
| 
 | 
 | ||||||
| if [ "${state}" = "present" ]; then | if [ "${state}" = "present" ]; then | ||||||
|     __file /etc/pacman.conf\ |     __file /etc/pacman.conf\ | ||||||
|         --owner root --group root --mode 644 --source $__type/files/pacman.conf.cdist |         --owner root --group root --mode 644 --source "$__type/files/pacman.conf.cdist" | ||||||
| 
 | 
 | ||||||
|     __file /etc/pacman.d/options\ |     __file /etc/pacman.d/options\ | ||||||
|         --owner root --group root --mode 644 --source $__type/files/options |         --owner root --group root --mode 644 --source "$__type/files/options" | ||||||
| 
 | 
 | ||||||
|     __file /etc/pacman.d/repo_empty_placeholder\ |     __file /etc/pacman.d/repo_empty_placeholder\ | ||||||
|         --owner root --group root --mode 644 |         --owner root --group root --mode 644 | ||||||
|  | @ -36,10 +36,10 @@ if [ "${state}" = "present" ]; then | ||||||
| elif [ "${state}" = "absent" ]; then | elif [ "${state}" = "absent" ]; then | ||||||
| 
 | 
 | ||||||
|     __file /etc/pacman.conf\ |     __file /etc/pacman.conf\ | ||||||
|         --owner root --group root --mode 644 --source $__type/files/pacman.conf.pacman |         --owner root --group root --mode 644 --source "$__type/files/pacman.conf.pacman" | ||||||
| 
 | 
 | ||||||
|     __file /etc/pacman.d/mirrorlist\ |     __file /etc/pacman.d/mirrorlist\ | ||||||
|         --owner root --group root --mode 644 --source $__type/files/mirrorlist |         --owner root --group root --mode 644 --source "$__type/files/mirrorlist" | ||||||
| 
 | 
 | ||||||
|     __file /etc/pacman.d/options\ |     __file /etc/pacman.d/options\ | ||||||
|         --state absent |         --state absent | ||||||
|  |  | ||||||
|  | @ -29,7 +29,7 @@ | ||||||
| 
 | 
 | ||||||
| RC="/etc/rc.conf" | RC="/etc/rc.conf" | ||||||
| PFCONF="$(grep '^pf_rules=' ${RC} | cut -d= -f2 | sed 's/"//g')" | PFCONF="$(grep '^pf_rules=' ${RC} | cut -d= -f2 | sed 's/"//g')" | ||||||
| echo ${PFCONF:-"/etc/pf.conf"} | echo "${PFCONF:-"/etc/pf.conf"}" | ||||||
| 
 | 
 | ||||||
| # Debug | # Debug | ||||||
| #set +x | #set +x | ||||||
|  |  | ||||||
|  | @ -33,7 +33,7 @@ TMP="$(grep '^pf_rules=' ${RC} | cut -d= -f2 | sed 's/"//g')" | ||||||
| PFCONF="${TMP:-"/etc/pf.conf"}" | PFCONF="${TMP:-"/etc/pf.conf"}" | ||||||
| 
 | 
 | ||||||
| if [ -f "${PFCONF}" ]; then	# The pf config file exists, find its cksum. | if [ -f "${PFCONF}" ]; then	# The pf config file exists, find its cksum. | ||||||
| 	cksum -o 1 ${PFCONF} | cut -d= -f2 | awk '{print $1}' | 	cksum -o 1 "${PFCONF}" | cut -d= -f2 | awk '{print $1}' | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # Debug | # Debug | ||||||
|  |  | ||||||
|  | @ -29,7 +29,7 @@ | ||||||
| 
 | 
 | ||||||
| RC="/etc/rc.conf" | RC="/etc/rc.conf" | ||||||
| PFCONF="$(grep '^pf_rules=' ${RC} | cut -d= -f2 | sed 's/"//g')" | PFCONF="$(grep '^pf_rules=' ${RC} | cut -d= -f2 | sed 's/"//g')" | ||||||
| echo ${PFCONF:-"/etc/pf.conf"} | echo "${PFCONF:-"/etc/pf.conf"}" | ||||||
| 
 | 
 | ||||||
| # Debug | # Debug | ||||||
| #set +x | #set +x | ||||||
|  |  | ||||||
|  | @ -57,7 +57,7 @@ __key_value alertmanager_args --file /etc/default/prometheus-alertmanager \ | ||||||
| 
 | 
 | ||||||
| require="$require __directory/$storage_path $require_pkg" \ | require="$require __directory/$storage_path $require_pkg" \ | ||||||
| __config_file $CONF \ | __config_file $CONF \ | ||||||
| 	--source $config \ | 	--source "$config" \ | ||||||
| 	--group prometheus --mode 640 \ | 	--group prometheus --mode 640 \ | ||||||
| 	--onchange "service prometheus-alertmanager reload"  # TODO when a config-check tool is available, check config here | 	--onchange "service prometheus-alertmanager reload"  # TODO when a config-check tool is available, check config here | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| export GOBIN=/opt/gocode/bin  # where to find go binaries | export GOBIN=/opt/gocode/bin  # where to find go binaries | ||||||
| 
 | 
 | ||||||
| exporter="$(cat $__object/parameter/exporter)" | exporter="$(cat "$__object/parameter/exporter")" | ||||||
| [ -z "$exporter" ] && exporter="$__object_id" | [ -z "$exporter" ] && exporter="$__object_id" | ||||||
| 
 | 
 | ||||||
| __user prometheus --system | __user prometheus --system | ||||||
|  | @ -18,7 +18,7 @@ case $exporter in | ||||||
| 	;; | 	;; | ||||||
| 	blackbox) | 	blackbox) | ||||||
| 		require="$require __daemontools_service/${exporter}-exporter __user/prometheus" __config_file "/service/${exporter}-exporter/blackbox.yml" \ | 		require="$require __daemontools_service/${exporter}-exporter __user/prometheus" __config_file "/service/${exporter}-exporter/blackbox.yml" \ | ||||||
| 			--source $__type/files/blackbox.yml \ | 			--source "$__type/files/blackbox.yml" \ | ||||||
| 			--group prometheus --mode 640 \ | 			--group prometheus --mode 640 \ | ||||||
| 			--onchange "svc -h /service/${exporter}-exporter" | 			--onchange "svc -h /service/${exporter}-exporter" | ||||||
| 		require="$require __golang_from_vendor" __go_get github.com/prometheus/blackbox_exporter | 		require="$require __golang_from_vendor" __go_get github.com/prometheus/blackbox_exporter | ||||||
|  | @ -39,9 +39,9 @@ case $exporter in | ||||||
| 	;; | 	;; | ||||||
| esac | esac | ||||||
| 
 | 
 | ||||||
| require="$require __daemontools" __daemontools_service ${exporter}-exporter --run "$run" | require="$require __daemontools" __daemontools_service "${exporter}-exporter" --run "$run" | ||||||
| if [ -f "$__object/parameter/add-consul-service" ]; then | if [ -f "$__object/parameter/add-consul-service" ]; then | ||||||
| 	__consul_service ${exporter}-exporter --port $port --check-http "http://localhost:$port/metrics" --check-interval 10s | 	__consul_service "${exporter}-exporter" --port "$port" --check-http "http://localhost:$port/metrics" --check-interval 10s | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| #__daemontools --install-init-script | #__daemontools --install-init-script | ||||||
|  |  | ||||||
|  | @ -13,7 +13,7 @@ storage_path="$(cat "$__object/parameter/storage-path")" | ||||||
| rule_files="$(cat "$__object/parameter/rule-files")" | rule_files="$(cat "$__object/parameter/rule-files")" | ||||||
| 
 | 
 | ||||||
| # explorer in kB => convert; by default we go with 1/2 RAM | # explorer in kB => convert; by default we go with 1/2 RAM | ||||||
| [ "$target_heap_size" = "auto" ] && target_heap_size=$(($(cat $__global/explorer/memory)*1024/2)) | [ "$target_heap_size" = "auto" ] && target_heap_size=$(($(cat "$__global/explorer/memory")*1024/2)) | ||||||
| 
 | 
 | ||||||
| ##### INSTALL THE PACKAGE ################################################### | ##### INSTALL THE PACKAGE ################################################### | ||||||
| 
 | 
 | ||||||
|  | @ -55,12 +55,12 @@ __key_value prometheus_args --file /etc/default/prometheus \ | ||||||
| 
 | 
 | ||||||
| require="$require __directory/$storage_path $require_pkg" \ | require="$require __directory/$storage_path $require_pkg" \ | ||||||
| __config_file $CONF \ | __config_file $CONF \ | ||||||
| 	--source $config \ | 	--source "$config" \ | ||||||
| 	--group prometheus --mode 640 \ | 	--group prometheus --mode 640 \ | ||||||
| 	--onchange "promtool check config $CONF && service prometheus reload" | 	--onchange "promtool check config $CONF && service prometheus reload" | ||||||
| 
 | 
 | ||||||
| for file in $rule_files; do | for file in $rule_files; do | ||||||
| 	dest=$CONF_DIR/$(basename $file) | 	dest=$CONF_DIR/$(basename "$file") | ||||||
| 	require="$require $require_pkg" \ | 	require="$require $require_pkg" \ | ||||||
| 	__config_file "$dest" \ | 	__config_file "$dest" \ | ||||||
| 		--source "$file" \ | 		--source "$file" \ | ||||||
|  |  | ||||||
|  | @ -2,4 +2,4 @@ | ||||||
| 
 | 
 | ||||||
| destination="/$__object_id" | destination="/$__object_id" | ||||||
| 
 | 
 | ||||||
| stat --print "%G" ${destination} 2>/dev/null || exit 0 | stat --print "%G" "${destination}" 2>/dev/null || exit 0 | ||||||
|  |  | ||||||
|  | @ -2,4 +2,4 @@ | ||||||
| 
 | 
 | ||||||
| destination="/$__object_id" | destination="/$__object_id" | ||||||
| 
 | 
 | ||||||
| stat --print "%U" ${destination} 2>/dev/null || exit 0 | stat --print "%U" "${destination}" 2>/dev/null || exit 0 | ||||||
|  |  | ||||||
|  | @ -47,7 +47,7 @@ fi | ||||||
| case $state_should in | case $state_should in | ||||||
|     present) |     present) | ||||||
|         if [ "$state_should" != "$state_is" ]; then |         if [ "$state_should" != "$state_is" ]; then | ||||||
|             echo $pyvenv $venvparams "$destination" |             echo "$pyvenv $venvparams $destination" | ||||||
|         fi |         fi | ||||||
|         if { [ -n "$owner" ] && [ "$owner_is" != "$owner" ]; } || \ |         if { [ -n "$owner" ] && [ "$owner_is" != "$owner" ]; } || \ | ||||||
|            { [ -n "$group" ] && [ "$group_is" != "$group" ]; }; then |            { [ -n "$group" ] && [ "$group_is" != "$group" ]; }; then | ||||||
|  |  | ||||||
|  | @ -18,4 +18,4 @@ format="$(cat "$__object/parameter/format")" | ||||||
| size="$(cat "$__object/parameter/size")" | size="$(cat "$__object/parameter/size")" | ||||||
| diskimage="/$__object_id" | diskimage="/$__object_id" | ||||||
| 
 | 
 | ||||||
| echo qemu-img create -f \"$format\" \"$diskimage\" \"$size\" | echo "qemu-img create -f '$format' '$diskimage' '$size'" | ||||||
|  |  | ||||||
|  | @ -31,7 +31,7 @@ set -- | ||||||
| if [ -f "$__object/parameter/rsync-opts" ]; then | if [ -f "$__object/parameter/rsync-opts" ]; then | ||||||
|     while read opts; do |     while read opts; do | ||||||
|         set -- "$@" "--$opts" |         set -- "$@" "--$opts" | ||||||
|     done < $__object/parameter/rsync-opts |     done < "$__object/parameter/rsync-opts" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| echo rsync -a \ | echo rsync -a \ | ||||||
|  |  | ||||||
|  | @ -28,7 +28,7 @@ if [ "$user" = "root" ]; then | ||||||
|         echo absent |         echo absent | ||||||
|     fi |     fi | ||||||
| else | else | ||||||
|     if su - $user -c "[ -d \"\$HOME/.rvm\" ]" ; then |     if su - "$user" -c "[ -d \"\$HOME/.rvm\" ]" ; then | ||||||
|        echo "present" |        echo "present" | ||||||
|     else |     else | ||||||
|        echo "absent" |        echo "absent" | ||||||
|  |  | ||||||
|  | @ -24,7 +24,7 @@ type_and_key="$(tr ' ' '\n' < "$__object/parameter/key"| awk '/^(ssh|ecdsa)-[^ ] | ||||||
| # 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}" ] | ||||||
| then | then | ||||||
|     file="$(cat $__object/parameter/file)" |     file="$(cat "$__object/parameter/file")" | ||||||
| 
 | 
 | ||||||
|     # get any entries that match the type and key |     # get any entries that match the type and key | ||||||
|     grep ".*$type_and_key\([ \n]\|$\)" "$file" || true |     grep ".*$type_and_key\([ \n]\|$\)" "$file" || true | ||||||
|  |  | ||||||
|  | @ -88,7 +88,7 @@ fi | ||||||
| entry="$(cat "$__object/files/should")" | entry="$(cat "$__object/files/should")" | ||||||
| state_should="$(cat "$__object/parameter/state")" | state_should="$(cat "$__object/parameter/state")" | ||||||
| num_existing_entries=$(grep -c -F -x "$entry" "$__object/explorer/entry" || true) | num_existing_entries=$(grep -c -F -x "$entry" "$__object/explorer/entry" || true) | ||||||
| if [ $num_existing_entries -eq 1 ]; then | if [ "$num_existing_entries" -eq 1 ]; then | ||||||
|    state_is="present" |    state_is="present" | ||||||
| else | else | ||||||
|    # Posix grep does not define the -m option, so we can not remove a single |    # Posix grep does not define the -m option, so we can not remove a single | ||||||
|  |  | ||||||
|  | @ -37,16 +37,16 @@ case "$state_should" in | ||||||
|         if [ "$init" = 'systemd' ]; then |         if [ "$init" = 'systemd' ]; then | ||||||
|             # this handles ALL linux distros with systemd |             # this handles ALL linux distros with systemd | ||||||
|             # e.g. archlinux, gentoo in some cases, new RHEL and SLES versions |             # e.g. archlinux, gentoo in some cases, new RHEL and SLES versions | ||||||
|             echo "systemctl -q enable \"$name\"" |             echo "systemctl -q enable '$name'" | ||||||
|         else |         else | ||||||
|             case "$os" in |             case "$os" in | ||||||
|                 debian) |                 debian) | ||||||
|                     case "$os_version" in |                     case "$os_version" in | ||||||
|                         [1-7]*) |                         [1-7]*) | ||||||
|                             echo "update-rc.d \"$name\" defaults >/dev/null" |                             echo "update-rc.d '$name' defaults >/dev/null" | ||||||
|                         ;; |                         ;; | ||||||
|                         8*) |                         8*) | ||||||
|                             echo "systemctl enable \"$name\"" |                             echo "systemctl enable '$name'" | ||||||
|                         ;; |                         ;; | ||||||
|                         *) |                         *) | ||||||
|                             echo "Unsupported version $os_version of $os" >&2 |                             echo "Unsupported version $os_version of $os" >&2 | ||||||
|  | @ -55,26 +55,26 @@ case "$state_should" in | ||||||
|                     esac |                     esac | ||||||
|                 ;; |                 ;; | ||||||
|                 devuan) |                 devuan) | ||||||
|                     echo "update-rc.d \"$name\" defaults >/dev/null" |                     echo "update-rc.d '$name' defaults >/dev/null" | ||||||
|                 ;; |                 ;; | ||||||
| 
 | 
 | ||||||
|                 gentoo) |                 gentoo) | ||||||
|                     echo rc-update add \"$name\" \"$target_runlevel\" |                     echo "rc-update add '$name' '$target_runlevel'" | ||||||
|                 ;; |                 ;; | ||||||
| 
 | 
 | ||||||
|                 amazon|scientific|centos|fedora|owl|redhat|suse) |                 amazon|scientific|centos|fedora|owl|redhat|suse) | ||||||
|                     echo chkconfig \"$name\" on |                     echo "chkconfig '$name' on" | ||||||
|                 ;; |                 ;; | ||||||
| 
 | 
 | ||||||
|                 openwrt) |                 openwrt) | ||||||
|                     # 'enable' can be successful and still return a non-zero exit |                     # 'enable' can be successful and still return a non-zero exit | ||||||
|                     # code, deal with it by checking for success ourselves in that |                     # code, deal with it by checking for success ourselves in that | ||||||
|                     # case (the || ... part). |                     # case (the || ... part). | ||||||
|                     echo "/etc/init.d/\"$name\" enable || [ -f /etc/rc.d/S??\"$name\" ]" |                     echo "'/etc/init.d/$name' enable || [ -f /etc/rc.d/S??'$name' ]" | ||||||
|                 ;; |                 ;; | ||||||
| 
 | 
 | ||||||
|                 ubuntu) |                 ubuntu) | ||||||
|                     echo "update-rc.d \"$name\" defaults >/dev/null" |                     echo "update-rc.d '$name' defaults >/dev/null" | ||||||
|                 ;; |                 ;; | ||||||
| 
 | 
 | ||||||
|                 freebsd) |                 freebsd) | ||||||
|  | @ -93,24 +93,24 @@ case "$state_should" in | ||||||
|         if [ "$init" = 'systemd' ]; then |         if [ "$init" = 'systemd' ]; then | ||||||
|             # this handles ALL linux distros with systemd |             # this handles ALL linux distros with systemd | ||||||
|             # e.g. archlinux, gentoo in some cases, new RHEL and SLES versions |             # e.g. archlinux, gentoo in some cases, new RHEL and SLES versions | ||||||
|             echo "systemctl -q disable \"$name\"" |             echo "systemctl -q disable '$name'" | ||||||
| 
 | 
 | ||||||
|         else |         else | ||||||
|             case "$os" in |             case "$os" in | ||||||
|                 debian|ubuntu|devuan) |                 debian|ubuntu|devuan) | ||||||
|                     echo update-rc.d -f \"$name\" remove |                     echo "update-rc.d -f '$name' remove" | ||||||
|                 ;; |                 ;; | ||||||
| 
 | 
 | ||||||
|                 gentoo) |                 gentoo) | ||||||
|                     echo rc-update del \"$name\"  \"$target_runlevel\" |                     echo "rc-update del '$name' '$target_runlevel'" | ||||||
|                 ;; |                 ;; | ||||||
| 
 | 
 | ||||||
|                 centos|fedora|owl|redhat|suse) |                 centos|fedora|owl|redhat|suse) | ||||||
|                     echo chkconfig \"$name\" off |                     echo "chkconfig '$name' off" | ||||||
|                 ;; |                 ;; | ||||||
| 
 | 
 | ||||||
|                 openwrt) |                 openwrt) | ||||||
|                     echo "\"/etc/init.d/$name\" disable" |                     echo "'/etc/init.d/$name' disable" | ||||||
|                 ;; |                 ;; | ||||||
| 
 | 
 | ||||||
|                 *) |                 *) | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ case "$os" in | ||||||
| 	else | 	else | ||||||
| 	    value='NO' | 	    value='NO' | ||||||
| 	fi | 	fi | ||||||
| 	__key_value rcconf-$name-enable \ | 	__key_value "rcconf-$name-enable" \ | ||||||
| 	    --file /etc/rc.conf \ | 	    --file /etc/rc.conf \ | ||||||
| 	    --key "${name}_enable" \ | 	    --key "${name}_enable" \ | ||||||
| 	    --value "\"$value\"" \ | 	    --value "\"$value\"" \ | ||||||
|  |  | ||||||
|  | @ -22,7 +22,7 @@ | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| name=$__object_id | name=$__object_id | ||||||
| os="$($__explorer/os)" | os="$("$__explorer/os")" | ||||||
| # Default to using shadow passwords | # Default to using shadow passwords | ||||||
| database="shadow" | database="shadow" | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -97,7 +97,7 @@ if [ "$state" = "present" ]; then | ||||||
|           fi |           fi | ||||||
| 
 | 
 | ||||||
|           if [ "$new_value" != "$current_value" ]; then |           if [ "$new_value" != "$current_value" ]; then | ||||||
|               set -- "$@" "$(shorten_property $property)" \'$new_value\' |               set -- "$@" "$(shorten_property "$property")" \'"$new_value"\' | ||||||
|           fi |           fi | ||||||
|        done |        done | ||||||
| 
 | 
 | ||||||
|  | @ -118,9 +118,9 @@ if [ "$state" = "present" ]; then | ||||||
|             [ "$property" = "remove-home" ] && continue |             [ "$property" = "remove-home" ] && continue | ||||||
|             new_value="$(cat "$property")" |             new_value="$(cat "$property")" | ||||||
|             if [ -z "$new_value" ];then       # Boolean values have no value |             if [ -z "$new_value" ];then       # Boolean values have no value | ||||||
|               set -- "$@" "$(shorten_property $property)" |               set -- "$@" "$(shorten_property "$property")" | ||||||
|             else |             else | ||||||
|               set -- "$@" "$(shorten_property $property)" \'$new_value\' |               set -- "$@" "$(shorten_property "$property")" \'"$new_value"\' | ||||||
|             fi |             fi | ||||||
|         done |         done | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -70,25 +70,25 @@ case "$state" in | ||||||
|          fi |          fi | ||||||
|          if [ -z "$repo_id" ]; then |          if [ -z "$repo_id" ]; then | ||||||
|              # Repo not present, so we need to create it  |              # Repo not present, so we need to create it  | ||||||
|              echo zypper $zypper_def_opts addrepo "'$uri'" "'$desc'" |              echo "zypper $zypper_def_opts addrepo '$uri' '$desc'" | ||||||
|          fi |          fi | ||||||
|    ;; |    ;; | ||||||
|    absent) |    absent) | ||||||
|          if [ ! -z "$act_id" ]; then |          if [ ! -z "$act_id" ]; then | ||||||
|              # Repo present (act_id not ""), so we ned to delete it |              # Repo present (act_id not ""), so we ned to delete it | ||||||
|              echo zypper $zypper_def_opts removerepo "$act_id" |              echo "zypper $zypper_def_opts removerepo $act_id" | ||||||
|          fi |          fi | ||||||
|    ;; |    ;; | ||||||
|    enabled) |    enabled) | ||||||
|          if [ ! -z "$act_id" ] && [ "$repostate" = "disabled" ]; then |          if [ ! -z "$act_id" ] && [ "$repostate" = "disabled" ]; then | ||||||
|              # Repo present (act_id not "") and repostate not enabled, so a enable call is needed |              # Repo present (act_id not "") and repostate not enabled, so a enable call is needed | ||||||
|              echo zypper $zypper_def_opts modifyrepo -e "$act_id" |              echo "zypper $zypper_def_opts modifyrepo -e $act_id" | ||||||
|          fi |          fi | ||||||
|    ;; |    ;; | ||||||
|    disabled) |    disabled) | ||||||
|          if [ ! -z "$act_id" ] && [ "$repostate" = "enabled" ]; then |          if [ ! -z "$act_id" ] && [ "$repostate" = "enabled" ]; then | ||||||
|              # Repo present (act_id not "") and repostate enabled, so a disable call is needed |              # Repo present (act_id not "") and repostate enabled, so a disable call is needed | ||||||
|              echo zypper $zypper_def_opts modifyrepo -d "$act_id" |              echo "zypper $zypper_def_opts modifyrepo -d $act_id" | ||||||
|          fi |          fi | ||||||
|    ;; |    ;; | ||||||
|    *) |    *) | ||||||
|  |  | ||||||
|  | @ -25,4 +25,4 @@ if [ -f "$__object/parameter/uri" ]; then | ||||||
| else | else | ||||||
|    uri="/$__object_id" |    uri="/$__object_id" | ||||||
| fi | fi | ||||||
| zypper ls -u | awk 'BEGIN { FS = "[ ]+\\|[ ]+" } ; $4 == "Yes" && $NF == "'$uri'" {print $NF}' | zypper ls -u | awk 'BEGIN { FS = "[ ]+\\|[ ]+" } ; $4 == "Yes" && $NF == "'"$uri"'" {print $NF}' | ||||||
|  |  | ||||||
|  | @ -59,10 +59,10 @@ if [ -f "$__object/parameter/remove-all-other-services" ]; then | ||||||
|    # file exists -> True |    # file exists -> True | ||||||
|    for i in $exp_ids; do |    for i in $exp_ids; do | ||||||
|      if [ "$i" != "$exp_id" ] ; then |      if [ "$i" != "$exp_id" ] ; then | ||||||
|        echo zypper $zypper_def_opts  removeservice "$i" "&>/dev/null" |        echo "zypper $zypper_def_opts  removeservice $i &>/dev/null" | ||||||
|      fi |      fi | ||||||
|    done  |    done  | ||||||
|    echo zypper $zypper_def_opts refs "&>/dev/null" |    echo "zypper $zypper_def_opts refs &>/dev/null" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -71,14 +71,14 @@ fi | ||||||
| 
 | 
 | ||||||
| case "$state_should" in | case "$state_should" in | ||||||
|    present) |    present) | ||||||
|          echo zypper $zypper_def_opts addservice -t "$stype" "$uri" \"$desc\" |          echo "zypper $zypper_def_opts addservice -t $stype $uri '$desc'" | ||||||
|          echo zypper $zypper_def_opts refs |          echo "zypper $zypper_def_opts refs" | ||||||
|          echo zypper $zypper_def_opts ref |          echo "zypper $zypper_def_opts ref" | ||||||
|    ;; |    ;; | ||||||
|    absent) |    absent) | ||||||
|          echo zypper $zypper_def_opts removeservice "$service_id" |          echo "zypper $zypper_def_opts removeservice $service_id" | ||||||
|          echo zypper $zypper_def_opts refs |          echo "zypper $zypper_def_opts refs" | ||||||
|          echo zypper $zypper_def_opts ref |          echo "zypper $zypper_def_opts ref" | ||||||
|    ;; |    ;; | ||||||
|    *) |    *) | ||||||
|       echo "Unknown state: $state_should" >&2 |       echo "Unknown state: $state_should" >&2 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue