summaryrefslogtreecommitdiff
path: root/helpers/lh_chroot_hostname
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-09-23 10:05:17 +0200
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:22:26 +0100
commit0d0de885e32ff67d57bb7def451b62d75b8920ab (patch)
treecd4a159a86207401dbd5990bc0fa3c28825ab6f8 /helpers/lh_chroot_hostname
parentc68c0a270832ca340429878ce6a0ab606d435b06 (diff)
downloadvyos-live-build-0d0de885e32ff67d57bb7def451b62d75b8920ab.tar.gz
vyos-live-build-0d0de885e32ff67d57bb7def451b62d75b8920ab.zip
Adding live-helper 1.0~a22-1.
Diffstat (limited to 'helpers/lh_chroot_hostname')
-rwxr-xr-xhelpers/lh_chroot_hostname42
1 files changed, 19 insertions, 23 deletions
diff --git a/helpers/lh_chroot_hostname b/helpers/lh_chroot_hostname
index be3b6af65..7d04d68df 100755
--- a/helpers/lh_chroot_hostname
+++ b/helpers/lh_chroot_hostname
@@ -1,6 +1,6 @@
#!/bin/sh
-# lh_chroot_hostname(1) - manage /etc/hostname
+# lh_chroot_hostname(1) - manage /bin/hostname
# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org>
#
# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
@@ -18,7 +18,7 @@ do
done
# Setting static variables
-DESCRIPTION="manage /etc/hostname"
+DESCRIPTION="manage /bin/hostname"
HELP=""
USAGE="${PROGRAM} {install|remove} [--force]"
@@ -48,17 +48,23 @@ case "${1}" in
# Creating lock file
Create_lockfile .lock
- if [ -f chroot/etc/hostname ]
- then
- # Save hostname file
- mv chroot/etc/hostname chroot/etc/hostname.orig
- fi
+ # Save hostname
+ mv chroot/bin/hostname chroot/bin/hostname.orig
# Create hostname file
echo "localhost.localdomain" > chroot/etc/hostname
- # Set hostname
- Chroot "hostname -F /etc/hostname"
+ Echo_message "Configuring file /bin/hostname"
+
+ # Create hostname program
+
+cat > chroot/bin/hostname << EOF
+#!/bin/sh
+
+echo "localhost.localdomain"
+EOF
+
+ chmod 755 chroot/bin/hostname
# Creating stage file
Create_stagefile .stage/chroot_hostname
@@ -73,20 +79,10 @@ case "${1}" in
# Creating lock file
Create_lockfile .lock
- if [ -f chroot/etc/hostname.orig ]
- then
- # Restore hostname file
- mv chroot/etc/hostname.orig chroot/etc/hostname
- else
- # Remove hostname file
- rm -f chroot/etc/hostname
- fi
-
- # Set hostname (somehow this seems to be really needed :/)
- if [ -f /etc/hostname ]
- then
- hostname -F /etc/hostname
- fi
+ Echo_message "Deconfiguring file /bin/hostname"
+
+ # Restore hostname file
+ mv chroot/bin/hostname.orig chroot/bin/hostname
# Removing stage file
rm -f .stage/chroot_hostname