📄 bloat
字号:
$utilurl = "http://www.rarlabs.com/download.htm"; print STDERR $strings{$locale}{cmdnotfound}->($util); print STDERR $strings{$locale}{cmdloc}->($util,$utilurl); } } } # unzoo if (($filetype =~ /^zoo$/is) || ($check)) { if (`$loc{unzoo} nonvalid`) { } elsif (`/usr/local/bin/unzoo nonvalid`) { $loc{unzoo} = "/usr/local/bin/unzoo"; } elsif (`$ENV{HOME}/.bloat-utils/unzoo nonvalid`) { $loc{unzoo} = "$ENV{HOME}/.bloat-utils/unzoo"; } elsif (!$nowarn || $check) { if ($getutils eq "linux") { my $url = "http://bloat.sourceforge.net/downloads/binaries/unzoo.tar.gz"; my $extractcmd = "tar xzvf"; my $filenamewhoo = "unzoo.tar.gz"; &installUtil($url,$extractcmd,$filenamewhoo); $loc{unzoo} = "$ENV{HOME}/.bloat-utils/unzoo"; } else { $loc{unzoo} = "/bin/true"; $stop = 1; $util = "unzoo"; $utilurl = "http://archives.math.utk.edu/software/multi-platform/gap/util/unzoo.c"; print STDERR $strings{$locale}{cmdnotfound}->($util); print STDERR $strings{$locale}{cmdloc}->($util,$utilurl); } } } # uz2 if (($filetype =~ /^uz2$/is) || ($check)) { if (`$loc{uz2unpack} 2>&1` =~ /^USAGE:/) { } elsif (`/usr/local/bin/uz2unpack 2>&1` =~ /^USAGE:/) { $loc{uz2unpack} = "/usr/local/bin/uz2unpack"; } elsif (`$ENV{HOME}/.bloat-utils/uz2unpack 2>&1` =~ /^USAGE:/) { $loc{uz2unpack} = "$ENV{HOME}/.bloat-utils/uz2unpack"; } elsif (!$nowarn || $check) { if ($getutils eq "linux") { my $url = "http://bloat.sourceforge.net/downloads/binaries/uz2unpack.tar.gz"; my $extractcmd = "tar xzvf"; my $filenamewoo = "uz2unpack.tar.gz"; &installUtil($url,$extractcmd,$filenamewoo); $loc{uz2unpack} = "$ENV{HOME}/.bloat-utils/uz2unpack"; } else { $loc{uz2unpack} = "/bin/true"; $stop = 1; $util = "uz2unpack"; $utilurl = "http://bloat.sourceforge.net/downloads/source/uz2unpack.c"; print STDERR $strings{$locale}{cmdnotfound}->($util); print STDERR $strings{$locale}{cmdloc}->($util,$utilurl); } } } ### V ### ### W ### ### X ### ### Y ### ### Z ### # Zip if (($filetype =~ /^zip$/is) || ($filetype =~ /^exe$/is) || ($check)) { if (`$loc{unzip} 2> /dev/null`) { } elsif (`/usr/bin/unzip 2> /dev/null`) { $loc{unzip} = "/usr/bin/unzip"; } elsif (`$ENV{HOME}/.bloat-utils/unzip-5.50/unzip 2>/dev/null`) { $loc{unzip} = "$ENV{HOME}/.bloat-utils/unzip-5.50/unzip"; } elsif (!$nowarn || $check) { if ($getutils eq "linux") { my $url = "http://www.mirror.ac.uk/sites/ftp.info-zip.org/pub/infozip/UNIX/LINUX/unz550x-glibc.tar.gz"; my $extractcmd = "tar xzvf"; my $filenamewhoo = "unz550x-glibc.tar.gz"; &installUtil($url, $extractcmd, $filenamewhoo); $loc{unzip} = "$ENV{HOME}/.bloat-utils/unzip-5.50/unzip"; } else { $loc{unzip} = "/bin/true"; $stop = 1; $util = "unzip"; $utilurl = "http://www.info-zip.org/pub/infozip/UnZip.html"; print STDERR $strings{$locale}{cmdnotfound}->($util); print STDERR $strings{$locale}{cmdloc}->($util,$utilurl); } } } # Are we in --check? If so, good user =) ;-). if ((!$stop) && ($check)) { print $strings{$locale}{allutils}; }}### Warning - Dense Perl Ahead! You have been warned...sub runExtractor { # Warning - Large block of code ahead (just incase you didn't get it from the last comment :/) my $filename = $_[0]; my $filetype = $_[1]; ### # ### if ($filetype =~ /^7z$/i) { # Yay 7zip finally can be used on GNU/Lunix. $longtype = "7-Zip"; $extractcmd = "$loc{'7za'} x"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### A ### } elsif ($filetype =~ /^ace$/i) { # ACE! $longtype = "Ace"; $getcontents = "$loc{unace} v -y"; $type = "acelike"; $fileext = ".ace"; $checksdir = 1; $extractcmd = "$loc{unace} x"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); } elsif ($filetype =~ /^ar$/i) { # Ar, matey! $longtype = "GNU Archive"; $extractcmd = "$loc{ar} x"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); } elsif ($filetype =~ /^arj$/i) { # Arj! $longtype = "ARJ"; $extractcmd = "$loc{unarj}"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); } elsif ($filetype =~ /^autopackage$/i) { # Automatic packages... $longtype = "Autopackage"; $extractcmd = "$filename -x"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### B ### } elsif ($filetype =~ /^bzip2$/i) { # BZip2... $longtype = "BZip2"; $extractcmd = "$loc{bunzip2}"; if ($filename !~ /bz2$/i) { system("mv $filename $filename.bloat.bak && cp $filename.bloat.bak $filename.bz2"); $filename = "$filename.bz2"; } $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### C ### } elsif ($filetype =~ /^compress$/i) { # Z/Compress file $longtype = "Compressed"; $extractcmd = "$loc{gunzip}"; if ($filename !~ /Z$/) { system("mv $filename $filename.bloat.bak && cp $filename.bloat.bak $filename.Z"); $filename = "$filename.Z"; } $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### D ### } elsif ($filetype =~ /^deb$/i) { # Debian Deb $fileext = join("o_O", ".deb"); # What? C'mon, let me have a bit of fun ;). I highly doubt there are any ".o_O" files out there... $longtype = "Debian package"; $extractcmd = "$loc{ar} x $filename && $loc{tar} xzvf data.tar.gz && rm -f debian-binary data.tar.gz control.tar.gz"; $custcmd = 1; $mknewdir = 1; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### E ### } elsif ($filetype =~ /^exe$/i) { # PKZip... $getcontents = "$loc{unzip} -l"; $type = "infoziplike"; $longtype = "EXE"; $extractcmd = "$loc{unzip}"; $fileext = ".exe"; $checksdir = 1; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### F ### ### G ### } elsif ($filetype =~ /^gzip$/i) { # A plain GNUZip file??? Odd :P $longtype = "GNUZip"; $extractcmd = "$loc{gunzip}"; if ($filename !~ /gz$/i) { system("mv $filename $filename.bloat.bak && cp $filename.bloat.bak $filename.gz"); $filename = "$filename.gz"; } $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### H ### ### I ### ### J ### ### K ### ### L ### } elsif ($filetype =~ /^lha$/i) { # LHA $longtype = "LHA"; $extractcmd = "$loc{lha} x"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### M ### } elsif ($filetype =~ /^mscompress$/i) { # MS Compress $longtype = "MSCompress"; $extractcmd = "$loc{msexpand}"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### N ### ### O ### ### P ### ### Q ### ### R ### } elsif ($filetype =~ /^rar$/i) { # RAR $longtype = "RAR"; $extractcmd = "$loc{unrar} x"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); } elsif ($filetype =~ /^rpm$/i) { # RPM! $custcmd = 1; $mknewdir = 1; $fileext = join("o_O", ".rpm"); $longtype = "RPM"; $extractcmd = "$loc{cat} $filename | $loc{rpm2cpio} | $loc{pax} -r"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### S ### ### T ### } elsif ($filetype =~ /^tar$/i) { # Gnu Tar $getcontents = "$loc{tar} tvf"; $type = "tarlike"; $longtype = "Tar"; $extractcmd = "$loc{tar} xvf"; $fileext = join("o_O", ".tar"); $checksdir = 1; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); } elsif ($filetype =~ /^tar\/bzip2$/i) { # Tar/BZip2 $getcontents = "$loc{tar} tjvf"; $type = "tarlike"; $longtype = "Tar/BZip2"; $extractcmd = "$loc{tar} xjvf"; $fileext = join("o_O", ".tbz2", ".tar.bz2", ".tbz"); $checksdir = 1; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); } elsif ($filetype =~ /^tar\/gzip$/i) { # Tar/GnuZIP $getcontents = "$loc{tar} tzvf"; $type = "tarlike"; $longtype = "Tar/GNUZip"; $extractcmd = "$loc{tar} xzvf"; $fileext = join("o_O", ".tgz", ".tar.gz"); $checksdir = 1; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); } elsif ($filetype =~ /^tar\/z$/i) { # Tar/Z files $getcontents = "$loc{tar} tZvf"; $type = "tarlike"; $longtype = "Compress'd Tar"; $extractcmd = "$loc{tar} xZvf"; $fileext = join("o_O", ".tar.Z", ".taz"); $checksdir = 1; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### U ### } elsif ($filetype =~ /^u1mod$/i) { $longtype = "Unreal Modification"; $mknewdir = 1; $fileext = join("o_O", ".umod"); $extractcmd = "$loc{umod} -b ./ -x"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); } elsif ($filetype =~ /^uz2$/i) { $longtype = "UT2003/4 Compressed File"; $fileext = join("o_O",".uz2"); $custcmd = 1; my $fnse = $filename; # fnse == filename sans extension $fnse =~ s/\.uz2$//isg; $extractcmd = "$loc{uz2unpack} $filename $fnse"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### V ### ### W ### } elsif ($filetype =~ /^webmin$/i) { # Webmin - can be tar, tar/gz and possibly tar/bz2... # No subdir checking is required, so to save code and time, it isn't done my $tempvar = `$loc{file} $filename`; if ($tempvar =~ /gzip/) { $longtype = "Tar/GZipped Webmin"; $extractcmd = "$loc{tar} xzvf"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); } elsif ($tempvar =~ /bzip/) { $longtype = "Tar/BZip2d Webmin"; $extractcmd = "$loc{tar} xjvf"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); } else { $longtype = "Tarred Webmin"; $extractcmd = "$loc{tar} xvf"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); } ### X ### ### Y ### ### Z ### } elsif ($filetype =~ /^zip$/i) { # PKZip... $getcontents = "$loc{unzip} -l"; $type = "infoziplike"; $longtype = "Zip"; $extractcmd = "$loc{unzip}"; $fileext = join("o_O", ".zip", ".jar", ".xpi", ".ear", ".war", ".pk4", ".wsz"); $checksdir = 1; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); } elsif ($filetype =~ /^zoo$/i) { $longtype = "Zoo"; $extractcmd = "$loc{unzoo} -x"; $filetype = &extractFile($getcontents, $type, $longtype, $extractcmd, $fileext, $checksdir, $custcmd, $mknewdir, $verbose, $filename); ### END - Error Checking Stuff ### } else { # Uh-oh, problems... print $strings{$locale}{error}; my $date = (localtime)[5]; $date = $date + 1900; # Way to design for the future, Larry! :-P So 2003 == 103 my $month = (localtime)[4] + 1; # WTF is up with this?! $date = $date . "-" . $month . "-" . (localtime)[3]; print STDERR "Bloat $version - date: $date\n"; print STDERR "file(1) output: "; system "
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -