+2007-10-07 Guillem Jover <guillem@debian.org>
+
+ * scripts/dpkg-buildpackage.pl: Warn if run as root and $rootcommand
+ has been specified. Error if run as non-root and $rootcommand is not
+ found.
+
2007-10-07 Guillem Jover <guillem@debian.org>
* scripts/dpkg-buildpackage.pl (usage): Remove details about running
}
my $rootcommand = '';
-if (testcommand('fakeroot')) {
- $rootcommand = 'fakeroot';
-}
-
my $signcommand = '';
if ( ( ($ENV{GNUPGHOME} && -e $ENV{GNUPGHOME})
|| ($ENV{HOME} && -e "$ENV{HOME}/.gnupg") )
}
}
+if ($< == 0) {
+ warning(_g("using a gain-root-command while being root")) if ($rootcommand);
+} else {
+ $rootcommand ||= 'fakeroot';
+
+ if (!testcommand($rootcommand)) {
+ if ($rootcommand eq 'fakeroot') {
+ error(_g("fakeroot not found, either install the fakeroot\n" .
+ "package, specify a command with the -r option, " .
+ "or run this as root"));
+ } else {
+ error(sprintf(_g("gain-root-commmand '%s' not found"), $rootcommand));
+ }
+ }
+}
+
unless ($signcommand) {
$signsource = 0;
$signchanges = 0;