From da79ab440b5d672b011859beaa11b4325aa69294 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sat, 30 May 2020 11:23:05 -0400 Subject: Do not hardcode "stretch" Instead, get codename (used to determine versions for all the packages) from '/etc/os-release' This should be specifiable (and inherited) in the yaml config file too. The *.devices mechanism shows the need to create inheritable "settings." Perhaps they should be in Haskell not through the filesystem. --- fsmgr.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fsmgr.hs b/fsmgr.hs index 2a2d09c..b1ee647 100644 --- a/fsmgr.hs +++ b/fsmgr.hs @@ -53,8 +53,8 @@ uname = unsafePerformIO $ do Stdout out <- cmd "uname -r" return $ last . wordsBy '-' . head . lines $ out -aptListFiles :: [FilePath] -aptListFiles = ("/var/lib/apt/lists" ) <$> observedCorrectListForStretch +aptListFiles :: String -> [FilePath] +aptListFiles codename = ("/var/lib/apt/lists" ) . (replace "stretch" codename) <$> observedCorrectListForStretch where observedCorrectListForStretch = [ "httpredir.debian.org_debian_dists_stretch_main_binary-amd64_Packages" @@ -95,7 +95,8 @@ buildRoot config@DiskImageConfig{..} finalOut = do ["dpkg"] [if unpackOnly then "--unpack" else "--install"] (dynamicNames <$> debs) {- 2.5. install apt package cache -} when installAptLists $ do - cmd_ "rsync -Ra" (("/./" ++) <$> aptListFiles) (mountpoint ++ "/") + (Stdout codename) <- cmd "sh -c" [". /etc/os-release && [ \"$VERSION_CODENAME\" ] && echo -n $VERSION_CODENAME"] + cmd_ "rsync -Ra" (("/./" ++) <$> aptListFiles codename) (mountpoint ++ "/") {- 3. binaries -} let go b = do p <- fromMaybe (fail $ "not found in ${PATH}: " ++ b) <$> liftIO (pathLocate b) -- cgit v1.2.3