From 04cf72287bc27e4eca69d527ce44a88b7fcbebb2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 31 May 2006 09:24:54 +0000 Subject: [PATCH] * This may be useful in the future. --- scripts/Makefile.am | 4 +++- scripts/nix-pull.in | 2 +- scripts/readconfig.pm.in | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 scripts/readconfig.pm.in diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 428d3fa698..bffbdbde5d 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -5,13 +5,14 @@ bin_SCRIPTS = nix-collect-garbage \ noinst_SCRIPTS = nix-profile.sh generate-patches.pl -nix-pull nix-push: readmanifest.pm download-using-manifests.pl +nix-pull nix-push: readmanifest.pm readconfig.pm download-using-manifests.pl install-exec-local: readmanifest.pm download-using-manifests.pl $(INSTALL) -d $(DESTDIR)$(sysconfdir)/profile.d $(INSTALL_PROGRAM) nix-profile.sh $(DESTDIR)$(sysconfdir)/profile.d/nix.sh $(INSTALL) -d $(DESTDIR)$(libexecdir)/nix $(INSTALL_DATA) readmanifest.pm $(DESTDIR)$(libexecdir)/nix + $(INSTALL_DATA) readconfig.pm $(DESTDIR)$(libexecdir)/nix $(INSTALL_PROGRAM) download-using-manifests.pl $(DESTDIR)$(libexecdir)/nix $(INSTALL) -d $(DESTDIR)$(sysconfdir)/nix @@ -22,6 +23,7 @@ EXTRA_DIST = nix-collect-garbage.in \ nix-prefetch-url.in nix-install-package.in \ nix-channel.in \ readmanifest.pm.in \ + readconfig.pm.in \ nix-build.in \ download-using-manifests.pl.in \ generate-patches.pl.in \ diff --git a/scripts/nix-pull.in b/scripts/nix-pull.in index eb14a17395..67a7838f19 100644 --- a/scripts/nix-pull.in +++ b/scripts/nix-pull.in @@ -26,7 +26,7 @@ $stateDir = "@localstatedir@/nix" unless defined $stateDir; umask 0022; -# Obtain URLs either from the command line or from a configuration file. +# Process the URLs specified on the command line. my %narFiles; my %patches; my %successors; diff --git a/scripts/readconfig.pm.in b/scripts/readconfig.pm.in new file mode 100644 index 0000000000..aeb443aeed --- /dev/null +++ b/scripts/readconfig.pm.in @@ -0,0 +1,17 @@ +use strict; + +sub readConfig { + my %config; + my $config = "@sysconfdir@/nix/nix.conf"; + return unless -f $config; + + open CONFIG, "<$config" or die "cannot open `$config'"; + while () { + /^\s*([\w|-]+)\s*=\s*(.*)$/ or next; + $config{$1} = $2; + print "|$1| -> |$2|\n"; + } + close CONFIG; +} + +return 1;