summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorRui Miguel Bernardo <rui.bernardo.pt@gmail.com>2009-10-28 13:10:38 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 19:09:48 +0100
commit7523992b6a479359b5457b95568a376b3a2ef8e4 (patch)
tree47d53be323f27593b11b98ebddc5169d0179ce20 /helpers
parent22992d84b040845cd412790793368003a89db344 (diff)
downloadlive-build-7523992b6a479359b5457b95568a376b3a2ef8e4.zip
live-build-7523992b6a479359b5457b95568a376b3a2ef8e4.tar.gz
Correcting apt pinning support.
Diffstat (limited to 'helpers')
-rwxr-xr-xhelpers/lh_chroot_apt43
1 files changed, 34 insertions, 9 deletions
diff --git a/helpers/lh_chroot_apt b/helpers/lh_chroot_apt
index 1196cea..1c35849 100755
--- a/helpers/lh_chroot_apt
+++ b/helpers/lh_chroot_apt
@@ -120,11 +120,6 @@ case "${1}" in
if Find_files config/chroot_local-packages/*.deb
then
- if [ ! -f config/chroot_apt/preferences ] && [ "${1}" = "install-binary" ]
- then
- rm -f chroot/etc/apt/preferences
- fi
-
echo >> chroot/etc/apt/preferences
echo "# Added by lh_chroot_apt ${@}" >> chroot/etc/apt/preferences
echo "Package: *" >> chroot/etc/apt/preferences
@@ -197,14 +192,44 @@ case "${1}" in
fi
cp config/chroot_apt/apt.conf chroot/etc/apt/apt.conf
+
+ if [ -f chroot/etc/apt/apt.conf.orig ]
+ then
+ mv chroot/etc/apt/apt.conf.orig chroot/etc/apt/apt.conf
+ fi
fi
# Deconfiguring apt preferences
- if [ -f chroot/etc/apt/preferences.orig ]
+ if [ -f config/chroot_apt/preferences ]
+ then
+ if [ -f chroot/etc/apt/preferences ]
+ then
+ mv chroot/etc/apt/preferences chroot/etc/apt/preferences.orig
+ fi
+
+ cp config/chroot_apt/preferences chroot/etc/apt/preferences
+
+ if [ -f chroot/etc/apt/preferences.orig ]
+ then
+ mv chroot/etc/apt/preferences.orig chroot/etc/apt/preferences
+ fi
+ fi
+
+ if Find_files config/chroot_local-packages/*.deb
then
- mv chroot/etc/apt/preferences.orig chroot/etc/apt/preferences
- else
- rm -f chroot/etc/apt/preferences
+ if [ -f chroot/etc/apt/preferences ]
+ then
+ # delete additions from lh_chroot_apt install|install-binary to preferences
+ sed -i '/# Added by lh_chroot_apt/,$d' chroot/etc/apt/preferences
+ # delete the last empty line
+ sed -i '${/^[[:blank:]]*$/d;}' chroot/etc/apt/preferences
+ # if the resulting preferences file is empty there was no user additions, remove it
+ if [ ! -s chroot/etc/apt/preferences ]
+ then
+ rm -rf chroot/etc/apt/preferences
+ fi
+ fi
+
fi
# Removing stage file