# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
# 
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
# 
# ROCK Linux: rock-src/package/base/openssh/stone_mod_sshd.sh
# ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
# 
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
# 
# --- ROCK-COPYRIGHT-NOTE-END ---
#
# [MAIN] 30 printing Print system configuration

create_links_cups(){
	echo "Stopping LPRng (lpd), should it be running."
	/etc/rc.d/init.d/lpd stop
	echo -e "\nRemoving old files and setting up new links:"
	for f in /usr/bin/*_cups /usr/sbin/*_cups; do
	ln -fvs $f  ${f/%_cups/}
	done
	echo -e "\nRemoving LPRng from all runlevels (if any) to avoid any conflicts:"
	for rl in 1 2 3 4 5 ; do
		rm -vf /etc/rc.d/rc$rl.d/S??lpd
	done
	echo -e "\nRemember:\nUse a browser to configure/manage printers at:"
	echo -e "http://localhost:631/admin\n"
	read -p "Press ENTER to continue with setting run levels for CUPS."
        $STONE runlevel edit_srv cups
}

create_links_lprng(){
	echo "Stopping CUPS, should it be running."
	/etc/rc.d/init.d/cups stop
	echo -e "\nNOTE: I've not been able to figure out how to setup printers for LPRng!"
	echo "So this is basically UNTESTED! Though it may work if you know how to"
	echo "setup the printers?"
	echo -e "\nRemoving old files and setting up new links:"
	for f in /usr/bin/*_lprng /usr/sbin/*_lprng; do
	ln -fvs $f  ${f/%_lprng/}
	done
	echo -e "\nRemoving CUPS from all runlevels (if any) to avoid any conflicts:"
	for rl in 1 2 3 4 5 ; do
		rm -vf /etc/rc.d/rc$rl.d/S??cups
	done
	read -p "Press ENTER to continue with setting run levels for LPRng (lpd)."
        $STONE runlevel edit_srv lpd
}

main() {
    while
	gui_menu printing 'Printing System Configuration.' \
		'Set CUPS as system print spooler. (recomended)' \
			'create_links_cups' \
		'Set LPRng as system print spooler. (untested)' \
			'create_links_lprng'
    do : ; done
}

