3 ## live-build(7) - System Build Scripts
4 ## Copyright (C) 2006-2014 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/resolv.conf')"
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/resolv.conf"
35 Check_stagefile .build
/chroot_resolv
43 if [ -e chroot
/etc
/resolv.conf
]
45 # Save resolv file or symlink
46 mv chroot
/etc
/resolv.conf chroot
/etc
/resolv.conf.orig
48 # Also truncate it, otherwise we'll end up with the one
49 # created by debootstrap in the final image.
51 # If you want to have a custom resolv.conf, please
52 # overwrite it with normal local_includes mechanism.
53 Truncate chroot
/etc
/resolv.conf.orig
54 elif [ -L chroot
/etc
/resolv.conf
]
56 # Move resolv.conf aside if it's a symlink (likely resolvconf)
57 mv chroot
/etc
/resolv.conf chroot
/etc
/resolv.conf.orig
60 if [ -f /etc
/resolv.conf
]
63 cp /etc
/resolv.conf chroot
/etc
/resolv.conf
67 Create_stagefile .build
/chroot_resolv
71 Echo_message
"Deconfiguring file /etc/resolv.conf"
79 if [ -e config
/includes.chroot
/etc
/resolv.conf
]
81 # Copying local resolv.conf
82 cp -a config
/includes.chroot
/etc
/resolv.conf chroot
/etc
/resolv.conf
83 rm -f chroot
/etc
/resolv.conf.orig
84 elif [ -e chroot
/etc
/resolv.conf.orig
] ||
[ -L chroot
/etc
/resolv.conf.orig
]
86 # Restoring resolv file or symlink
87 mv chroot
/etc
/resolv.conf.orig chroot
/etc
/resolv.conf
89 # Truncating resolv file
90 Truncate chroot
/etc
/resolv.conf
93 # Clean up resolvconf's pollution
94 if [ -e chroot
/etc
/resolvconf
/resolv.conf.d
]
96 rm -f chroot
/etc
/resolvconf
/resolv.conf.d
/original
97 rm -f chroot
/etc
/resolvconf
/resolv.conf.d
/tail
100 # Removing stage file
101 rm -f .build
/chroot_resolv