summaryrefslogtreecommitdiff
path: root/src/scripts/12patch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripts/12patch.sh')
-rw-r--r--src/scripts/12patch.sh56
1 files changed, 47 insertions, 9 deletions
diff --git a/src/scripts/12patch.sh b/src/scripts/12patch.sh
index 873865c..7f07241 100644
--- a/src/scripts/12patch.sh
+++ b/src/scripts/12patch.sh
@@ -58,16 +58,25 @@ Patch_network ()
case "${1}" in
apply)
- # Save host lookup table
- if [ -f "${LIVE_CHROOT}"/etc/hosts ]
+ # Save apt configuration
+ if [ -f "${LIVE_CHROOT}"/etc/apt/apt.conf ]
then
- cp "${LIVE_CHROOT}"/etc/hosts "${LIVE_CHROOT}"/etc/hosts.orig
+ cp "${LIVE_CHROOT}"/etc/apt/apt.conf "${LIVE_CHROOT}"/etc/apt/apt.conf.orig
fi
- # Save resolver configuration
- if [ -f "${LIVE_CHROOT}"/etc/resolv.conf ]
+ # Configure apt.conf
+ if [ -n "${LIVE_PROXY_FTP}" ]
then
- cp "${LIVE_CHROOT}"/etc/resolv.conf "${LIVE_CHROOT}"/etc/resolv.conf.orig
+ echo "Acquire::ftp::Proxy \"${LIVE_PROXY_FTP}\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf
+ elif [ -n "${LIVE_PROXY_HTTP}" ]
+ then
+ echo "Acquire::http::Proxy \"${LIVE_PROXY_HTTP}\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf
+ fi
+
+ # 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
@@ -76,6 +85,12 @@ Patch_network ()
cp /etc/hosts "${LIVE_CHROOT}"/etc/hosts
fi
+ # 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
@@ -84,16 +99,28 @@ Patch_network ()
;;
deapply)
+ # Restore apt configuration
+ if [ -f "${LIVE_CHROOT}"/etc/apt/apt.conf.orig ]
+ then
+ mv "${LIVE_CHROOT}"/etc/apt/apt.conf.orig "${LIVE_CHROOT}"/etc/apt/apt.conf
+ else
+ rm -f "${LIVE_CHROOT}"/etc/apt/apt.conf
+ fi
+
# 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
# 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
@@ -107,13 +134,24 @@ Patch_linux ()
case "${1}" in
apply)
- # Write configuration option
+ # Save kernel configuration
+ if [ -f "${LIVE_CHROOT}"/etc/kernel-img.conf ]
+ then
+ cp "${LIVE_CHROOT}"/etc/kernel-img.conf "${LIVE_CHROOT}"/etc/kernel-img.conf.old
+ fi
+
+ # Configure kernel-img.conf
echo "do_initrd = Yes" >> "${LIVE_CHROOT}"/etc/kernel-img.conf
;;
deapply)
- # Remove configuration file
- rm -f "${LIVE_CHROOT}"/etc/kernel-img.conf
+ # Restore kernel configuration
+ if [ -f "${LIVE_CHROOT}"/etc/kernel-img.conf.old ]
+ then
+ mv "${LIVE_CHROOT}"/etc/kernel-img.conf.old "${LIVE_CHROOT}"/etc/kernel-img.conf
+ else
+ rm -f "${LIVE_CHROOT}"/etc/kernel-img.conf
+ fi
;;
esac
}