From 4b4de008b197db29496e71bf6d6aee9562928467 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sat, 13 Mar 2021 19:52:35 -0500 Subject: Ensure apt is updated before dpkg tries to install our deb packages (When option 'apt-update' is true.) This with other changes being committed today allows .deb files to depend on packages from sid. --- fsmgr.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'fsmgr.hs') diff --git a/fsmgr.hs b/fsmgr.hs index 948ef8b..834ab4a 100644 --- a/fsmgr.hs +++ b/fsmgr.hs @@ -147,6 +147,10 @@ buildRoot config@DiskImageConfig{..} finalOut = do {- 1. debconf -} forM_ debconfConfig $ readFile' >=> liftIO . appendFile (mountpoint "var/cache/debconf/config.dat") + {- 1.5. install apt package cache -} + when installAptLists $ do + cmd_ "rsync -Ra" (("/./" ++) <$> aptListFiles aptListCfg) (mountpoint ++ "/") + cmd_ "chroot" [mountpoint] "/bin/sh -c" ["apt-cache dumpavail | dpkg --update-avail -"] {- 2. dpkg installs -} let (fmap dynamicNames -> debs, packageNames) = partitionPackages $ unpack . coerce <$> toList packages when (noParent initialImage || not (null packageNames)) $ @@ -158,9 +162,6 @@ buildRoot config@DiskImageConfig{..} finalOut = do need debs cmd_ (AddEnv "DEBIAN_FRONTEND" "noninteractive") ["dpkg"] [if unpackOnly then "--unpack" else "--install"] ["--root", mountpoint] debs - {- 2.5. install apt package cache -} - when installAptLists $ do - cmd_ "rsync -Ra" (("/./" ++) <$> aptListFiles aptListCfg) (mountpoint ++ "/") {- 3. binaries -} let go b = do p <- fromMaybe (fail $ "not found in ${PATH}: " ++ b) <$> liftIO (pathLocate b) -- cgit v1.2.3