forked from ungleich-public/cdist
		
	+suse support in __locale and __hostname
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								13943e710c
							
						
					
				
			
			
				commit
				
					
						3592a0c6dd
					
				
			
		
					 5 changed files with 20 additions and 4 deletions
				
			
		| 
						 | 
					@ -21,6 +21,10 @@
 | 
				
			||||||
# Retrieve the contents of /etc/hostname
 | 
					# Retrieve the contents of /etc/hostname
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Almost any distribution
 | 
				
			||||||
if [ -f /etc/hostname ]; then
 | 
					if [ -f /etc/hostname ]; then
 | 
				
			||||||
    cat /etc/hostname
 | 
					    cat /etc/hostname
 | 
				
			||||||
 | 
					# SuSE
 | 
				
			||||||
 | 
					elif [ -f /etc/HOSTNAME ]; then
 | 
				
			||||||
 | 
					    cat /etc/HOSTNAME
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,14 +28,14 @@ fi
 | 
				
			||||||
os=$(cat "$__global/explorer/os")
 | 
					os=$(cat "$__global/explorer/os")
 | 
				
			||||||
name_running=$(cat "$__global/explorer/hostname")
 | 
					name_running=$(cat "$__global/explorer/hostname")
 | 
				
			||||||
name_config=$(cat "$__object/explorer/hostname_file")
 | 
					name_config=$(cat "$__object/explorer/hostname_file")
 | 
				
			||||||
name_sysconfig=$(cat "$__object/explorer/hostname_file")
 | 
					name_sysconfig=$(cat "$__object/explorer/hostname_sysconfig")
 | 
				
			||||||
has_hostnamectl=$(cat "$__object/explorer/has_hostnamectl")
 | 
					has_hostnamectl=$(cat "$__object/explorer/has_hostnamectl")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
# If everything is ok -> exit
 | 
					# If everything is ok -> exit
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
case "$os" in
 | 
					case "$os" in
 | 
				
			||||||
    archlinux|debian|ubuntu)
 | 
					    archlinux|debian|suse|ubuntu)
 | 
				
			||||||
        if [ "$name_config" = "$name_should" -a "$name_running" = "$name_should" ]; then
 | 
					        if [ "$name_config" = "$name_should" -a "$name_running" = "$name_should" ]; then
 | 
				
			||||||
            exit 0
 | 
					            exit 0
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
| 
						 | 
					@ -45,6 +45,10 @@ case "$os" in
 | 
				
			||||||
            exit 0
 | 
					            exit 0
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
 | 
					    *)
 | 
				
			||||||
 | 
					        echo "Unsupported os: $os" >&2
 | 
				
			||||||
 | 
					        exit 1
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
################################################################################
 | 
					################################################################################
 | 
				
			||||||
| 
						 | 
					@ -63,5 +67,9 @@ else
 | 
				
			||||||
        centos)
 | 
					        centos)
 | 
				
			||||||
            echo "hostname '$name_should'"
 | 
					            echo "hostname '$name_should'"
 | 
				
			||||||
        ;;
 | 
					        ;;
 | 
				
			||||||
 | 
					        suse)
 | 
				
			||||||
 | 
					            echo "hostname '$name_should'"
 | 
				
			||||||
 | 
					            echo "printf '%s\n' '$name_should' > /etc/HOSTNAME"
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
    esac
 | 
					    esac
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,7 +34,7 @@ not_supported() {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
case "$os" in
 | 
					case "$os" in
 | 
				
			||||||
    archlinux|debian|ubuntu)
 | 
					    archlinux|debian|suse|ubuntu)
 | 
				
			||||||
        # handled in gencode-remote
 | 
					        # handled in gencode-remote
 | 
				
			||||||
        :
 | 
					        :
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -29,6 +29,9 @@ case "$os" in
 | 
				
			||||||
        # Debian needs a seperate package
 | 
					        # Debian needs a seperate package
 | 
				
			||||||
        __package locales --state present
 | 
					        __package locales --state present
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
 | 
					    suse)
 | 
				
			||||||
 | 
					        :
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
    *)
 | 
					    *)
 | 
				
			||||||
        echo "Sorry, do not know how to handle os: $os" >&2
 | 
					        echo "Sorry, do not know how to handle os: $os" >&2
 | 
				
			||||||
        echo "Please edit the type ${__type##*/} to fix this." >&2
 | 
					        echo "Please edit the type ${__type##*/} to fix this." >&2
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,8 +7,9 @@ Changelog
 | 
				
			||||||
 | 
					
 | 
				
			||||||
3.1.6:
 | 
					3.1.6:
 | 
				
			||||||
	* Type __package_yum: Support retrieving package via URL
 | 
						* Type __package_yum: Support retrieving package via URL
 | 
				
			||||||
	* Type __timezone: Support SuSE
 | 
					 | 
				
			||||||
	* Type __hostname: Support SuSE and have CentOS use sysconfig value
 | 
						* Type __hostname: Support SuSE and have CentOS use sysconfig value
 | 
				
			||||||
 | 
						* Type __locale: Support SuSE
 | 
				
			||||||
 | 
						* Type __timezone: Support SuSE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
3.1.5: 2014-05-05
 | 
					3.1.5: 2014-05-05
 | 
				
			||||||
	* Type __zypper_repo: Automatically import gpg keys (Daniel Heule)
 | 
						* Type __zypper_repo: Automatically import gpg keys (Daniel Heule)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue