forked from ungleich-public/cdist
		
	
				commit
				
					
						7fe4e20f53
					
				
			
		
					 14 changed files with 30 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,4 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2015 Nico Schottelius (nico-cdist at schottelius.org)
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,4 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2015 Nico Schottelius (nico-cdist at schottelius.org)
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,5 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
if grep -q "^__file/etc/iptables.d/" "$__messages_in"; then
 | 
			
		||||
    echo /etc/init.d/iptables restart
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,4 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2013 Nico Schottelius (nico-cdist at schottelius.org)
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,4 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2013 Nico Schottelius (nico-cdist at schottelius.org)
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,5 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
export key="$(cat "$__object/parameter/key" 2>/dev/null \
 | 
			
		||||
   || echo "$__object_id")"
 | 
			
		||||
export state="$(cat "$__object/parameter/state")"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,5 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2013 Nico Schottelius (nico-cdist at schottelius.org)
 | 
			
		||||
#
 | 
			
		||||
# This file is part of cdist.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ case "$ptype" in
 | 
			
		|||
        zypper search --match-exact --installed-only --type "$ptype" "$name" | grep -E '^i' | cut -d " " -f 3 || true
 | 
			
		||||
    ;;
 | 
			
		||||
    *)
 | 
			
		||||
        echo "unknown ptype in __package_zypper explorer" &>2
 | 
			
		||||
        echo "unknown ptype in __package_zypper explorer" >&2
 | 
			
		||||
        exit 1
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,11 +42,10 @@ contains_element() {
 | 
			
		|||
    MATCH=0
 | 
			
		||||
 | 
			
		||||
    target=$1
 | 
			
		||||
    keys="${@:2}"
 | 
			
		||||
    shift
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    for key in ${keys}; do
 | 
			
		||||
        if [ "${key}" == "${target}" ]; then
 | 
			
		||||
    for key in "$@"; do
 | 
			
		||||
        if [ "${key}" = "${target}" ]; then
 | 
			
		||||
            MATCH=1
 | 
			
		||||
            return 0
 | 
			
		||||
        fi  
 | 
			
		||||
| 
						 | 
				
			
			@ -58,14 +57,14 @@ if [ "${file}" ]; then
 | 
			
		|||
    __file "${sec_path}/plain_file_${file}"\
 | 
			
		||||
        --state exists --mode 666
 | 
			
		||||
 | 
			
		||||
    if [ "${state}" == "present" ]; then
 | 
			
		||||
    if [ "${state}" = "present" ]; then
 | 
			
		||||
 | 
			
		||||
        require="__file/${sec_path}/plain_file_${file}" __key_value ${file}_${key}\
 | 
			
		||||
            --file ${sec_path}/plain_file_${file} --key ${key} --value ${value} --delimiter ' = '
 | 
			
		||||
 | 
			
		||||
        exit 0
 | 
			
		||||
 | 
			
		||||
    elif [ "${state}" == "absent" ]; then
 | 
			
		||||
    elif [ "${state}" = "absent" ]; then
 | 
			
		||||
        require="__file/${sec_path}/plain_file_${file}" __key_value ${file}_${key}\
 | 
			
		||||
                --state absent
 | 
			
		||||
        exit 0
 | 
			
		||||
| 
						 | 
				
			
			@ -76,7 +75,7 @@ if [ "${file}" ]; then
 | 
			
		|||
    fi
 | 
			
		||||
fi  
 | 
			
		||||
 | 
			
		||||
if [ "${section}" == "options" ]; then
 | 
			
		||||
if [ "${section}" = "options" ]; then
 | 
			
		||||
 | 
			
		||||
    __file "${sec_path}/${section}"\
 | 
			
		||||
            --state exists --mode 666 --source - << eof
 | 
			
		||||
| 
						 | 
				
			
			@ -87,10 +86,10 @@ eof
 | 
			
		|||
    contains_element "${key}" "${boolean_option_keys}"
 | 
			
		||||
 | 
			
		||||
    if [ "${MATCH}" -eq 1 ]; then
 | 
			
		||||
        if [ "${value}" == "on" ]; then
 | 
			
		||||
        if [ "${value}" = "on" ]; then
 | 
			
		||||
            require="__file/${sec_path}/${section}" __line ${key}_${value}\
 | 
			
		||||
                --file ${sec_path}/${section} --line ${key}
 | 
			
		||||
        elif [ "${value}" == "off" ]; then
 | 
			
		||||
        elif [ "${value}" = "off" ]; then
 | 
			
		||||
            require="__file/${sec_path}/${section}" __line ${key}_${value}\
 | 
			
		||||
                --file ${sec_path}/${section} --line ${key} --state absent
 | 
			
		||||
        fi
 | 
			
		||||
| 
						 | 
				
			
			@ -111,7 +110,7 @@ else
 | 
			
		|||
            --state exists --mode 666 --source - << eof
 | 
			
		||||
[${section}]
 | 
			
		||||
eof
 | 
			
		||||
    if [ "${state}" == "present" ]; then
 | 
			
		||||
    if [ "${state}" = "present" ]; then
 | 
			
		||||
 | 
			
		||||
        #check if key is valid
 | 
			
		||||
        contains_element "${key}" "${allowed_repo_keys}"
 | 
			
		||||
| 
						 | 
				
			
			@ -122,7 +121,7 @@ eof
 | 
			
		|||
        require="__file/${sec_path}/repo_${section}" __key_value ${section}_${key}\
 | 
			
		||||
                --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}\
 | 
			
		||||
            --state absent
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@ state=$(cat $__object/parameter/state 2>/dev/null)
 | 
			
		|||
 | 
			
		||||
