diff options
| -rw-r--r-- | config-daemon.ac | 4 | ||||
| -rw-r--r-- | nix/libstore/local-store.cc | 17 | ||||
| -rw-r--r-- | nix/local.mk | 7 | ||||
| -rw-r--r-- | nix/nix-daemon/guix-daemon.cc | 12 | ||||
| -rw-r--r-- | nix/scripts/authenticate.in (renamed from nix/scripts/guix-authenticate.in) | 0 |
5 files changed, 19 insertions, 21 deletions
diff --git a/config-daemon.ac b/config-daemon.ac index 04f0fde3b24..aac46817f55 100644 --- a/config-daemon.ac +++ b/config-daemon.ac | |||
| @@ -163,8 +163,8 @@ if test "x$guix_build_daemon" = "xyes"; then | |||
| 163 | [chmod +x nix/scripts/download]) | 163 | [chmod +x nix/scripts/download]) |
| 164 | AC_CONFIG_FILES([nix/scripts/substitute], | 164 | AC_CONFIG_FILES([nix/scripts/substitute], |
| 165 | [chmod +x nix/scripts/substitute]) | 165 | [chmod +x nix/scripts/substitute]) |
| 166 | AC_CONFIG_FILES([nix/scripts/guix-authenticate], | 166 | AC_CONFIG_FILES([nix/scripts/authenticate], |
| 167 | [chmod +x nix/scripts/guix-authenticate]) | 167 | [chmod +x nix/scripts/authenticate]) |
| 168 | AC_CONFIG_FILES([nix/scripts/offload], | 168 | AC_CONFIG_FILES([nix/scripts/offload], |
| 169 | [chmod +x nix/scripts/offload]) | 169 | [chmod +x nix/scripts/offload]) |
| 170 | fi | 170 | fi |
diff --git a/nix/libstore/local-store.cc b/nix/libstore/local-store.cc index 4c55c6ea0db..0aed59710fe 100644 --- a/nix/libstore/local-store.cc +++ b/nix/libstore/local-store.cc | |||
| @@ -1222,6 +1222,18 @@ static void checkSecrecy(const Path & path) | |||
| 1222 | } | 1222 | } |
| 1223 | 1223 | ||
| 1224 | 1224 | ||
| 1225 | static std::string runAuthenticationProgram(const Strings & args) | ||
| 1226 | { | ||
| 1227 | /* Use the 'authenticate' script from 'LIBEXECDIR/guix' or just | ||
| 1228 | 'LIBEXECDIR', depending on whether we're uninstalled or not. */ | ||
| 1229 | const bool installed = getenv("GUIX_UNINSTALLED") == NULL; | ||
| 1230 | const string program = settings.nixLibexecDir | ||
| 1231 | + (installed ? "/guix" : "") | ||
| 1232 | + "/authenticate"; | ||
| 1233 | |||
| 1234 | return runProgram(program, false, args); | ||
| 1235 | } | ||
| 1236 | |||
| 1225 | void LocalStore::exportPath(const Path & path, bool sign, | 1237 | void LocalStore::exportPath(const Path & path, bool sign, |
| 1226 | Sink & sink) | 1238 | Sink & sink) |
| 1227 | { | 1239 | { |
| @@ -1276,7 +1288,8 @@ void LocalStore::exportPath(const Path & path, bool sign, | |||
| 1276 | args.push_back(secretKey); | 1288 | args.push_back(secretKey); |
| 1277 | args.push_back("-in"); | 1289 | args.push_back("-in"); |
| 1278 | args.push_back(hashFile); | 1290 | args.push_back(hashFile); |
| 1279 | string signature = runProgram(OPENSSL_PATH, true, args); | 1291 | |
| 1292 | string signature = runAuthenticationProgram(args); | ||
| 1280 | 1293 | ||
| 1281 | writeString(signature, hashAndWriteSink); | 1294 | writeString(signature, hashAndWriteSink); |
| 1282 | 1295 | ||
| @@ -1366,7 +1379,7 @@ Path LocalStore::importPath(bool requireSignature, Source & source) | |||
| 1366 | args.push_back("-pubin"); | 1379 | args.push_back("-pubin"); |
| 1367 | args.push_back("-in"); | 1380 | args.push_back("-in"); |
| 1368 | args.push_back(sigFile); | 1381 | args.push_back(sigFile); |
| 1369 | string hash2 = runProgram(OPENSSL_PATH, true, args); | 1382 | string hash2 = runAuthenticationProgram(args); |
| 1370 | 1383 | ||
| 1371 | /* Note: runProgram() throws an exception if the signature | 1384 | /* Note: runProgram() throws an exception if the signature |
| 1372 | is invalid. */ | 1385 | is invalid. */ |
diff --git a/nix/local.mk b/nix/local.mk index 7d45f200b86..fe45c344f0b 100644 --- a/nix/local.mk +++ b/nix/local.mk | |||
| @@ -113,7 +113,6 @@ libstore_a_CPPFLAGS = \ | |||
| 113 | -DGUIX_CONFIGURATION_DIRECTORY=\"$(sysconfdir)/guix\" \ | 113 | -DGUIX_CONFIGURATION_DIRECTORY=\"$(sysconfdir)/guix\" \ |
| 114 | -DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \ | 114 | -DNIX_LIBEXEC_DIR=\"$(libexecdir)\" \ |
| 115 | -DNIX_BIN_DIR=\"$(bindir)\" \ | 115 | -DNIX_BIN_DIR=\"$(bindir)\" \ |
| 116 | -DOPENSSL_PATH="\"guix-authenticate\"" \ | ||
| 117 | -DDEFAULT_CHROOT_DIRS="\"\"" | 116 | -DDEFAULT_CHROOT_DIRS="\"\"" |
| 118 | 117 | ||
| 119 | libstore_a_CXXFLAGS = $(AM_CXXFLAGS) \ | 118 | libstore_a_CXXFLAGS = $(AM_CXXFLAGS) \ |
| @@ -168,10 +167,8 @@ nodist_pkglibexec_SCRIPTS += \ | |||
| 168 | 167 | ||
| 169 | endif BUILD_DAEMON_OFFLOAD | 168 | endif BUILD_DAEMON_OFFLOAD |
| 170 | 169 | ||
| 171 | 170 | nodist_pkglibexec_SCRIPTS += \ | |
| 172 | # XXX: It'd be better to hide it in $(pkglibexecdir). | 171 | %D%/scripts/authenticate |
| 173 | nodist_libexec_SCRIPTS = \ | ||
| 174 | %D%/scripts/guix-authenticate | ||
| 175 | 172 | ||
| 176 | # The '.service' files for systemd. | 173 | # The '.service' files for systemd. |
| 177 | systemdservicedir = $(libdir)/systemd/system | 174 | systemdservicedir = $(libdir)/systemd/system |
diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc index b71b100f6c0..8fdab2d1165 100644 --- a/nix/nix-daemon/guix-daemon.cc +++ b/nix/nix-daemon/guix-daemon.cc | |||
| @@ -466,18 +466,6 @@ main (int argc, char *argv[]) | |||
| 466 | { | 466 | { |
| 467 | settings.processEnvironment (); | 467 | settings.processEnvironment (); |
| 468 | 468 | ||
| 469 | /* Hackily help 'local-store.cc' find our 'guix-authenticate' program, which | ||
| 470 | is known as 'OPENSSL_PATH' here. */ | ||
| 471 | std::string search_path; | ||
| 472 | search_path = settings.nixLibexecDir; | ||
| 473 | if (getenv ("PATH") != NULL) | ||
| 474 | { | ||
| 475 | search_path += ":"; | ||
| 476 | search_path += getenv ("PATH"); | ||
| 477 | } | ||
| 478 | |||
| 479 | setenv ("PATH", search_path.c_str (), 1); | ||
| 480 | |||
| 481 | /* Use our substituter by default. */ | 469 | /* Use our substituter by default. */ |
| 482 | settings.substituters.clear (); | 470 | settings.substituters.clear (); |
| 483 | settings.set ("build-use-substitutes", "true"); | 471 | settings.set ("build-use-substitutes", "true"); |
diff --git a/nix/scripts/guix-authenticate.in b/nix/scripts/authenticate.in index 5ce57915f02..5ce57915f02 100644 --- a/nix/scripts/guix-authenticate.in +++ b/nix/scripts/authenticate.in | |||
