- (* Look for 'pkg*.pkg.tar.xz' in the list of files. *)
- let pre = pkg in
- let r = ref "" in
- try
- for i = 0 to Array.length files - 1 do
- if string_prefix pre files.(i) then (
- r := files.(i);
- files.(i) <- "";
- raise Exit
- )
- done;
- eprintf "febootstrap: pacman: error: no file was downloaded corresponding to package %s\n" pkg;
- exit 1
- with
- Exit -> !r
- ) pkgs in *)
+ let cmd =
+ sprintf "cd %s && mkdir -p var/lib/pacman && fakeroot pacman -Syw --noconfirm --cachedir=$(pwd) --root=$(pwd) %s"
+ (Filename.quote tmpdir)
+ pkg in
+ if Sys.command cmd <> 0 then (
+ (* The package is not in the main repos, check the aur *)
+ let cmd =
+ sprintf "cd %s && wget http://aur.archlinux.org/packages/%s/%s.tar.gz && tar xf %s.tar.gz && cd %s && makepkg && mv %s-*.pkg.tar.xz %s"
+ (Filename.quote tmpdir)
+ pkg
+ pkg
+ pkg
+ pkg
+ pkg
+ (Filename.quote tmpdir) in
+ run_command cmd;
+ )
+ ) pkgs;