3 ## live-build(7) - System Build Scripts
4 ## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
6 ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7 ## This is free software, and you are welcome to redistribute it
8 ## under certain conditions; see COPYING for details.
13 # Including common functions
14 [ -e "${LIVE_BUILD}/scripts/build.sh" ] && .
"${LIVE_BUILD}/scripts/build.sh" || .
/usr
/lib
/live
/build.sh
16 # Setting static variables
17 DESCRIPTION
="$(Echo 'manage /etc/hosts')"
19 USAGE
="${PROGRAM} {install|remove} [--force]"
23 # Reading configuration files
24 Read_conffiles config
/all config
/common config
/bootstrap config
/chroot config
/binary config
/source
27 # Requiring stage file
28 Require_stagefile .build
/config .build
/bootstrap
32 Echo_message
"Configuring file /etc/hosts"
35 Check_stagefile .build
/chroot_hosts
43 if [ -f chroot
/etc
/hosts
]
46 mv chroot
/etc
/hosts chroot
/etc
/hosts.orig
51 cat > chroot
/etc
/hosts
<< EOF
52 127.0.0.1 localhost localhost.localdomain
59 #grep -e "127.0.0.1" -e "127.0.1.1" /etc/hosts >> chroot/etc/hosts
60 cat /etc
/hosts
>> chroot
/etc
/hosts
64 Create_stagefile .build
/chroot_hosts
68 Echo_message
"Deconfiguring file /etc/hosts"
76 if [ -e config
/includes.chroot
/etc
/hosts
]
79 cp -a config
/includes.chroot
/etc
/hosts chroot
/etc
/hosts
80 rm -f chroot
/etc
/hosts.orig
81 elif [ -f chroot
/etc
/hosts.orig
]
84 mv chroot
/etc
/hosts.orig chroot
/etc
/hosts
86 # Blank out hosts file, don't remove in case its a symlink
87 Truncate chroot
/etc
/hosts
91 rm -f .build
/chroot_hosts