simple/quotacheck/configure

112 lines
2.3 KiB
Plaintext
Raw Permalink Normal View History

#!/bin/sh
#
echo "#!/bin/sh" > customize
echo "sed \\" > customize
chmod +x customize
################################################################
# find a working perl:
#
for i in /usr/bin/perl /usr/local/bin/perl /usr/bin/perl5 /usr/local/bin/perl5
do
if $i -e 'exit ($] < 5.000)'
then
echo $i works
perl="$i"
break
fi
done
if [ -z "$perl" ]
then
echo could not find a working perl command, sorry.
exit 1
fi
echo " -e 's,@@@perl@@@,$perl,g' \\" >> customize
################################################################
# find a working df:
#
for i in /bin/df /usr/bin/df /usr/bin/bdf /usr/sbin/df /usr/local/bin/df
do
a=`$i | awk 'NR == 1 {print $2}'`
if [ "$a" = "kbytes" -o "$a" = "1024-blocks" -o "$a" = "1k-blocks" ]
then
echo $i works
df="$i"
break
fi
a=`$i -k | awk 'NR == 1 {print $2}'`
if [ "$a" = "kbytes" -o "$a" = "1024-blocks" ]
then
echo $i -k works
df="$i -k"
break
fi
done
if [ -z "$df" ]
then
echo could not find a working df command, sorry.
exit 1
fi
echo " -e 's,@@@df@@@,$df,g' \\" >> customize
################################################################
# find repquota:
# We don't try to check whether the output is useful,
# just check whether we can call it. You may need root
# privileges for this to succeed.
#
for i in /usr/sbin/repquota
do
if $i -a
then
echo $i works
repquota="$i"
break
fi
done
if [ -z "$repquota" ]
then
echo could not find a working repquota command, sorry.
exit 1
fi
echo " -e 's,@@@repquota@@@,$repquota,g' \\" >> customize
################################################################
# find sendmail:
# We don't try to check whether the mail is actually delivered,
# just if sendmail accepts mail for a local user.
# This may not be a very useful test.
#
user=`whoami`
for i in /usr/sbin/sendmail /usr/lib/sendmail
do
if $i -t -i <<EOF
From: $user
To: $user
Subject: Testmail from configure (please ignore)
Test
EOF
then
echo $i works
sendmail="$i"
break
fi
done
if [ -z "$sendmail" ]
then
echo could not find a working sendmail command, sorry.
exit 1
fi
echo " -e 's,@@@sendmail@@@,$sendmail,g' \\" >> customize
################################################################
# finish:
# add a blank line to customize
echo >> customize