Merging casper 1.199.
[live-boot-grml.git] / scripts / live-bottom / 06hostname
index 75ea801..b14703a 100755 (executable)
@@ -32,7 +32,7 @@ log_begin_msg "Setting hostname"
 # live-initramfs script
 
 # Change hostname only if it is not set
-if [ ! -f /root/etc/hostname ] || grep -q localhost\.localdomain /root/etc/hostname
+if [ ! -f /root/etc/hostname ] || grep -qs localhost\.localdomain /root/etc/hostname
 then
        echo "${HOSTNAME}" > /root/etc/hostname
 else
@@ -41,7 +41,7 @@ else
 fi
 
 # Create /etc/hosts only if it is not present or empty
-if [ ! -f /root/etc/hosts ] || [ "$(/root/usr/bin/stat -c %s root/etc/hosts)" == "0" ]
+if [ ! -s /root/etc/hosts ]
 then
        cat > /root/etc/hosts << EOF
 127.0.0.1 localhost