#!/usr/bin/perl -w # This software is copyright (C) 2003 Andrea Guarnaccia. It is distributed # under the terms of the GNU General Public License (GPL). Because it is licensed # free of charge, there is NO WARRANTY, it is provided AS IS. The author can not # be held liable for any damage that might arise from the use of this software. # Use it at your own risk. if ($#ARGV != 0) { die "Usage: $0 package.tgz.\n"; } chomp($ARGV[0]); if ($ARGV[0] !~ /\.tgz$/) { die "Error: insert a .tgz.\n"; } print "Application name: "; chomp($name = ); print "Version: "; chomp($version = ); print "Configure parameters: "; chomp($param = ); print "Generating description..."; if ((not -x "/bin/uname") || (not -e "/bin/uname")) { print "Insert architecture: "; chomp($arch = ); } else { chomp($arch = `uname -m`); } open(VEND, "< /proc/cpuinfo") || die "Error: unable to open /proc/cpuinfo.\n"; while ($line = ) { if ($line =~ /vendor/i) { $line =~ s/.+:\s//g; $vendor = $line; } } close(VEND); if ((not -x "/usr/bin/gcc") || (not -e "/usr/bin/gcc")) { die "Error: unable to find gcc.\n"; } $gcc = `gcc --version`; @vec = split(/\s/, $gcc); $gcc = $vec[2]; opendir(GLIBC, "/var/log/packages/") || die "Error: unable to read into /var/log/packages/.\n"; foreach (readdir(GLIBC)) { if ($_ =~ /glibc-\d/) { @get = split('-', $_); } } close(GLIBC); if (not -e "/etc/slackware-version") { print "Slackware version: "; chomp($slack = ); } else { chomp($slack = `cat /etc/slackware-version`); } $file = $ARGV[0]; $file =~ s/tgz$/txt/g; open(DESC, "> $file") || die "Error: unable to create description file.\n"; print DESC "$name $version\n"; print DESC "Compiled whit \"./configure $param\"\n"; print DESC "$arch - $vendor"; print DESC "gcc: $gcc\n"; print DESC "glibc: $get[1]\n"; print DESC "$slack\n"; print DESC "Package released by Slackit.org\n"; print DESC "http://www.slackit.org\n"; close(DESC); print "done.\n"; print "Generating MD5..."; $file =~ s/txt$/md5/g; $md5 = `md5sum $ARGV[0]`; open(MD5, "> $file") || die "Error: unable to create MD5 file.\n"; print MD5 "$md5"; close(MD5); print "done.\n";