$release = 1;
$< = $>; # If running setuid
$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin";
+$allow_overwrite = 0;
# Parse command-line args
while(@ARGV) {
elsif ($a eq "--allow-overwrite") {
$allow_overwrite = 1;
}
+ elsif ($a eq "--sign") {
+ $sign = 1;
+ }
elsif ($a =~ /^\-\-/) {
print STDERR "Unknown option $a\n";
exit(1);
$spec_dir = "$basedir/SPECS";
$rpm_source_dir = "$basedir/SOURCES";
$rpm_dir = "$basedir/RPMS/noarch";
+$source_rpm_dir = "$basedir/SRPMS";
if (!-d $spec_dir || !-d $rpm_source_dir || !-d $rpm_dir) {
die "RPM directory $basedir is not valid";
}
done
fi
# Check if this module is already installed
-if [ -d /usr/libexec/$prog/$mod -a "\$1" = "1" -a "\$allow_overwrite" != "1" ]; then
+if [ -d /usr/libexec/$prog/$mod -a "\$1" = "1" -a "$allow_overwrite" != "1" ]; then
echo "This $ucprog module is already installed on your system."
exit 1
fi
$cmd = -x "/usr/bin/rpmbuild" ? "/usr/bin/rpmbuild" : "/bin/rpm";
system("$cmd -ba $spec_dir/$prefix$mod.spec") && exit;
unlink("$rpm_source_dir/$mod.tar.gz");
+
+# Sign if requested
+if ($sign) {
+ system("rpm --resign $rpm_dir/$prefix$mod-$ver-$release.noarch.rpm $source_rpm_dir/$prefix$mod-$ver-$release.src.rpm");
+ }
+
if ($target_dir =~ /:/) {
# scp to dest
system("scp $rpm_dir/$prefix$mod-$ver-$release.noarch.rpm $target_dir/$prefix$mod-$ver-$release.noarch.rpm");