Handle unknown linux distro situations
authorNikos Skalkotos <skalkoto@grnet.gr>
Wed, 11 Jan 2012 11:05:28 +0000 (13:05 +0200)
committerNikos Skalkotos <skalkoto@grnet.gr>
Wed, 11 Jan 2012 11:05:28 +0000 (13:05 +0200)
When get_distro and get_base_distro do not detect the linux distribution
a warning is triggered.

AssignHostname fails if the distribution is not known.

snf-image-helper/common.sh
snf-image-helper/tasks/50AssignHostname.in

index da0b5b9..455c121 100644 (file)
@@ -60,6 +60,8 @@ get_base_distro() {
         echo "suse"
     elif [ -e "$root_dir/gentoo-release" ]; then
         echo "gentoo"
+    else
+        warn "Unknown base distro."
     fi
 }
 
@@ -87,6 +89,8 @@ get_distro() {
         echo "suse"
     elif [ -e "$root_dir/gentoo-release" ]; then
         echo "gentoo"
+    else
+        warn "Unknown distro."
     fi
 }
 
index a944c49..9b9fb84 100644 (file)
@@ -66,6 +66,7 @@ linux_hostname() {
             echo "$hostname" > "${target}/etc/HOSTNAME";;
         gentoo)
             sed -ie "s/\(\(HOSTNAME\)\|\(hostname\)\)=.*$/\1=\"$hostname\"/" "$target/etc/conf.d/hostname";;
+        *) log_error "Don't know how to assign hostname. Unknown linux distribution.";;
     esac
 
     # Some Linux distributions assign the hostname to 127.0.1.1 in order to be