openbsd-ports/print/cups/files/cups-disable
ajacoutot d1ea956b94 Major update to cups-1.4.3.
Changelog is to big to detail here, refer to HOMEPAGE for details.

I have been using 1.4.X for several months.
Versions 1.4.0 and 1.4.2 have been tested in bulks by jasper@, thanks!

Please contact me directly if you see regressions.
2010-03-31 16:20:02 +00:00

116 lines
2.2 KiB
Bash

#!/bin/sh
#
# $OpenBSD: cups-disable,v 1.3 2010/03/31 16:20:02 ajacoutot 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/sbin/lptest \
/usr/share/man/cat1/lpq.0 \
/usr/share/man/cat1/lpr.0 \
/usr/share/man/cat1/lprm.0 \
/usr/share/man/cat1/lptest.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