makedist.inc.sh: create /etc/hostname with appropriate hostname

This commit is contained in:
Silvan Calarco 2013-04-14 17:13:52 +02:00
parent 94e42afb89
commit e88e5f0d26

View File

@ -80,6 +80,7 @@ fi
[[ "$TARGET_HOSTNAME" ]] || TARGET_HOSTNAME="$MAKEDIST_TARGET" [[ "$TARGET_HOSTNAME" ]] || TARGET_HOSTNAME="$MAKEDIST_TARGET"
[[ "$TARGET_DOMAIN" ]] || TARGET_DOMAIN="localdomain" [[ "$TARGET_DOMAIN" ]] || TARGET_DOMAIN="localdomain"
echo "$TARGET_HOSTNAME" > $MOUNTDIR/etc/hostname
sed -i "s|HOSTNAME=.*|HOSTNAME=$TARGET_HOSTNAME|" $MOUNTDIR/etc/sysconfig/network sed -i "s|HOSTNAME=.*|HOSTNAME=$TARGET_HOSTNAME|" $MOUNTDIR/etc/sysconfig/network
sed -i "s|\(127\.0\.0\.1\W*\)\(.*\)|\1 $TARGET_HOSTNAME.$TARGET_DOMAIN $TARGET_HOSTNAME \2|" \ sed -i "s|\(127\.0\.0\.1\W*\)\(.*\)|\1 $TARGET_HOSTNAME.$TARGET_DOMAIN $TARGET_HOSTNAME \2|" \
$MOUNTDIR/etc/hosts $MOUNTDIR/etc/hosts