Selectively remove chroot-only APT configuration and preferences instead of wiping...
authorJan Blunck <jblunck@vyatta.com>
Wed, 18 Sep 2013 08:48:21 +0000 (10:48 +0200)
committerJan Blunck <jblunck@vyatta.com>
Wed, 18 Sep 2013 08:48:21 +0000 (10:48 +0200)
scripts/build/chroot_archives

index 226bad6..d45aa52 100755 (executable)
@@ -673,10 +673,6 @@ EOF
                        fi
                fi
 
-               # probably too bold, needs refinment (FIXME)
-               rm -f chroot/etc/apt/conf.d/*
-               rm -f chroot/etc/apt/preferences.d/*
-
                # Removing chroot-only apt sources
                for FILE in config/archives/*.list.chroot
                do
@@ -686,6 +682,24 @@ EOF
                        fi
                done
 
+               # Removing chroot-only apt configuration
+               for FILE in config/archives/*.conf.chroot
+               do
+                       if [ -e "${FILE}" ]
+                       then
+                               rm -f "chroot/etc/apt/conf.d/$(basename ${FILE} .chroot)"
+                       fi
+               done
+
+               # Removing chroot-only apt preferences
+               for FILE in config/archives/*.pref.chroot
+               do
+                       if [ -e "${FILE}" ]
+                       then
+                               rm -f "chroot/etc/apt/preferences.d/$(basename ${FILE} .chroot)"
+                       fi
+               done
+
                # Adding local apt sources (binary)
                for FILE in config/archives/*.list config/archives/*.list.binary
                do