1 # Filename: 02_chroot.sh
2 # Purpose: build script for creating grml live-cd
3 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
4 # Bug-Reports: see http://grml.org/bugs/
5 # License: This file is licensed under the GPL v2.
6 # Latest change: Tue Feb 13 00:37:19 CET 2007
7 ################################################################################
10 chroot "$TARGET" /bin/bash
14 chroot "$TARGET" /usr/bin/env -i HOME="/root" PATH="/usr/sbin:/usr/bin:/sbin:/bin" TERM="${TERM}" \
15 DEBIAN_FRONTEND="${DEBCONF_FRONTEND}" DEBIAN_PRIORITY="${DEBCONF_PRIORITY}" ${1}
23 debug "executing patch_chroot in apply mode"
24 echo "grml-live" > "${TARGET}"/etc/debian_chroot
25 [ -f "${TARGET}"/etc/hosts ] && cp "${TARGET}"/etc/hosts "$TARGET"/etc/hosts.orig
26 [ -f /etc/hosts ] && cp /etc/hosts "$TARGET"/etc/hosts
27 [ -f "${TARGET}"/etc/resolv.conf ] && cp "${TARGET}"/etc/resolv.conf "$TARGET"/etc/resolv.conf.orig
28 [ -f /etc/resolv.conf ] && cp /etc/resolv.conf "$TARGET"/etc/resolv.conf
29 # TODO: make sure to fix setup of grml-policy.rc.d
30 cat > "${TARGET}"/usr/sbin/policy-rc.d <<EOF
33 echo "Information: policy-rc.d in action."
36 chmod 755 "${TARGET}"/usr/sbin/policy-rc.d
40 debug "executing patch_chroot in deapply mode"
41 rm -f "${TARGET}"/etc/debian_chroot
43 if [ -f "${TARGET}"/etc/hosts.orig ] ; then
44 mv "${TARGET}"/etc/hosts.orig "$TARGET"/etc/hosts
46 rm -f "$TARGET"/etc/hosts
49 # TODO: adjust for grml-policy.rc.d
50 if [ -f "${TARGET}"/etc/resolv.conf.orig ] ; then
51 mv "${TARGET}"/etc/resolv.conf.orig "$TARGET"/etc/resolv.conf
53 rm -f "$TARGET"/etc/resolv.conf
56 rm -f "${TARGET}"/usr/sbin/policy-rc.d
61 chroot_live_prepare() {
62 debug "preparing grml-live directory in chroot"
63 if [ -n "$SOURCES_LIST" ] ; then
64 echo $SOURCES_LIST > "${TARGET}"/grml-live/files/sources.list
67 cat > "${TARGET}"/grml-live/scripts/install_packages.sh << EOF
70 if ! [ -f /etc/apt/grml.key ] ; then
71 gpg --keyserver subkeys.pgp.net --recv-keys F61E2E7CECDEA787
72 gpg --export F61E2E7CECDEA787 > /etc/apt/grml.key
73 apt-key add /etc/apt/grml.key
81 chmod 755 "${TARGET}"/grml-live/scripts/install_packages.sh
84 chroot_live_execute() {
85 debug "executing grml-live script in chroot"
86 chroot_exec /grml-live/scripts/install_packages.sh
89 ## END OF FILE #################################################################
90 # vim: ai tw=80 ft=sh expandtab