summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-11-04 11:33:15 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-11-04 11:33:15 +0000
commit10a60a696635ed47bf4143a08c4eeb5dff278921 (patch)
tree6c21ecd2b973998f1294b5c30fe1aea2edc7b206
parent27e17fdfd00658c75926da75c45c6d3322f20658 (diff)
downloaddrakx-10a60a696635ed47bf4143a08c4eeb5dff278921.tar
drakx-10a60a696635ed47bf4143a08c4eeb5dff278921.tar.gz
drakx-10a60a696635ed47bf4143a08c4eeb5dff278921.tar.bz2
drakx-10a60a696635ed47bf4143a08c4eeb5dff278921.tar.xz
drakx-10a60a696635ed47bf4143a08c4eeb5dff278921.zip
- handle symlinks in xxx.list
- more flexible -u (remove_light_tree)
-rwxr-xr-xmove/make_live_tree_boot48
1 files changed, 36 insertions, 12 deletions
diff --git a/move/make_live_tree_boot b/move/make_live_tree_boot
index 55cffca66..89ce3919b 100755
--- a/move/make_live_tree_boot
+++ b/move/make_live_tree_boot
@@ -15,13 +15,17 @@ Maybe you should remove it first with 'make_live_tree_boot -u'\n";
my $dest = $orig;
$dest =~ s|^$prefix|$light_prefix|;
- my $link = $orig;
- $link =~ s|^$prefix|/image_$live_name|;
+ if (-l $orig) {
+ system('cp', '-a', $orig, $dest);
+ } else {
+ my $link = $orig;
+ $link =~ s|^$prefix|/image_$live_name|;
- mkdir_p(dirname($dest));
- rename $orig, $dest or die "moving $orig to $dest failed: $!\n";
+ mkdir_p(dirname($dest));
+ rename $orig, $dest or die "moving $orig to $dest failed: $!\n";
- symlink $link, $orig or die "symlinking from $dest to $orig failed: $!\n";
+ symlink $link, $orig or die "symlinking from $dest to $orig failed: $!\n";
+ }
}
}
@@ -35,13 +39,15 @@ sub remove_light_tree {
my $orig = $dest;
$orig =~ s|^$prefix|$light_prefix|;
- next if !-e $orig;
-
- if (-e $dest && -s $dest != -s $orig) {
- warn "ERROR: $dest already exist, skipping\n";
- } elsif (!-d $dest || -l $dest) {
- unlink $dest or die "removing $dest failed: $!\n";
- rename $orig, $dest or die "moving $orig to $dest failed: $!\n";
+ if (-l $orig) {
+ unlink $orig;
+ } elsif (-e $orig) {
+ if (-e $dest && -s $dest != -s $orig) {
+ warn "ERROR: $dest already exist, skipping\n";
+ } elsif (!-d $dest || -l $dest) {
+ unlink $dest or die "removing $dest failed: $!\n";
+ rename $orig, $dest or die "moving $orig to $dest failed: $!\n";
+ }
}
}
system("rm -rf $light_prefix/usr/bin/stage2/*.pm");
@@ -51,6 +57,24 @@ sub remove_light_tree {
rmdir($_) foreach reverse(chomp_(`find $light_prefix -type d`));
if (-e $light_prefix) {
+ unlink($_) foreach chomp_(`find $light_prefix -type l`);
+
+ foreach my $orig (chomp_(`find $light_prefix -type f`)) {
+ my $dest = $orig;
+ $dest =~ s|^$light_prefix|$prefix|;
+ if (my $orig2 = readlink($dest)) {
+ $orig2 =~ s!/image_$live_name/!$light_prefix/! or next;
+ $orig2 eq $orig or next;
+ } else {
+ next if -e $dest && -s $dest != -s $orig;
+ }
+ unlink $dest or die "removing $dest failed: $!\n";
+ rename $orig, $dest or die "moving $orig to $dest failed: $!\n";
+ }
+ rmdir($_) foreach reverse(chomp_(`find $light_prefix -type d`));
+ }
+
+ if (-e $light_prefix) {
print "still there:\n";
system('find', $light_prefix);