use USER environmental variable if getting user id by getpwuid is failed in perl scripts: download-from-binary-cache.pl and nix-channel
This commit is contained in:
parent
dcaea042fc
commit
8a02fdc38e
2 changed files with 2 additions and 2 deletions
|
@ -40,7 +40,7 @@ my %requests;
|
||||||
my %scheduled;
|
my %scheduled;
|
||||||
my $caBundle = $ENV{"CURL_CA_BUNDLE"} // $ENV{"OPENSSL_X509_CERT_FILE"};
|
my $caBundle = $ENV{"CURL_CA_BUNDLE"} // $ENV{"OPENSSL_X509_CERT_FILE"};
|
||||||
|
|
||||||
my $userName = getpwuid($<) or die "cannot figure out user name";
|
my $userName = getpwuid($<) or $ENV{"USER"} or die "cannot figure out user name";
|
||||||
|
|
||||||
my $requireSignedBinaryCaches = ($Nix::Config::config{"signed-binary-caches"} // "0") ne "0";
|
my $requireSignedBinaryCaches = ($Nix::Config::config{"signed-binary-caches"} // "0") ne "0";
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ my $channelsList = "$home/.nix-channels";
|
||||||
my $nixDefExpr = "$home/.nix-defexpr";
|
my $nixDefExpr = "$home/.nix-defexpr";
|
||||||
|
|
||||||
# Figure out the name of the channels profile.
|
# Figure out the name of the channels profile.
|
||||||
my $userName = getpwuid($<) or die "cannot figure out user name";
|
my $userName = getpwuid($<) or $ENV{"USER"} or die "cannot figure out user name");
|
||||||
my $profile = "$Nix::Config::stateDir/profiles/per-user/$userName/channels";
|
my $profile = "$Nix::Config::stateDir/profiles/per-user/$userName/channels";
|
||||||
mkpath(dirname $profile, 0, 0755);
|
mkpath(dirname $profile, 0, 0755);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue