HCoop
/
hcoop
/
portal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Show the "add your link" dialog BEFORE hosted sites list
[hcoop/portal.git]
/
aptquery.sml
diff --git
a/aptquery.sml
b/aptquery.sml
index
bf0ec6a
..
d7fc8cc
100644
(file)
--- a/
aptquery.sml
+++ b/
aptquery.sml
@@
-3,10
+3,10
@@
struct
type info = { name : string, section : string, descr : string, installed : bool }
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) <> #"-")
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 _ =
if validName name then
@@
-14,7
+14,7
@@
fun query name =
else
raise Fail "Invalid package name"
else
raise Fail "Invalid package name"
- val proc = Unix.execute
("/usr/bin/apt-cache", ["show", name
])
+ val proc = Unix.execute
InEnv ("/usr/local/bin/domtool-admin", ["package-exists", Init.nodeName node, name], ["DOMTOOL_USER=hcoop"
])
val inf = Unix.textInstreamOf proc
fun loop (section, descr) =
val inf = Unix.textInstreamOf proc
fun loop (section, descr) =
@@
-33,7
+33,7
@@
fun query name =
let
val _ = Unix.reap proc
let
val _ = Unix.reap proc
- val installed = OS.Process.isSuccess (OS.Process.system ("
/usr/bin/dpkg -p
" ^ name ^ " >/dev/null 2>/dev/null"))
+ 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
in
SOME {name = name, section = section, descr = descr, installed = installed}
end