[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

deb_install



	The following is a simple little PERL script that makes the rules
files look niceer, and makes it easier to organize what files go where, and
what attributes they get. I will continue to use it no matter what the
outccoe of this email, but feel free to take it and modify it. If it gets
added to the Debian/Linux mainstream I think debmake would be the logical
package (not its own). The format of the install files is:

	<Command> <Args> like the following
	CMD [args]	  -- run command vertiam (analog system() in C.)
	EXE [src] [dest]  -- strips binary
	BIN [src] [dest]
	SCRIPT [src] [dest]
	MAN [src] [dest]
	DOC [src] [dest]
	GZIP [file]
	LN  [src] [dest]  -- doesn't work correctly (yet)

	The possibilities for this are quite endless. it simplifies the
rules file by removing the messy "/usr/bin/install -g 0 -o 0  -m 0755 ..."
line after line. 

	Future of debinstall.
		a) remove dependence on /usr/bin/install
		b) make it smarter to know where debian/$(package).files is.
		c) fix LN.
		d) add SG_EXE (suid), SO_EXE (suid), CHMOD, CHOWN, 

	For examples of it's usage look in the source of:
		bitchx, cfs, qcrack, mailpgp, saytime, sigrot.

--- cut here ---

#!/usr/bin/perl

## SYNTAX: debinstall [conf.files]

$INSTALL_BIN = "/usr/bin/install -g 0 -o 0";
$GZIP_BIN = "/bin/gzip -9";
$LN_BIN = "/bin/ls -sf";
$DIR = "-d";
$BIN = "-m 0755";
$EXE = "-m 0755 -s";
$SCRIPT = "-m 0755";
$MAN = "-m 0644";
$DOC = "-m 0644";
$INFO = "-m 0644";
$FILE = "-m 0644";

unless (open(FILE, "@ARGV[0]")) {
	die("@ARGV[0] cannot be opened!!");
}

sub build_command {
	local($line) = @_;

	$CMD = "$INSTALL_BIN";

	@args = split(/ /, $line);
	$type = splice(@args, 0,1);

	if ($type eq "BIN") {
		$CMD = join(" ", ($CMD, $BIN, @args));
	} elsif ($type eq "EXE") {
		$CMD = join(" ",($CMD, $BIN, @args));
	} elsif ($type eq "SCRIPT") {
		$CMD = join(" ", ($CMD, $SCRIPT, @args));
	} elsif ($type eq "MAN") {
		$CMD = join(" ", ($CMD, $MAN, @args));
	} elsif ($type eq "DOC") {
		$CMD = join(" ", ($CMD, $DOC, @args));
	} elsif ($type eq "INFO") {
		$CMD = join(" ", ($CMD, $DOC, @args));
	} elsif ($type eq "FILE") {
		$CMD = join(" ", ($CMD, $DOC, @args));
	} elsif ($type eq "DIR") {
		$CMD = join(" ", ($CMD, $DIR, @args));
	} elsif ($type eq "GZIP") {
		$CMD = join(" ", ($GZIP_BIN, @args));
	} elsif ($type eq "LN") {
		$CMD = join(" ", ($LN_BIN, @args));
	} elsif ($type eq "CMD") {
		$CMD = join(" ", (@args));
	} else {
		$CMD = "";
	}

	return($CMD);
}


sub main {
	print("Debian/Linux Package Management Installer\n");
	while ($line = <FILE>) {
		chop($line);
		@line = split(/ /, $line);
		$cmd = &build_command($line, @line);
		system("$cmd > /dev/null");
	}
}

&main;


--- cut here ---


---
"The Governent is not above the law. They cannot withhold information."
(Scully, X-Files)
---
Patrick J. Edwards <pje120@mail.usask.ca>
http://www.cs.usask.ca/undergrads/pje120/
http://hup1.usask.ca:8000/
finger pje120@alf.usask.ca for my PGP Key
Key fingerprint =  9F 45 7D 6E C0 A4 B4 0D  48 C7 14 CA 23 B0 B4 F8



--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com


Reply to: