|
Lines 342-348
Link Here
|
| 342 |
SCR->Execute (".target.bash", "/bin/rm -rf $mnt_dir") if (FileUtils->Exists ($mnt_dir)); |
342 |
SCR->Execute (".target.bash", "/bin/rm -rf $mnt_dir") if (FileUtils->Exists ($mnt_dir)); |
| 343 |
SCR->Execute (".target.mkdir", $mnt_dir); |
343 |
SCR->Execute (".target.mkdir", $mnt_dir); |
| 344 |
$command = "mount -o loop $image_path $mnt_dir"; |
344 |
$command = "mount -o loop $image_path $mnt_dir"; |
| 345 |
y2debug ("cmd: $command"); |
345 |
y2internal ("cmd: $command"); |
| 346 |
$out = SCR->Execute (".target.bash_output", $command); |
346 |
$out = SCR->Execute (".target.bash_output", $command); |
| 347 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
347 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
| 348 |
y2error ("error calling $command: ", $out->{"stderr"}); |
348 |
y2error ("error calling $command: ", $out->{"stderr"}); |
|
Lines 352-372
Link Here
|
| 352 |
SCR->Execute (".target.bash", "/bin/rm -rf $home"); |
352 |
SCR->Execute (".target.bash", "/bin/rm -rf $home"); |
| 353 |
# copy the directory content |
353 |
# copy the directory content |
| 354 |
$command = "/bin/cp -ar $mnt_dir $home"; |
354 |
$command = "/bin/cp -ar $mnt_dir $home"; |
| 355 |
y2debug ("cmd: $command"); |
355 |
y2internal ("cmd: $command"); |
| 356 |
$out = SCR->Execute (".target.bash_output", $command); |
356 |
$out = SCR->Execute (".target.bash_output", $command); |
| 357 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
357 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
| 358 |
y2error ("error calling $command: ", $out->{"stderr"}); |
358 |
y2error ("error calling $command: ", $out->{"stderr"}); |
| 359 |
return 0; |
359 |
return 0; |
| 360 |
} |
360 |
} |
| 361 |
$command = "umount $mnt_dir"; |
361 |
$command = "umount $mnt_dir"; |
| 362 |
y2debug ("cmd: $command"); |
362 |
y2internal ("cmd: $command"); |
| 363 |
$out = SCR->Execute (".target.bash_output", $command); |
363 |
$out = SCR->Execute (".target.bash_output", $command); |
| 364 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
364 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
| 365 |
y2error ("error calling $command: ", $out->{"stderr"}); |
365 |
y2error ("error calling $command: ", $out->{"stderr"}); |
| 366 |
return 0; |
366 |
return 0; |
| 367 |
} |
367 |
} |
| 368 |
$command = "$cryptconfig pm-disable $username"; |
368 |
$command = "$cryptconfig pm-disable $username"; |
| 369 |
y2debug ("cmd: $command"); |
369 |
y2internal ("cmd: $command"); |
| 370 |
$out = SCR->Execute (".target.bash_output", $command); |
370 |
$out = SCR->Execute (".target.bash_output", $command); |
| 371 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
371 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
| 372 |
y2error ("error calling $command: ", $out->{"stderr"}); |
372 |
y2error ("error calling $command: ", $out->{"stderr"}); |
|
Lines 374-380
Link Here
|
| 374 |
return 0; |
374 |
return 0; |
| 375 |
} |
375 |
} |
| 376 |
$command = "$cryptconfig close $org_img"; |
376 |
$command = "$cryptconfig close $org_img"; |
| 377 |
y2debug ("cmd: $command"); |
377 |
y2internal ("cmd: $command"); |
| 378 |
$out = SCR->Execute (".target.bash_output", $command); |
378 |
$out = SCR->Execute (".target.bash_output", $command); |
| 379 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
379 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
| 380 |
y2error ("error calling $command: ", $out->{"stderr"}); |
380 |
y2error ("error calling $command: ", $out->{"stderr"}); |
|
Lines 419-425
Link Here
|
| 419 |
$cmd = $cmd."--key-file=$key_file " if defined $key_file; |
419 |
$cmd = $cmd."--key-file=$key_file " if defined $key_file; |
| 420 |
$cmd = $cmd."--image-file=$image_file " if defined $image_file; |
420 |
$cmd = $cmd."--image-file=$image_file " if defined $image_file; |
| 421 |
$cmd = $cmd."$username"; |
421 |
$cmd = $cmd."$username"; |
| 422 |
y2debug ("cmd: $cmd"); |
422 |
y2internal ("cmd: $cmd"); |
| 423 |
my $out = SCR->Execute (".target.bash_output", $cmd); |
423 |
my $out = SCR->Execute (".target.bash_output", $cmd); |
| 424 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
424 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
| 425 |
Report->Error ($out->{"stderr"}); |
425 |
Report->Error ($out->{"stderr"}); |
|
Lines 436-442
Link Here
|
| 436 |
if ($modified eq "edited" && defined $key_file && defined $new_pw && $new_pw ne $pw) { |
436 |
if ($modified eq "edited" && defined $key_file && defined $new_pw && $new_pw ne $pw) { |
| 437 |
SCR->Write (".target.string", $pw_path, "$pw\n$new_pw"); |
437 |
SCR->Write (".target.string", $pw_path, "$pw\n$new_pw"); |
| 438 |
my $command = "$cryptconfig passwd --no-verify $key_file < $pw_path"; |
438 |
my $command = "$cryptconfig passwd --no-verify $key_file < $pw_path"; |
| 439 |
y2debug ("cmd: $command"); |
439 |
y2internal ("cmd: $command"); |
| 440 |
my $out = SCR->Execute (".target.bash_output", $command); |
440 |
my $out = SCR->Execute (".target.bash_output", $command); |
| 441 |
if ($out->{"exit"} ne 0) { |
441 |
if ($out->{"exit"} ne 0) { |
| 442 |
y2error ("error calling $command"); |
442 |
y2error ("error calling $command"); |
|
Lines 459-470
Link Here
|
| 459 |
} |
459 |
} |
| 460 |
# ok, only password change was needed |
460 |
# ok, only password change was needed |
| 461 |
else { |
461 |
else { |
| 462 |
y2debug ("nothing to do"); |
462 |
y2internal ("nothing to do"); |
| 463 |
SCR->Execute (".target.remove", $pw_path); |
463 |
SCR->Execute (".target.remove", $pw_path); |
| 464 |
return 1; |
464 |
return 1; |
| 465 |
} |
465 |
} |
| 466 |
|
466 |
|
| 467 |
y2debug ("cmd: $cmd"); |
467 |
y2internal ("cmd: $cmd"); |
| 468 |
$out = SCR->Execute (".target.bash_output", $cmd); |
468 |
$out = SCR->Execute (".target.bash_output", $cmd); |
| 469 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
469 |
if ($out->{"exit"} ne 0 && $out->{"stderr"}) { |
| 470 |
Report->Error ($out->{"stderr"}); |
470 |
Report->Error ($out->{"stderr"}); |