diff options
author | Mystery Man <unknown@mandriva.org> | 2005-10-20 14:05:54 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2005-10-20 14:05:54 +0000 |
commit | 9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5 (patch) | |
tree | f3ef7ada2ce82dafb6d41cc087b0cc7fdfc40a46 /move/tree/mdk_move_loop | |
parent | 3e4ad5e1b687f262a1d7cc39a0b905a595ac7f95 (diff) | |
download | drakx-backup-do-not-use-10_34_11_100mdk.tar drakx-backup-do-not-use-10_34_11_100mdk.tar.gz drakx-backup-do-not-use-10_34_11_100mdk.tar.bz2 drakx-backup-do-not-use-10_34_11_100mdk.tar.xz drakx-backup-do-not-use-10_34_11_100mdk.zip |
This commit was manufactured by cvs2svn to create tagV10_34_11_100mdk
'V10_34_11_100mdk'.
Diffstat (limited to 'move/tree/mdk_move_loop')
-rwxr-xr-x | move/tree/mdk_move_loop | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/move/tree/mdk_move_loop b/move/tree/mdk_move_loop deleted file mode 100755 index b98c4a417..000000000 --- a/move/tree/mdk_move_loop +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/perl - -sub name2file { - my ($name) = @_; - "live_tree_$name.clp"; -} - -sub get_file2loop { - my %file2loop; - foreach (0 .. 9) { - my ($file) = `sudo losetup /dev/loop$_ 2>/dev/null` =~ m!\([^)]*/([^)]*)\)! or last; - $file2loop{$file} = "loop$_"; - } - %file2loop; -} - -sub to_memory { - my ($loop, $file) = @_; - - return if -e "/tmp/$file"; - - if (-e "/$file") { - system("sudo mv /$file /tmp"); - } else { - system("sudo cp /cdrom/$file /tmp"); - } - system("sudo losetup /dev/$loop /tmp/$file"); -} - -sub to_cdrom { - my ($loop, $file) = @_; - my $f = -e "/$file" ? "/$file" : -e "/tmp/$file" ? "/tmp/$file" : return; - system("sudo losetup /dev/$loop /cdrom/$file"); - system("sudo rm $f"); -} - -sub usage() { die "usage: mdk_move_loop <to_cdrom | to_memory> [names ...]\n" } - -my ($direction, @names) = @ARGV; -my $f = $direction eq 'to_memory' && \&to_memory || $direction eq 'to_cdrom' && \&to_cdrom; -$f && @names or usage(); - -my %file2loop = get_file2loop(@names); - -foreach my $name (@names) { - if ($name eq 'always_i18n') { - /(always_i18n.*)\.clp/ and $name = $1 foreach keys %file2loop; - } - my $file = name2file($name); - my $loop = $file2loop{$file} or next; - $f->($loop, $file); -} - -if ($ENV{GIVE_LOOP}) { - print "$_=$file2loop{$_}\n" foreach keys %file2loop; -} |