summaryrefslogtreecommitdiff
path: root/fsmgr.hs
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2020-05-30 11:23:05 -0400
committerAndrew Cady <d@jerkface.net>2020-05-30 11:23:17 -0400
commitda79ab440b5d672b011859beaa11b4325aa69294 (patch)
tree9f10d2be8ec19d029c110735520a438276004b8b /fsmgr.hs
parent41d5d8bfe3104f0a05bcb77999bac99f182d4eba (diff)
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.
Diffstat (limited to 'fsmgr.hs')
-rw-r--r--fsmgr.hs7
1 files 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
53 Stdout out <- cmd "uname -r" 53 Stdout out <- cmd "uname -r"
54 return $ last . wordsBy '-' . head . lines $ out 54 return $ last . wordsBy '-' . head . lines $ out
55 55
56aptListFiles :: [FilePath] 56aptListFiles :: String -> [FilePath]
57aptListFiles = ("/var/lib/apt/lists" </>) <$> observedCorrectListForStretch 57aptListFiles codename = ("/var/lib/apt/lists" </>) . (replace "stretch" codename) <$> observedCorrectListForStretch
58 where 58 where
59 observedCorrectListForStretch = 59 observedCorrectListForStretch =
60 [ "httpredir.debian.org_debian_dists_stretch_main_binary-amd64_Packages" 60 [ "httpredir.debian.org_debian_dists_stretch_main_binary-amd64_Packages"
@@ -95,7 +95,8 @@ buildRoot config@DiskImageConfig{..} finalOut = do
95 ["dpkg"] [if unpackOnly then "--unpack" else "--install"] (dynamicNames <$> debs) 95 ["dpkg"] [if unpackOnly then "--unpack" else "--install"] (dynamicNames <$> debs)
96 {- 2.5. install apt package cache -} 96 {- 2.5. install apt package cache -}
97 when installAptLists $ do 97 when installAptLists $ do
98 cmd_ "rsync -Ra" (("/./" ++) <$> aptListFiles) (mountpoint ++ "/") 98 (Stdout codename) <- cmd "sh -c" [". /etc/os-release && [ \"$VERSION_CODENAME\" ] && echo -n $VERSION_CODENAME"]
99 cmd_ "rsync -Ra" (("/./" ++) <$> aptListFiles codename) (mountpoint ++ "/")
99 {- 3. binaries -} 100 {- 3. binaries -}
100 let go b = do 101 let go b = do
101 p <- fromMaybe (fail $ "not found in ${PATH}: " ++ b) <$> liftIO (pathLocate b) 102 p <- fromMaybe (fail $ "not found in ${PATH}: " ++ b) <$> liftIO (pathLocate b)