type info = { name : string, section : string, descr : string, installed : bool }
-fun validName s = CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"_" orelse ch = #"-") s
+fun validName s = CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"_" orelse ch = #"-" orelse ch = #".") s
andalso (size s > 0 andalso String.sub (s, 0) <> #"-")
-fun query name =
+fun query {node, pkg = name} =
let
val _ =
if validName name then
let
val _ = Unix.reap proc
- val proc = Unix.execute ("/usr/bin/dpkg", ["-l", name])
- val inf = Unix.textInstreamOf proc
- val installed =
- case TextIO.inputLine inf of
- NONE => false
- | SOME line => String.sub (line, 0) = #"D"
-
- val _ = Unix.reap proc
+ val installed = OS.Process.isSuccess (OS.Process.system ("DOMTOOL_USER=hcoop /usr/local/bin/domtool-admin package " ^ Init.nodeName node ^ " " ^ name ^ " >/dev/null 2>/dev/null"))
in
SOME {name = name, section = section, descr = descr, installed = installed}
end
NONE)
end
-end
\ No newline at end of file
+end