diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-11-05 12:36:02 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-11-05 12:36:02 +0000 |
commit | df40212f253267dbc9c3ad34d5a18b8e2fb2abdd (patch) | |
tree | f415e9ebef177267646172d1afec837cca57a0b5 /move/make_live_tree_boot | |
parent | 34faf9c9f3a214eb02c43550f9f5a3f715e6cfd6 (diff) | |
download | drakx-backup-do-not-use-df40212f253267dbc9c3ad34d5a18b8e2fb2abdd.tar drakx-backup-do-not-use-df40212f253267dbc9c3ad34d5a18b8e2fb2abdd.tar.gz drakx-backup-do-not-use-df40212f253267dbc9c3ad34d5a18b8e2fb2abdd.tar.bz2 drakx-backup-do-not-use-df40212f253267dbc9c3ad34d5a18b8e2fb2abdd.tar.xz drakx-backup-do-not-use-df40212f253267dbc9c3ad34d5a18b8e2fb2abdd.zip |
handle "totem" files being in "always"
Diffstat (limited to 'move/make_live_tree_boot')
-rwxr-xr-x | move/make_live_tree_boot | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/move/make_live_tree_boot b/move/make_live_tree_boot index bbd26f19d..b272af94e 100755 --- a/move/make_live_tree_boot +++ b/move/make_live_tree_boot @@ -15,8 +15,7 @@ Maybe you should remove it first with 'make_live_tree_boot -u'\n"; my $dest = $orig; $dest =~ s|^$prefix|$light_prefix|; - my $dir = dirname($dest); - mkdir_p($dir); + mkdir_p(dirname($dest)); if (-l $orig) { symlink readlink($orig), $dest; @@ -28,14 +27,28 @@ Maybe you should remove it first with 'make_live_tree_boot -u'\n"; symlink $link, $orig or die "symlinking from $dest to $orig failed: $!\n"; } } +} - if ($live_name eq 'totem') { - foreach my $dir (chomp_(`cd $light_prefix ; find usr -type d`)) { - foreach my $f (all("$prefix/$dir")) { - my $file = "$prefix/$dir/$f"; - my $link = readlink($file) =~ /^\w/ ? readlink($file) : "/image/$dir/$f"; - symlink $link, "$light_prefix/$dir/$f"; - } +sub create_totem_links { + my ($live_name, $list) = @_; + my $light_prefix = $prefix . '_' . $live_name; + + #- creating all the dirs, even when things are in the "always" tree + foreach my $orig (@$list) { + my $dest = $orig; + $dest =~ s|^$prefix|$light_prefix|; + mkdir_p(dirname($dest)) if ! (-e $dest || -l $dest); + + if (-l $orig) { + symlink readlink($orig), $dest; + } + } + + foreach my $dir (chomp_(`cd $light_prefix ; find usr -type d`)) { + foreach my $f (all("$prefix/$dir")) { + my $file = "$prefix/$dir/$f"; + my $link = readlink($file) =~ /^\w/ ? readlink($file) : "/image/$dir/$f"; + symlink $link, "$light_prefix/$dir/$f"; } } } @@ -92,13 +105,13 @@ sub remove_light_tree { } my @always_list = chomp_(cat_('data/always.list')); -my @boot_list = chomp_(cat_('data/boot.list')); -my @totem_list = chomp_(cat_('data/totem.list')); +my @boot_list_orig = chomp_(cat_('data/boot.list')); +my @totem_list_orig = chomp_(cat_('data/totem.list')); -@always_list = uniq(@always_list, intersection(\@boot_list, \@totem_list)); +@always_list = uniq(@always_list, intersection(\@boot_list_orig, \@totem_list_orig)); -@boot_list = difference2(\@boot_list, \@always_list); -@totem_list = difference2(\@totem_list, \@always_list); +my @boot_list = difference2(\@boot_list_orig, \@always_list); +my @totem_list = difference2(\@totem_list_orig, \@always_list); remove_light_tree('always', \@always_list); remove_light_tree('boot', \@boot_list); @@ -108,4 +121,5 @@ if (!@ARGV) { create_light_tree('always', \@always_list); create_light_tree('boot', \@boot_list); create_light_tree('totem', \@totem_list); + create_totem_links('totem', \@totem_list_orig); } |