View | Details | Raw Unified | Return to bug 211576
Collapse All | Expand All

(-)src/clients/inst_rpmcopy.ycp (-8 / +11 lines)
Lines 35-40 Link Here
35
    import "Kernel";
35
    import "Kernel";
36
    import "Service";
36
    import "Service";
37
    import "SourceManager";
37
    import "SourceManager";
38
    import "String";
38
39
39
    // variables related to installation source caching
40
    // variables related to installation source caching
40
41
Lines 92-97 Link Here
92
	{
93
	{
93
	    map<string,string> product_data = (map<string,string>)Pkg::SourceProduct (id);
94
	    map<string,string> product_data = (map<string,string>)Pkg::SourceProduct (id);
94
	    y2milestone ("Id %1: SourceProduct %2", id, product_data);
95
	    y2milestone ("Id %1: SourceProduct %2", id, product_data);
96
	    // FIXME: find()
95
	    if (find (product_data["flags"]:"", "cache") >= 0)
97
	    if (find (product_data["flags"]:"", "cache") >= 0)
96
	    {
98
	    {
97
		cached_id = id;
99
		cached_id = id;
Lines 270-276 Link Here
270
	}
272
	}
271
273
272
	map ta_out = (map)SCR::Execute (.target.bash_output,
274
	map ta_out = (map)SCR::Execute (.target.bash_output,
273
	  sformat ("mkdir -p %1", Installation::destdir + cache_dir));
275
	  sformat ("mkdir -p '%1'", String::Quote (Installation::destdir + cache_dir)));
274
	y2milestone ("Created cached dir '%1': %2", Installation::destdir+cache_dir, ta_out);
276
	y2milestone ("Created cached dir '%1': %2", Installation::destdir+cache_dir, ta_out);
275
	if (ta_out["exit"]:0 != 0)
277
	if (ta_out["exit"]:0 != 0)
276
	{
278
	{
Lines 284-290 Link Here
284
286
285
	string tmp_dir = cache_dir;
287
	string tmp_dir = cache_dir;
286
	ta_out = (map)SCR::Execute (.target.bash_output,
288
	ta_out = (map)SCR::Execute (.target.bash_output,
287
	  sformat ("mktemp -d -p %1", Installation::destdir + cache_dir));
289
	  sformat ("mktemp -d -p '%1'", String::Quote (Installation::destdir + cache_dir)));
288
	y2milestone ("Created temp dir %1: %2", Installation::destdir+cache_dir, ta_out);
290
	y2milestone ("Created temp dir %1: %2", Installation::destdir+cache_dir, ta_out);
289
	if (ta_out["exit"]:0 != 0)
291
	if (ta_out["exit"]:0 != 0)
290
	{
292
	{
Lines 301-316 Link Here
301
	ta_out = (map)SCR::Execute (.target.bash_output,
303
	ta_out = (map)SCR::Execute (.target.bash_output,
302
	    // first line is in target system
304
	    // first line is in target system
303
	    // the second one in installation system
305
	    // the second one in installation system
304
	     sformat ("rm -rf %3%1/%4; ln -s %3%2 %3%1/%4;
306
	     sformat ("rm -rf '%3%1/%4'; ln -s '%3%2' '%3%1/%4';
305
		      rm -rf %1/%4; ln -s %3%2 %1/%4;",
307
		      rm -rf '%1/%4'; ln -s '%3%2' '%1/%4';",
306
			tmp_dir,
308
			tmp_dir,
307
			substring (cache_dir, size (Installation::destdir)),
309
			substring (cache_dir, size (Installation::destdir)),
308
			Installation::destdir, cached_source_datadir));
310
			String::Quote (Installation::destdir), cached_source_datadir));
309
	y2milestone ("rm -rf %3%1/%4; ln -s %3%2 %3%1/%4;
311
	y2milestone ("rm -rf '%3%1/%4'; ln -s '%3%2' '%3%1/%4';
310
			rm -rf %1/%4; ln -s %3%2 %1/%4;",
312
			rm -rf '%1/%4'; ln -s '%3%2' '%1/%4';",
311
			tmp_dir,
313
			tmp_dir,
312
			substring (cache_dir, size (Installation::destdir)),
314
			substring (cache_dir, size (Installation::destdir)),
313
			Installation::destdir, cached_source_datadir);
315
			String::Quote (Installation::destdir), cached_source_datadir);
314
	y2milestone ("Result %1", ta_out);
316
	y2milestone ("Result %1", ta_out);
315
	if (ta_out["exit"]:0 != 0)
317
	if (ta_out["exit"]:0 != 0)
316
	{
318
	{
Lines 585-590 Link Here
585
	    Pkg::SourceMoveDownloadArea (download_dir);
587
	    Pkg::SourceMoveDownloadArea (download_dir);
586
	}
588
	}
587
589
590
	// FIXME: find()
588
        if (find (Kernel::GetCmdLine (), "yastnocache") != -1)
591
        if (find (Kernel::GetCmdLine (), "yastnocache") != -1)
589
        {
592
        {
590
            y2milestone ("'yastnocache' found, disabling source cache");
593
            y2milestone ("'yastnocache' found, disabling source cache");
(-)src/clients/inst_dirinstall_finish.ycp (-3 / +4 lines)
Lines 23-28 Link Here
23
    import "Timezone";
23
    import "Timezone";
24
    import "Console";
24
    import "Console";
25
    import "RunlevelEd";
25
    import "RunlevelEd";
26
    import "String";
26
27
27
    list<string> progress_stages =
28
    list<string> progress_stages =
28
	[
29
	[
Lines 116-124 Link Here
116
            DirInstall::image_name != "")
117
            DirInstall::image_name != "")
117
    {
118
    {
118
        Progress::NextStage();
119
        Progress::NextStage();
119
        string cmd =  sformat("cd %1 && tar -zcf %2 . && cd - ", 
120
        string cmd =  sformat("cd '%1' && tar -zcf '%2' . && cd - ", 
120
                DirInstall::target, 
121
                String::Quote (DirInstall::target),
121
                DirInstall::image_dir + "/" + DirInstall::image_name + ".tgz");
122
                String::Quote (DirInstall::image_dir + "/" + DirInstall::image_name + ".tgz"));
122
        y2debug("cmd: %1", cmd);
123
        y2debug("cmd: %1", cmd);
123
	// progress title
124
	// progress title
124
        Progress::Title(_("Building directory image..."));
125
        Progress::Title(_("Building directory image..."));
(-)src/clients/inst_dirinstall.ycp (-3 / +4 lines)
Lines 20-34 Link Here
20
    import "PackageCallbacks";
20
    import "PackageCallbacks";
21
    import "Wizard";
21
    import "Wizard";
22
    import "Progress";
22
    import "Progress";
23
    import "String";
23
24
24
    Pkg::TargetFinish ();
25
    Pkg::TargetFinish ();
25
    DirInstall::MountFilesystems ();
26
    DirInstall::MountFilesystems ();
26
27
27
    // create /dev/zero and /dev/null devices in the target directory,
28
    // create /dev/zero and /dev/null devices in the target directory,
28
    // some packages require them in the postinstall script
29
    // some packages require them in the postinstall script
29
    SCR::Execute(.target.bash, sformat("mkdir -p %1/dev", DirInstall::target));
30
    SCR::Execute(.target.bash, sformat("mkdir -p '%1/dev'", String::Quote (DirInstall::target)));
30
    SCR::Execute(.target.bash, sformat("mknod -m 666 %1/dev/zero c 1 5", DirInstall::target));
31
    SCR::Execute(.target.bash, sformat("mknod -m 666 '%1/dev/zero' c 1 5", String::Quote (DirInstall::target)));
31
    SCR::Execute(.target.bash, sformat("mknod -m 666 %1/dev/null c 1 3", DirInstall::target));
32
    SCR::Execute(.target.bash, sformat("mknod -m 666 '%1/dev/null' c 1 3", String::Quote (DirInstall::target)));
32
33
33
/*
34
/*
34
    if(Pkg::TargetInit (Installation::destdir,true) != true)
35
    if(Pkg::TargetInit (Installation::destdir,true) != true)
(-)src/clients/inst_kickoff.ycp (-31 / +36 lines)
Lines 25-30 Link Here
25
    import "Arch";
25
    import "Arch";
26
    import "FileUtils";
26
    import "FileUtils";
27
    import "ProductFeatures";
27
    import "ProductFeatures";
28
    import "String";
28
29
29
void AcpiToInitrd () {
30
void AcpiToInitrd () {
30
    if (! (Arch::i386 () || Arch::x86_64 () || Arch::ia64 ()))
31
    if (! (Arch::i386 () || Arch::x86_64 () || Arch::ia64 ()))
Lines 47-56 Link Here
47
	string mtab = (string) WFM::Read(.local.string, mtabname);
48
	string mtab = (string) WFM::Read(.local.string, mtabname);
48
49
49
	SCR::Write(.target.string, tmpdir + "/mtab", mtab);
50
	SCR::Write(.target.string, tmpdir + "/mtab", mtab);
50
	SCR::Execute (.target.bash, "/bin/cat " + tmpdir + "/mtab"
51
	SCR::Execute (.target.bash, "/bin/cat "
52
		      + "'" + String::Quote (tmpdir + "/mtab") + "'"
51
		      + " | /bin/sed \"s: " + Installation::destdir
53
		      + " | /bin/sed \"s: " + Installation::destdir
52
		      + "/: /:\"| /bin/sed \"s: " + Installation::destdir
54
		      + "/: /:\"| /bin/sed \"s: " + Installation::destdir
53
		      + ": /:\" > " + Installation::destdir + mtabname);
55
		      + ": /:\" "
56
		      + "> '" + String::Quote (Installation::destdir) + "'" + mtabname);
54
57
55
    }
58
    }
56
59
Lines 62-68 Link Here
62
65
63
	// remove old junk, script is in yast2-update
66
	// remove old junk, script is in yast2-update
64
	SCR::Execute (.target.bash, Directory::ybindir + "/remove_junk " +
67
	SCR::Execute (.target.bash, Directory::ybindir + "/remove_junk " +
65
		      Installation::destdir);
68
		      "'" + String::Quote (Installation::destdir) + "'");
66
69
67
	// possibly remove /usr/share/info/dir
70
	// possibly remove /usr/share/info/dir
68
	if (!Pkg::TargetFileHasOwner ("/usr/share/info/dir"))
71
	if (!Pkg::TargetFileHasOwner ("/usr/share/info/dir"))
Lines 93-100 Link Here
93
96
94
	if (Update::remove_old_backups)
97
	if (Update::remove_old_backups)
95
	{
98
	{
96
	    SCR::Execute (.target.bash, "/bin/rm -f " + Installation::destdir +
99
	    SCR::Execute (.target.bash, "cd '" + String::Quote (Installation::destdir) + "'; " +
97
			  Update::backup_path + "/*-*-*.tar.{gz,bz2}");
100
			    "/bin/rm -f " + Update::backup_path + "/*-*-*.tar.{gz,bz2}");
98
	}
101
	}
99
102
100
	if (true)
103
	if (true)
Lines 115-123 Link Here
115
		num = num + 1;
118
		num = num + 1;
116
	    }
119
	    }
117
120
118
	    if (SCR::Execute (.target.bash, "cd " + Installation::destdir +
121
	    if (SCR::Execute (.target.bash, "cd '" + String::Quote (Installation::destdir) + "'; " +
119
			      " ; /bin/tar czf " + Installation::destdir +
122
			      "/bin/tar czf ." + filename + " " + "var/log/YaST2") != 0)
120
			      filename + " " + "var/log/YaST2") != 0)
121
	    {
123
	    {
122
		y2error ("backup of %1 to %2 failed", Directory::logdir, filename);
124
		y2error ("backup of %1 to %2 failed", Directory::logdir, filename);
123
		// an error popup
125
		// an error popup
Lines 126-133 Link Here
126
	    }
128
	    }
127
	    else
129
	    else
128
	    {
130
	    {
129
		SCR::Execute (.target.bash, "/bin/rm -rf " + Installation::destdir +
131
		SCR::Execute (.target.bash, "cd '" + String::Quote (Installation::destdir) + "'; " +
130
			      "var/log/YaST2/*");
132
		              "/bin/rm -rf var/log/YaST2/*");
131
	    }
133
	    }
132
	}
134
	}
133
135
Lines 151-159 Link Here
151
		    num = num + 1;
153
		    num = num + 1;
152
		}
154
		}
153
155
154
		if (SCR::Execute (.target.bash, "cd " + Installation::destdir +
156
		if (SCR::Execute (.target.bash, "cd '" + String::Quote (Installation::destdir) + "'; " +
155
				  " ; /bin/tar czf " + Installation::destdir +
157
				  "/bin/tar czf ." + filename + " " + "etc/sysconfig") != 0)
156
				  filename + " " + "etc/sysconfig") != 0)
157
		{
158
		{
158
		    y2error ("backup of %1 to %2 failed", "/etc/sysconfig", filename);
159
		    y2error ("backup of %1 to %2 failed", "/etc/sysconfig", filename);
159
		    // an error popup
160
		    // an error popup
Lines 178-187 Link Here
178
		    num = num + 1;
179
		    num = num + 1;
179
		}
180
		}
180
181
181
		if (SCR::Execute (.target.bash, "cd " + Installation::destdir +
182
		if (SCR::Execute (.target.bash, "cd '" + String::Quote (Installation::destdir) + "'; " +
182
				  " ; /bin/tar czf " + Installation::destdir +
183
				  "/bin/tar czf ." + filename + " " +
183
				  filename + " " + "etc/rc.config" + " " +
184
				  "etc/rc.config etc/rc.config.d") != 0)
184
				  "etc/rc.config.d") != 0)
185
		{
185
		{
186
		    y2error ("backup of %1 to %2 failed", "/etc/rc.config", filename);
186
		    y2error ("backup of %1 to %2 failed", "/etc/rc.config", filename);
187
		    // an error popup
187
		    // an error popup
Lines 204-211 Link Here
204
	// have to handle older version in a special case.
204
	// have to handle older version in a special case.
205
205
206
	string idfile = (string) SCR::Read(.target.tmpdir) + "/idline";
206
	string idfile = (string) SCR::Read(.target.tmpdir) + "/idline";
207
	if (SCR::Execute (.target.bash, "/bin/grep ^id: " + Installation::destdir +
207
	if (SCR::Execute (.target.bash, "/bin/grep ^id: " +
208
			  "/etc/inittab >" + idfile) == 0)
208
			 "'" + String::Quote (Installation::destdir) + "/etc/inittab" + "'" +
209
			 " >" + idfile) == 0)
209
	{
210
	{
210
	    // idline = "id:X:initdefault:"
211
	    // idline = "id:X:initdefault:"
211
212
Lines 255-261 Link Here
255
	}
256
	}
256
257
257
	// get the current raid configuration
258
	// get the current raid configuration
258
	map out = (map) SCR::Execute (.target.bash_output, "chroot " + Installation::destdir + " mdadm -Ds");
259
	map out = (map) SCR::Execute (.target.bash_output,
260
	    "chroot '" + String::Quote (Installation::destdir) + "' " +
261
	    "mdadm -Ds");
259
	if (out["exit"]:-1 != 0) {
262
	if (out["exit"]:-1 != 0) {
260
	    y2error ("Error occurred while getting raid configuration: %1", out);
263
	    y2error ("Error occurred while getting raid configuration: %1", out);
261
	    return;
264
	    return;
Lines 318-333 Link Here
318
        {
321
        {
319
            string template_dir= "/var/adm/fillup-templates";
322
            string template_dir= "/var/adm/fillup-templates";
320
            // hack 'pre-req' cyclic dependency between bash, aaa_base, and perl
323
            // hack 'pre-req' cyclic dependency between bash, aaa_base, and perl
321
            SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/passwd.aaa_base " 
324
            SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/passwd.aaa_base " +
322
                    + Installation::destdir + "/etc/passwd");
325
		    "'" + String::Quote (Installation::destdir) + "/etc/passwd" + "'");
323
            SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/group.aaa_base " 
326
            SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/group.aaa_base " +
324
                    + Installation::destdir + "/etc/group");
327
                    "'" + String::Quote (Installation::destdir) + "/etc/group" + "'");
325
            SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/shadow.aaa_base " 
328
            SCR::Execute(.target.bash, "/bin/cp " + template_dir + "/shadow.aaa_base " +
326
                    + Installation::destdir + "/etc/shadow");
329
                    "'" + String::Quote (Installation::destdir) + "/etc/shadow" + "'");
327
        } else
330
        } else
328
        {
331
        {
329
	    SCR::Execute(.target.bash, "/bin/cp /etc/passwd " + Installation::destdir + "/etc");
332
	    SCR::Execute(.target.bash, "/bin/cp /etc/passwd " +
330
	    SCR::Execute(.target.bash, "/bin/cp /etc/group " + Installation::destdir + "/etc");
333
		    "'" + String::Quote (Installation::destdir) + "/etc" + "'");
334
	    SCR::Execute(.target.bash, "/bin/cp /etc/group " +
335
		    "'" + String::Quote (Installation::destdir) + "/etc" + "'");
331
        }
336
        }
332
337
333
	// fake mtab
338
	// fake mtab
Lines 368-374 Link Here
368
373
369
            // check passwd and group of target
374
            // check passwd and group of target
370
            SCR::Execute (.target.bash, "/usr/lib/YaST2/bin/update_users_groups " +
375
            SCR::Execute (.target.bash, "/usr/lib/YaST2/bin/update_users_groups " +
371
                    Installation::destdir);
376
                    "'" + String::Quote (Installation::destdir) + "'");
372
377
373
            // update inittab
378
            // update inittab
374
            update_inittab ();
379
            update_inittab ();
Lines 397-405 Link Here
397
    {
402
    {
398
	ProductFeatures::Save();
403
	ProductFeatures::Save();
399
	WFM::Execute (.local.bash, sformat (
404
	WFM::Execute (.local.bash, sformat (
400
	    "/bin/mkdir -p %1/etc/YaST2", Installation::destdir));
405
	    "/bin/mkdir -p '%1/etc/YaST2'", String::Quote (Installation::destdir)));
401
	WFM::Execute (.local.bash, sformat (
406
	WFM::Execute (.local.bash, sformat (
402
	    "/bin/cp %1 %2/%1", "/etc/YaST2/ProductFeatures", Installation::destdir));
407
	    "/bin/cp '%1' '%2/%1'", "/etc/YaST2/ProductFeatures", String::Quote (Installation::destdir)));
403
    }
408
    }
404
409
405
    return `next;
410
    return `next;
(-)src/clients/pkg_finish.ycp (-2 / +3 lines)
Lines 17-22 Link Here
17
textdomain "packager";
17
textdomain "packager";
18
18
19
import "Installation";
19
import "Installation";
20
import "String";
20
21
21
any ret = nil;
22
any ret = nil;
22
string func = "";
23
string func = "";
Lines 52-60 Link Here
52
53
53
    // copy list of failed packages to installed system
54
    // copy list of failed packages to installed system
54
    WFM::Execute (.local.bash, sformat (
55
    WFM::Execute (.local.bash, sformat (
55
	"test -f %1 && /bin/cp -a %1 %2%1",
56
	"test -f %1 && /bin/cp -a %1 '%2%1'",
56
	"/var/lib/YaST2/failed_packages",
57
	"/var/lib/YaST2/failed_packages",
57
	Installation::destdir));
58
	String::Quote (Installation::destdir)));
58
}
59
}
59
else
60
else
60
{
61
{
(-)src/modules/DirInstall.ycp (-5 / +5 lines)
Lines 14-21 Link Here
14
import "Stage";
14
import "Stage";
15
import "HTML";
15
import "HTML";
16
import "ProductControl";
16
import "ProductControl";
17
import "String";
17
18
18
19
global boolean runme_at_boot = false;
19
global boolean runme_at_boot = false;
20
global string target = "/var/tmp/dirinstall";
20
global string target = "/var/tmp/dirinstall";
21
21
Lines 83-91 Link Here
83
	string dev = descr[1]:"";
83
	string dev = descr[1]:"";
84
	string type = descr[2]:"";
84
	string type = descr[2]:"";
85
	mp = target + mp;
85
	mp = target + mp;
86
	WFM::Execute (.local.bash, sformat ("test -d %1 || mkdir -p %1", mp));
86
	WFM::Execute (.local.bash, sformat ("test -d '%1' || mkdir -p '%1'", String::Quote (mp)));
87
	WFM::Execute (.local.bash, sformat ("/bin/mount -t %1 %2 %3",
87
	WFM::Execute (.local.bash, sformat ("/bin/mount -t %1 %2 '%3'",
88
	    type, dev, mp));
88
	    type, dev, String::Quote (mp)));
89
	mounted_fs = add (mounted_fs, mp);
89
	mounted_fs = add (mounted_fs, mp);
90
    });
90
    });
91
    y2milestone ("Mounted filesystems: %1", mounted_fs);
91
    y2milestone ("Mounted filesystems: %1", mounted_fs);
Lines 94-100 Link Here
94
global void UmountFilesystems () {
94
global void UmountFilesystems () {
95
    y2milestone ("Mounted filesystems: %1", mounted_fs);
95
    y2milestone ("Mounted filesystems: %1", mounted_fs);
96
    foreach (string mp, mounted_fs, {
96
    foreach (string mp, mounted_fs, {
97
	WFM::Execute (.local.bash, sformat ("/bin/umount %1", mp));
97
	WFM::Execute (.local.bash, sformat ("/bin/umount '%1'", String::Quote (mp)));
98
    });
98
    });
99
    mounted_fs = [];
99
    mounted_fs = [];
100
}
100
}
(-)src/modules/PackageCallbacks.ycp (-2 / +2 lines)
Lines 359-366 Link Here
359
	if (error != 0)
359
	if (error != 0)
360
	{
360
	{
361
	    string infopath = (string) SCR::Read (.target.tmpdir) + "/rpmlog";
361
	    string infopath = (string) SCR::Read (.target.tmpdir) + "/rpmlog";
362
	    SCR::Execute (.target.bash, "/usr/bin/tail " + Installation::destdir
362
	    SCR::Execute (.target.bash, "/usr/bin/tail '" + String::Quote (Installation::destdir)
363
			  + Directory::logdir + "/y2logRPM > " + infopath);
363
			  + Directory::logdir + "/y2logRPM' > " + infopath);
364
	    string info = reason + "\n---\n" + (string) SCR::Read (.target.string, [infopath, "-?-"]);
364
	    string info = reason + "\n---\n" + (string) SCR::Read (.target.string, [infopath, "-?-"]);
365
365
366
	    string message = sformat ( _deleting_package ? 
366
	    string message = sformat ( _deleting_package ? 

Return to bug 211576