Author: locilka Date: Fri Apr 18 15:37:46 2008 New Revision: 46850 URL: http://svn.opensuse.org/viewcvs/yast?rev=46850&view=rev Log: - Do not overwrite passwd and shadow files if they already exist on a system (e.g., from images) (bnc #381227). - 2.16.36 Modified: trunk/packager/VERSION trunk/packager/package/yast2-packager.changes trunk/packager/src/clients/inst_kickoff.ycp Modified: trunk/packager/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/VERSION?rev=46850&r1=46849&r2=46850&view=diff ============================================================================== --- trunk/packager/VERSION (original) +++ trunk/packager/VERSION Fri Apr 18 15:37:46 2008 @@ -1 +1 @@ -2.16.35 +2.16.36 Modified: trunk/packager/package/yast2-packager.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.changes?rev=46850&r1=46849&r2=46850&view=diff ============================================================================== --- trunk/packager/package/yast2-packager.changes (original) +++ trunk/packager/package/yast2-packager.changes Fri Apr 18 15:37:46 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri Apr 18 15:37:30 CEST 2008 - locilka@suse.cz + +- Do not overwrite passwd and shadow files if they already exist on + a system (e.g., from images) (bnc #381227). +- 2.16.36 + +------------------------------------------------------------------- Fri Apr 18 14:24:07 CEST 2008 - lslezak@suse.cz - Use Pkg::PkgMediaSizes() and Pkg::PkgMediaPackageSizes() for Modified: trunk/packager/src/clients/inst_kickoff.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/clients/inst_kickoff.ycp?rev=46850&r1=46849&r2=46850&view=diff ============================================================================== --- trunk/packager/src/clients/inst_kickoff.ycp (original) +++ trunk/packager/src/clients/inst_kickoff.ycp Fri Apr 18 15:37:46 2008 @@ -327,30 +327,46 @@ } } - + // installation, for instance... if (!Mode::update ()) { // make some directories SCR::Execute(.target.mkdir, Installation::destdir + "/etc"); SCR::Execute(.target.mkdir, Installation::destdir + Directory::logdir); - // hack 'pre-req' cyclic dependency between bash, aaa_base, and perl - if (Installation::dirinstall_installing_into_dir) - { + if (Installation::dirinstall_installing_into_dir) { string template_dir= "/var/adm/fillup-templates"; - // hack 'pre-req' cyclic dependency between bash, aaa_base, and perl - SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/passwd.aaa_base " + - "'" + String::Quote (Installation::destdir) + "/etc/passwd" + "'"); - SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/group.aaa_base " + - "'" + String::Quote (Installation::destdir) + "/etc/group" + "'"); - SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/shadow.aaa_base " + - "'" + String::Quote (Installation::destdir) + "/etc/shadow" + "'"); - } else - { - SCR::Execute(.target.bash, "/bin/cp /etc/passwd " + - "'" + String::Quote (Installation::destdir) + "/etc" + "'"); - SCR::Execute(.target.bash, "/bin/cp /etc/group " + - "'" + String::Quote (Installation::destdir) + "/etc" + "'"); + + // hack 'pre-req' cyclic dependency between bash, aaa_base, and perl + foreach (string filename, ["passwd", "group", "shadow"], { + string filename_copy_to = sformat ("%1/etc/%2", Installation::destdir, filename); + + if (FileUtils::Exists (filename_copy_to)) { + y2milestone ("File %1 exists, not rewriting", filename_copy_to); + } else { + filename = sformat ("%1/%2.aaa_base", template_dir, filename); + y2milestone ("Copying %1 to %2", filename, filename_copy_to); + SCR::Execute (.target.bash, + sformat ("cp -a '%1' '%2'", String::Quote (filename), String::Quote (filename_copy_to)) + ); + } + }); + + } else { + // See bnc #381227 + // files might have been copied alredy from image + foreach (string filename, ["/etc/passwd", "/etc/group"], { + string filename_copy_to = sformat ("%1/%2", Installation::destdir, filename); + + if (FileUtils::Exists (filename_copy_to)) { + y2milestone ("File %1 exists, not rewriting", filename_copy_to); + } else { + y2milestone ("Copying %1 to %2", filename, filename_copy_to); + SCR::Execute (.target.bash, + sformat ("cp -a '%1' '%2'", String::Quote (filename), String::Quote (filename_copy_to)) + ); + } + }); } // fake mtab -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org