3 # VFS to manage the gputils archives.
4 # Written by Molnár Károly (proton7@freemail.hu) 2012
7 my %month = ('jan' => '01', 'feb' => '02', 'mar' => '03',
8 'apr' => '04', 'may' => '05', 'jun' => '06',
9 'jul' => '07', 'aug' => '08', 'sep' => '09',
10 'oct' => '10', 'nov' => '11', 'dec' => '12');
12 my @PATHS = ('/usr/bin/gplib', '/usr/local/bin/gplib');
16 foreach my $i (@PATHS)
27 print STDERR "\a\t$0 : Gplib not found!\n";
34 #-------------------------------------------------------------------------------
38 open(PIPE, "$gplib -tq $archive |") || die("Error in $gplib -tq");
40 my($dev, $inode, $mode, $nlink, $uid, $gid) = stat($archive);
45 my @w = split(/\s+/o);
50 printf("-rw-r--r-- 1 %s %s %d %s-%02u-%s %s %s\n",
51 $uid, $gid, int($w[1]), $month{lc($w[4])}, $w[5], $w[7], substr($w[6], 0, 5), $fname);
56 #-------------------------------------------------------------------------------
60 system("$gplib -r $archive $_[0]");
65 die("Error in: $gplib -r");
69 #-------------------------------------------------------------------------------
71 sub mc_ulib_fs_copyout
73 my($module, $fname) = @_;
74 my $tmpdir = $ENV{'TMPDIR'};
76 $tmpdir = '/tmp' if ($tmpdir eq '');
78 open(PIPE, "$gplib -tq $archive |") || die("Error in: $gplib -tq");
83 my @w = split(/\s+/o);
84 my $module_orig = $w[0];
85 my $count = () = ($module_orig =~ /(\\)/g);
86 my $md = $module_orig;
99 system("$gplib -x $archive $module");
104 die("Error in: $gplib -x");
107 rename($module, $fname) || die("Error in: rename($module, $fname)");
110 #-------------------------------------------------------------------------------
114 system("$gplib -d $archive $_[0]");
119 die("Error in: $gplib -d");
123 ################################################################################
127 mc_ulib_fs_list(@ARGV);
129 elsif ($cmd eq 'copyin')
131 mc_ulib_fs_copyin(@ARGV);
133 elsif ($cmd eq 'copyout')
135 mc_ulib_fs_copyout(@ARGV);
139 mc_ulib_fs_rm(@ARGV);