diff options
author | Mystery Man <unknown@mandriva.org> | 2005-09-02 22:32:32 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2005-09-02 22:32:32 +0000 |
commit | bd9ae60ea7df3a2dc09798ea1cba6f55f2c3f0e4 (patch) | |
tree | 7a03e33fba584c7014f990f1448a337627d50484 /move/tree/mdk_move_loop | |
parent | 4da1048be0a7528a1a9f55e6f87cb2766508473b (diff) | |
download | drakx-10_3_0_53mdk.tar drakx-10_3_0_53mdk.tar.gz drakx-10_3_0_53mdk.tar.bz2 drakx-10_3_0_53mdk.tar.xz drakx-10_3_0_53mdk.zip |
This commit was manufactured by cvs2svn to create tagV10_3_0_53mdk
'V10_3_0_53mdk'.
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; -} |