Skip to content

Commit

Permalink
archlinux: Add pacman configuration option.
Browse files Browse the repository at this point in the history
  • Loading branch information
Evaggelos Balaskas authored and rwmjones committed Dec 21, 2012
1 parent cfc8764 commit bfecae4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/febootstrap.pod
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ written (C<hostfiles> and C<base.img>). The default directory is the
current directory. Note that if this files exist already in the
output directory then they will be overwritten.

=item B<--pacman-config CONFIGFILE>

(ArchLinux package handler only). Use an alternate configuration file
instead of C</etc/pacman.conf>. If you also want to specify alternate
repositories then you can put them in this file directly or add a
C<reposdir> option to this file. For more information on the file
format see L<pacman.conf(5)>.

=item B<--save-temps>

Don't remove temporary files and directories on exit. This is useful
Expand Down
7 changes: 7 additions & 0 deletions src/febootstrap_cmdline.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ let use_installed = ref false
let verbose = ref false
let warnings = ref true
let yum_config = ref None
let pacman_config = ref None

let print_version () =
printf "%s %s\n" Config.package_name Config.package_version;
Expand All @@ -38,6 +39,9 @@ let add_exclude re =
let set_yum_config str =
yum_config := Some str

let set_pacman_config str =
pacman_config := Some str

let argspec = Arg.align [
"--exclude", Arg.String add_exclude,
"regexp Exclude packages matching regexp";
Expand All @@ -47,6 +51,8 @@ let argspec = Arg.align [
" Suppress warnings";
"-o", Arg.Set_string outputdir,
"outputdir Set output directory (default: \".\")";
"--pacman-config", Arg.String set_pacman_config,
"file Set alternate pacman configuration file";
"--save-temp", Arg.Set save_temps,
" Don't delete temporary files and directories on exit.";
"--save-temps", Arg.Set save_temps,
Expand Down Expand Up @@ -96,5 +102,6 @@ let use_installed = !use_installed
let verbose = !verbose
let warnings = !warnings
let yum_config = !yum_config
let pacman_config = !pacman_config

let debug fs = ksprintf (fun str -> if verbose then print_endline str) fs
3 changes: 3 additions & 0 deletions src/febootstrap_cmdline.mli
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ val warnings : bool

val yum_config : string option
(** Yum configuration file. *)

val pacman_config : string option
(**pacman configuration file. *)
6 changes: 5 additions & 1 deletion src/febootstrap_pacman.ml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ let pacman_resolve_dependencies_and_download names =
(* Download the packages. I could use wget `pacman -Sp`, but this
* narrows the pacman -Sy window
*)

List.iter (
fun pkg ->
let cmd =
sprintf "umask 0000; cd %s && mkdir -p var/lib/pacman && fakeroot pacman -Syw --noconfirm --cachedir=$(pwd) --root=$(pwd) %s"
sprintf "umask 0000; cd %s && mkdir -p var/lib/pacman && fakeroot pacman%s -Syw --noconfirm --cachedir=$(pwd) --root=$(pwd) %s"
(Filename.quote tmpdir)
(match pacman_config with
| None -> ""
| Some filename -> " --config " ^ filename)
pkg in
if Sys.command cmd <> 0 then (
(* The package is not in the main repos, check the aur *)
Expand Down

0 comments on commit bfecae4

Please sign in to comment.