⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makeconfig.pl

📁 Bloat is a basic Perl script to allow you to easily decompress files from many formats.
💻 PL
字号:
#!/usr/bin/env perl## makeconfig.pl - Makes a bloatrc file# Copyright 2003-2004 Dave Wickham (dave@allaboutgames.co.uk)# Released under the BSD licence shown below. Yes, the BSDL, not the GPL.# Although under the BSDL you could take it and make it GPL if you want.# And here comes the licence which is longer than the actual programme, I expect.# This program, "makeconfig.pl", is copyright (C) 2003-2004 Dave Wickham.# All rights reserved.# # Redistribution and use in source and binary forms, with or without# modification, are permitted provided that the following conditions# are met:# # 1. Redistributions of source code must retain the above copyright#    notice, this list of conditions and the following disclaimer.# # 2. The origin of this software must not be misrepresented; you must#    not claim that you wrote the original software.  If you use this#    software in a product, an acknowledgment in the product#    documentation would be appreciated but is not required.# # 3. Altered source versions must be plainly marked as such, and must#    not be misrepresented as being the original software.# # 4. The name of the author may not be used to endorse or promote#    products derived from this software without specific prior written#    permission.# # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.# Now that's out of the way...use strict;use warnings;my $version = "1.2";my $bloatversion = "1.5";my $date = (localtime)[5];	# Ooh, ooh, a bit of bloat [GPLd] has been released under teh BSD licence!!11! *ahem*$date = $date + 1900;my $month = (localtime)[4] + 1;	# WTF is up with this?!$date = $date . "-" . $month . "-" . (localtime)[3];my $dontprefixoutput;my $verbose;my $nowarn;my $checkforsubdirs;my $lang;my $gofortar;my $dontusemimetypedetection;my $continue = "foobar";print "Welcome to Bloat config maker!\n";print "This programme will create a file called \"bloatrc\" in the current directory\n";print "To use this file, either copy it to $ENV{HOME}/.bloatrc or /etc/bloatrc\n";print "Press Control+C at any time to stop the programme\n\n";if (-e "./bloatrc") {	print "Warning: There is already a file called \"bloatrc\" in the current directory\n";	print "If you continue, this file will be overwritten. You have been warned.\n";	until (($continue =~ /^y/i) || ($continue =~ /^n/i)) {		print "Continue? (y/n) ";		$continue = <>;	}	if ($continue =~ /^y/i) {		print "\n";		&askAndWriteConfig;	} else {		print "\nConfiguration cancelled.\n";	}} else {	&askAndWriteConfig;}sub askAndWriteConfig {	my $opentest = open(CONFIGFILE, ">bloatrc");	die("Could not open/create configuration file: $!") unless ($opentest);	# If we're going to throw an error anywhere, may as well do it before we ask the user all the questions...		print "What language do you want bloat to be?\nValid languages are \"de\", \"en\", \"es\" \"fi\", \"nl\", and \"se\".\n(en) ";	$lang = <>;	print "\nDo you want bloat to prefix all output with \"\x1b[01;31mBLOAT:\x1b[00m \"?\n(Y/n) ";	$dontprefixoutput = <>;	print "\nDo you want bloat to be verbose (that is, provide lots of information)?\n(y/N) ";	$verbose = <>;	print "\nDo you want bloat to warn you about missing utilities?\n(Y/n) ";	$nowarn = <>;	print "\nDo you want to make sure that all files will be extracted into a new directory?\n(Y/n) ";	$checkforsubdirs = <>;	print "\nIf there is any uncertainty, do you want to try to use tar to extract files?\n(y/N) ";	$gofortar = <>;	print "\nDo you want bloat to try to determine file type with incorrectly named files?\n(Y/n) ";	$dontusemimetypedetection = <>;	if ($lang =~ /^de/i) {		$lang = "de";	} elsif ($lang =~ /^en/i) {		$lang = "en";	} elsif ($lang =~ /^es/i) {		$lang = "es";	} elsif ($lang =~ /^fi/i) {		$lang = "fi";	} elsif ($lang =~ /^nl/i) {		$lang = "nl";	} elsif ($lang =~ /^se/i) {		$lang = "se";	} else {		$lang = "en";	}		if ($dontprefixoutput =~ /^n/i) {		$dontprefixoutput = "TRUE";	# Yay for Bass Ackwards variables!	} else {		$dontprefixoutput = "FALSE";	}		if ($verbose =~ /^y/i) {		$verbose = "TRUE";	} else {		$verbose = "FALSE";	}		if ($nowarn =~ /^n/i) {		$nowarn = "TRUE";	} else {		$nowarn = "FALSE";	}		if ($checkforsubdirs =~ /^n/i) {		$checkforsubdirs = "FALSE";	} else 	{		$checkforsubdirs = "TRUE";	}		if ($gofortar =~ /^y/i) {		$gofortar = "TRUE";	} else {		$gofortar = "FALSE";	}			if ($dontusemimetypedetection =~ /^n/i) {		$dontusemimetypedetection = "TRUE";	} else {		$dontusemimetypedetection = "FALSE";	# OK, I now hate that damn variable name	}		print CONFIGFILE <<ENDOFCONFIG;## Lang - What language should bloat use?# Valid values are "de", "en", "es", "fi", "nl", and "se".lang = $lang## DontPrefixOutput - if TRUE, bloat won't print a red, bold "BLOAT: " before#  everything. Which can get annoying.#dontprefixoutput = $dontprefixoutput## Verbose - if TRUE, bloat will act as if it has had "--verbose" passed to it#  constantly#verbose = $verbose## Nowarn - if TRUE bloat will not warn you if it can not find utilities.#  It is HIGHLY recommended that you leave this as false#nowarn = $nowarn## CheckForSubdirs - If FALSE bloat will not check for subdirectores by default#  - if you deal with a lot of large Tar-based or Zip-based archives, I would#  recommend setting this to FALSE.#checkforsubdirs = $checkforsubdirs## GoForTar - If TRUE, instead of erring on the side of caution, bloat will#  use "tar" straight away on ambigous files.#  It is safe to do this, just could get annoying.#gofortar = $gofortar## DontUseMimeTypeDetection - If TRUE, MIME-type detection will not be performed,#  essentially falling back to failing with an error if the filetype cannot#  be determined by the filename.#dontusemimetypedetection = $dontusemimetypedetection## Locations for Utilities#  This section follows the basic format of "location.[utilityname]"; valid#  names are any utilities used within bloat.#  If these set utilities are not found, stanard procedure will occur - testing#  common locations, etc.## location.7za        = 7za# location.ar         = ar# location.bunzip2    = bunzip2# location.cat        = cat# location.file       = file# location.gunzip     = gunzip# location.lha        = lha# location.msexpand   = msexpand# location.pax        = pax# location.rpm2cpio   = rpm2cpio# location.tar        = tar# location.unace      = unace# location.unarj      = unarj# location.umod       = umod# location.unrar      = unrar# location.unzip      = unzip# Generated on $date by makeconfig.pl v$version (designed for bloat $bloatversion)ENDOFCONFIG	my $closecheck = close(CONFIGFILE);	die("Could not close/save configuration file: $!") unless ($closecheck);	print "\nConfiguration file created!\n";}# Last Updated: 2005-01-23

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -