#!/bin/sh # lh_patchnetwork.sh # Packages which are manually installed inside the chroot are installed # from the network. Therefore, we need to be able to resolv hosts. case "${1}" in apply-hosts) # Save host lookup table if [ -f "${LIVE_CHROOT}"/etc/hosts ] then cp "${LIVE_CHROOT}"/etc/hosts \ "${LIVE_CHROOT}"/etc/hosts.orig fi # Copy host lookup table if [ -f /etc/hosts ] then cp /etc/hosts "${LIVE_CHROOT}"/etc/hosts fi ;; apply-resolv) # Save resolver configuration if [ -f "${LIVE_CHROOT}"/etc/resolv.conf ] then cp "${LIVE_CHROOT}"/etc/resolv.conf \ "${LIVE_CHROOT}"/etc/resolv.conf.orig fi # Copy resolver configuration if [ -f /etc/resolv.conf ] then cp /etc/resolv.conf "${LIVE_CHROOT}"/etc/resolv.conf fi ;; deapply-hosts) # Restore host lookup table if [ -f "${LIVE_CHROOT}"/etc/hosts.orig ] then mv "${LIVE_CHROOT}"/etc/hosts.orig \ "${LIVE_CHROOT}"/etc/hosts else rm -f "${LIVE_CHROOT}"/etc/hosts fi ;; deapply-resolv) # Restore resolver configuration if [ -f "${LIVE_CHROOT}"/etc/resolv.conf.orig ] then mv "${LIVE_CHROOT}"/etc/resolv.conf.orig \ "${LIVE_CHROOT}"/etc/resolv.conf else rm -f "${LIVE_CHROOT}"/etc/resolv.conf fi ;; esac