diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-09-24 22:33:02 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-09-24 23:40:49 +0200 |
commit | 923206f79b2e3e1b7c4afbf03aae9c6b4f715d3e (patch) | |
tree | c59daf3fd8000ece306728a81b430b34d064e0cb /nix/guix-register | |
parent | 9d3c4daed35b3393ea06e168ab669813a3278b60 (diff) |
guix-register: Allow the initial directory creation to proceed.
This fixes a bug whereby 'guix-register' would bail out when trying to
create NIX_STORE_DIR/.links when NIX_STORE_DIR is read-only.
* nix/guix-register/guix-register.cc (parse_opt): Initialize
'settings.nixStore' to PREFIX + NIX_STORE_DIR.
(main): Change 'settings.nixStore' once the 'LocalStore' has been
instantiated.
Diffstat (limited to 'nix/guix-register')
-rw-r--r-- | nix/guix-register/guix-register.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nix/guix-register/guix-register.cc b/nix/guix-register/guix-register.cc index 8f9c3c86ab..14478f6a13 100644 --- a/nix/guix-register/guix-register.cc +++ b/nix/guix-register/guix-register.cc @@ -75,7 +75,7 @@ parse_opt (int key, char *arg, struct argp_state *state) case 'p': { prefix = canonPath (arg); - settings.nixStore = NIX_STORE_DIR; + settings.nixStore = prefix + NIX_STORE_DIR; settings.nixDataDir = prefix + NIX_DATA_DIR; settings.nixLogDir = prefix + NIX_LOG_DIR; settings.nixStateDir = prefix + NIX_STATE_DIR; @@ -169,7 +169,15 @@ main (int argc, char *argv[]) { argp_parse (&argp, argc, argv, 0, 0, 0); + /* Instantiate the store. This creates any missing directories among + 'settings.nixStore', 'settings.nixDBPath', etc. */ LocalStore store; + + /* Under the --prefix tree, the final name of the store will be + NIX_STORE_DIR. Set it here so that the database uses file names + prefixed by NIX_STORE_DIR and not PREFIX + NIX_STORE_DIR. */ + settings.nixStore = NIX_STORE_DIR; + register_validity (&store, *input); } catch (std::exception &e) |