openbsd-ports/print/cups/files/cups-disable
bernd e5effe71d7 Update to cups-1.3.10. With lots of help from ajacoutot@.
There's an issue with the admin.cgi which will be fixed
in-tree.

ok ajacoutot@, jasper@
2009-04-27 08:25:39 +00:00

114 lines
2.2 KiB
Bash

#!/bin/sh
#
# $OpenBSD: cups-disable,v 1.2 2009/04/27 08:25:39 bernd Exp $
#
# this script disables CUPS by removing links created by
# cups-enable.
PREFIX=${TRUEPREFIX}
BINDIR=/usr/bin
SBINDIR=/usr/sbin
QUIET=No
if [ "$1x" == "-qx" ]; then
QUIET=Yes
fi
if [ `id -u` -ne 0 ]; then
if [ "$QUIET" == "No" ]; then
echo "You must be root to run this script."
fi
exit 0
fi
if [ "$QUIET" == "No" ]; then
echo "This script will remove CUPS links from $BINDIR and $SBINDIR"
echo ""
echo -n "Are you sure you want to do this (y/[n])? "
read answer
echo ""
if [ X$answer != Xy ]; then
echo "exit"
exit
fi
fi
if [ ! -L /usr/sbin/lpc ]; then
if [ "$QUIET" == "No" ]; then
echo "CUPS not enabled, script terminated."
fi
exit 0
fi
######################################################################
if [ "$QUIET" == "No" ]; then
echo "Removing CUPS links:"
fi
for link in \
lpq lpr lprm
do
if [ -L $BINDIR/$link ]; then
if [ "$QUIET" == "No" ]; then
echo " $link"
fi
rm -f $BINDIR/$link
fi
done
for link in \
lpc
do
if [ -L $SBINDIR/$link ]; then
if [ "$QUIET" == "No" ]; then
echo " $link"
fi
rm -f $SBINDIR/$link
fi
done
if [ "$QUIET" == "No" ]; then
echo done.
echo ""
fi
######################################################################
if [ ! -e /usr/sbin/lpd.pre-cups ]; then
if [ "$QUIET" == "No" ]; then
echo "Couldn't find saved lpd files, saved files not restored."
fi
exit 0
else
if [ "$QUIET" == "No" ]; then
echo "Trying to restore lpd files:"
fi
for file in \
/usr/bin/lpq \
/usr/bin/lpr \
/usr/bin/lprm \
/usr/sbin/lpc \
/usr/sbin/lpd \
/usr/share/man/cat1/lpq.0 \
/usr/share/man/cat1/lpr.0 \
/usr/share/man/cat1/lprm.0 \
/usr/share/man/cat8/lpc.0 \
/usr/share/man/cat8/lpd.0 \
/etc/printcap
do
if [ -e $file.pre-cups ]; then
if [ "$QUIET" == "No" ]; then
echo " $file"
fi
mv $file.pre-cups $file
fi
done
if [ "$QUIET" == "No" ]; then
echo done.
echo ""
fi
fi