-#!/bin/sh -e
+#!/usr/bin/perl -w
#
-# If no parameters are given, and no debian/suid files exists, scan for
-# suid/sgid files and suidregister them.
-#
-# If there are parameters, or there is a debian/suid, register the files
-# listed there.
+# Obsolete.
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+init();
-PATH=debian:$PATH:/usr/lib/debhelper
-. dh_lib
+my $notused=1;
-for PACKAGE in $DH_DOPACKAGES; do
- TMP=`tmpdir $PACKAGE`
- EXT=`pkgext $PACKAGE`
+foreach my $package (@{$dh{DOPACKAGES}}) {
+ my $tmp=tmpdir($package);
+ my $suid=pkgfile($package,"suid");
- files=""
+ # All this code is here just to see if we would have done something
+ # before..
- if [ -e debian/${EXT}suid ]; then
- files=`tr "\n" " " < debian/${EXT}suid`
- fi
+ my @files;
+ if ($suid) {
+ @files=filearray($suid, $tmp);
+ }
- if [ "$PACKAGE" = "$MAINPACKAGE" -a "$*" ]; then
- files="$* $files"
- fi
+ if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
+ push @files, @ARGV;
+ }
- if [ ! "$files" -a ! -e debian/${EXT}suid ]; then
+ if (! @files && ! $suid) {
# No files specified (and no empty debian/suid file), so
# guess what files to process.
- files=`find debian/$TMP -type f -perm +6000`
-
- # We will strip the debian working directory off of the
- # filenames.
- tostrip="debian/$TMP/"
- else
- # We will strip leading /'s, so the user can feed this
- # program either absolute filenames, or relative filenames,
- # and it will do the right thing either way.
- tostrip="/"
- fi
-
- if [ "$files" ]; then
- for file in $files; do
- # Strip leading $tostrip from $file. If not there,
- # leave $file untouched.
- if [ `expr "$file" : "$tostrip\\(.*\\)"` ]; then
- file=`expr "$file" : "$tostrip\\(.*\\)"`
- fi
-
- # Create the sed string that will be used to
- # fill in the blanks in the autoscript files.
- # Fill with the owner, group, and perms of the file.
- sedstr=`find debian/$TMP/$file -printf "s:#FILE#:$file:;s/#PACKAGE#/$PACKAGE/;s/#OWNER#/%u/;s/#GROUP#/%g/;s/#PERMS#/%m/"`
-
- autoscript "postinst" "postinst-suid" "$sedstr"
- autoscript "postrm" "postrm-suid" "$sedstr"
- done
- fi
-done
+ @files=split(/\n/,`find $tmp -type f -perm +6000`);
+ }
+
+ if (@files) {
+ # So we would have registered some files before.
+ error("This program should no longer be used, but you need to add a conflicts with \"suidmanager (<< 0.50)\". Please read the dh_suidregister(1) man page.");
+ }
+}
+
+# Although they called it, it's not going to do anything.
+if ($notused) {
+ warning("This program is obsolete and may be safely removed from your rules file.");
+}