Author: jsuchome Date: Fri Apr 15 08:43:51 2011 New Revision: 63778 URL: http://svn.opensuse.org/viewcvs/yast?rev=63778&view=rev Log: create empty directories with correct mode Modified: trunk/snapper/src/Snapper.ycp Modified: trunk/snapper/src/Snapper.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/snapper/src/Snapper.ycp?rev=63778&r1=63777&r2=63778&view=diff ============================================================================== --- trunk/snapper/src/Snapper.ycp (original) +++ trunk/snapper/src/Snapper.ycp Fri Apr 15 08:43:51 2011 @@ -102,7 +102,7 @@ // check mode and ownerships out = (map) SCR::Execute (.target.bash_output, - sformat ("ls -l %1 %2 | cut -f 1,3,4 -d ' '", file1, file2)); + sformat ("ls -ld %1 %2 | cut -f 1,3,4 -d ' '", file1, file2)); list<string> parts = splitstring (out["stdout"]:""," \n"); if (parts[0]:"" != parts[3]:"") @@ -196,6 +196,12 @@ return true; } +integer GetFileMode (string file) { + + map out = SCR::Execute (.target.output, "/bin/stat --printf=%a " + file); + return out["stdout"]:755; +} + /** * Copy given files from selected snapshot to current filesystem */ @@ -224,7 +230,16 @@ y2milestone ("copying file %1 to %2 (dir: %3)", orig, file, dir); if (FileUtils::CheckAndCreatePath (dir)) { - SCR::Execute (.target.bash, sformat ("/bin/cp -a %1 %2", orig, file)); + if (FileUtils::IsDirectory (file)) + { + map stat = SCR::Read (.target.stat, file); + SCR::Execute (.target.mkdir, file, GetFileMode (file)); + SCR::Execute (.target.bash, sformat ("/bin/chown %1:%2 '%3'", stat["uid"]:0, stat["gid"]:0, file)); + } + else + { + SCR::Execute (.target.bash, sformat ("/bin/cp -a %1 %2", orig, file)); + } UI::ChangeWidget (`id (`log), `LastLine, file + "\n"); } else -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org