path="/etc/"
 | 
			
		||||
 | 
			
		||||
if [ "${state}" == "present" ]; then
 | 
			
		||||
if [ "${state}" = "present" ]; then
 | 
			
		||||
    __file /etc/pacman.conf\
 | 
			
		||||
        --owner root --group root --mode 644 --source $__type/files/pacman.conf.cdist
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -35,7 +35,7 @@ if [ "${state}" == "present" ]; then
 | 
			
		|||
    __file /etc/pacman.d/plain_file_empty_placeholder\
 | 
			
		||||
        --owner root --group root --mode 644
 | 
			
		||||
 | 
			
		||||
elif [ "${state}" == "absent" ]; then
 | 
			
		||||
elif [ "${state}" = "absent" ]; then
 | 
			
		||||
 | 
			
		||||
    __file /etc/pacman.conf\
 | 
			
		||||
        --owner root --group root --mode 644 --source $__type/files/pacman.conf.pacman
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,5 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
# State: absent is handled by manifest - we need only to do stuff if image is
 | 
			
		||||
# not existing and state != absent
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,5 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
################################################################################
 | 
			
		||||
# Default settings
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ init=$("$__explorer/init")
 | 
			
		|||
target_runlevel="$(cat "$__object/parameter/target_runlevel")"
 | 
			
		||||
name="$__object_id"
 | 
			
		||||
 | 
			
		||||
if [ "$init" == 'systemd' ]; then
 | 
			
		||||
if [ "$init" = 'systemd' ]; then
 | 
			
		||||
    # this handles ALL linux distros with systemd
 | 
			
		||||
    # e.g. archlinux, gentoo, new RHEL and SLES versions
 | 
			
		||||
    state=$(systemctl is-enabled "$name" >/dev/null 2>&1 \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ name="$__object_id"
 | 
			
		|||
 | 
			
		||||
case "$state_should" in
 | 
			
		||||
    present)
 | 
			
		||||
        if [ "$init" == 'systemd' ]; then
 | 
			
		||||
        if [ "$init" = 'systemd' ]; then
 | 
			
		||||
            # this handles ALL linux distros with systemd
 | 
			
		||||
            # e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
 | 
			
		||||
            echo "systemctl -q enable \"$name\""
 | 
			
		||||
| 
						 | 
				
			
			@ -85,7 +85,7 @@ case "$state_should" in
 | 
			
		|||
    ;;
 | 
			
		||||
 | 
			
		||||
    absent)
 | 
			
		||||
        if [ "$init" == 'systemd' ]; then
 | 
			
		||||
        if [ "$init" = 'systemd' ]; then
 | 
			
		||||
            # this handles ALL linux distros with systemd
 | 
			
		||||
            # e.g. archlinux, gentoo in some cases, new RHEL and SLES versions
 | 
			
		||||
            echo "systemctl -q disable \"$name\""
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue