summaryrefslogtreecommitdiffstats
path: root/move/tree/mdk_move_loop
diff options
context:
space:
mode:
Diffstat (limited to 'move/tree/mdk_move_loop')
-rwxr-xr-xmove/tree/mdk_move_loop56
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;
-}