mirror of
https://github.com/NixOS/nix.git
synced 2025-11-26 12:10:59 +01:00
Implemented runtime --share= and --unshare options. Fixed some things.
This commit is contained in:
parent
86f0fd8341
commit
d0458acb7c
14 changed files with 90 additions and 54 deletions
|
|
@ -1295,15 +1295,15 @@ void symlinkPath(const Path & existingDir, const Path & newLinkName) //TODO bool
|
|||
*/
|
||||
runProgram_AndPrintOutput("/bin/sh", true, p_args, "sh-ln");
|
||||
|
||||
executeShellCommand("whoami");
|
||||
executeShellCommand("pwd");
|
||||
//executeShellCommand("whoami");
|
||||
//executeShellCommand("pwd");
|
||||
printMsg(lvlError, format("ln -sf %1% %2%") % existingDir % newLinkName);
|
||||
}
|
||||
|
||||
void removeSymlink(const string & path)
|
||||
{
|
||||
if(path[path.length() - 1] != '/')
|
||||
throw Error(format("We dont want to remove the enitre directory, only the symlink, but a / is given for `%1%'") % path);
|
||||
if(path[path.length() - 1] == '/')
|
||||
throw Error(format("We dont want to remove the symlink, not the enitre directory, but a / is given for `%1%'") % path);
|
||||
deletePath(path);
|
||||
}
|
||||
|
||||
|
|
@ -1316,8 +1316,6 @@ void ensureStateDir(const Path & statePath, const string & user, const string &
|
|||
|
||||
void copyContents(const Path & from, const Path & to) //TODO bool shellexpansion, bool failure for nix-env
|
||||
{
|
||||
//executeShellCommand("whoami");
|
||||
|
||||
//TODO Could be a symlink (to a non-existing dir)
|
||||
/*
|
||||
if(!DirectoryExist(from))
|
||||
|
|
@ -1326,33 +1324,21 @@ void copyContents(const Path & from, const Path & to) //TODO bool shellexpansion
|
|||
throw Error(format("Path `%1%' doenst exist ...") % to);
|
||||
*/
|
||||
|
||||
//executeShellCommand("ls -l "+from);
|
||||
//executeShellCommand("ls -l "+from+"/");
|
||||
//executeShellCommand("ls -l "+to);
|
||||
//executeShellCommand("ls -l "+to+"/");
|
||||
|
||||
//TODO do a Rsync instead of a cp.
|
||||
//rsync -avHx --delete from to
|
||||
|
||||
//Copy all files + dirs recursively
|
||||
Strings p_args;
|
||||
p_args.push_back("-c"); //we call the shell (/bin/sh -c) so it expands the * to all files
|
||||
p_args.push_back("cp -R "+from + "/* "+to);
|
||||
/*
|
||||
p_args.push_back("cp");
|
||||
p_args.push_back("-R");
|
||||
p_args.push_back(from + "/*");
|
||||
p_args.push_back(to);
|
||||
*/
|
||||
runProgram_AndPrintOutput("/bin/sh", true, p_args, "sh-cp");
|
||||
|
||||
//Also copy the hidden files (but not the ../ dir)
|
||||
p_args.empty();
|
||||
p_args.push_back("-c");
|
||||
p_args.push_back("cp " + from + "/.[a-zA-Z0-9]* " +to);
|
||||
/*
|
||||
p_args.push_back(cp");
|
||||
p_args.push_back(from + "/.[a-zA-Z0-9]*");
|
||||
p_args.push_back(to);
|
||||
*/
|
||||
runProgram_AndPrintOutput("/bin/sh", true, p_args, "sh-cp");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue