#!/bin/bash # Copyright (C) 2006 Jake Vickers ##################################################################### # # change log # 10/22/09 Jake - Edited menu to fix typo that should not have been there # 09/25/09 shubes - changed qtp-extraclam to qtp-install-sanesecurity # 02/19/09 Jake - Removed qtp-install-roundcube due to security # - issue with Roundcube. # 10/27/08 Jake - Added qtp-install-qcontrolpe # 04/17/08 Jake - Added qtp-install-gnome # 04/13/08 shubes - Added qtp-install-spamdyke to the menu # 10/25/07 Jake - Added install-watchall to the menu # 10/10/07 Jake - Added qtp-maildrop to the menu # 07/06/07 Jake - Added qtp-clean-trash to the menu # 06/27/07 Jake - Fixed bug with -tight option in blacklists # - Added qtp-clean-spam menu option # 06/26/07 Jake - Removed RDJ menu option, added sa-update # 05/28/07 Jake - Added qtp-install-roundcube # 03/10/07 shubes - added tight blocklists # 11/14/06 shubes - increased window size for sa-stats # - changed menu item descriptions # 11/13/06 shubes - added sa-stats # 11/03/06 shubes - refactored, added looping # 09/00/06 Jake - original version written # ##################################################################### ## initialization processing # a1_initialization() { # execute qtp-whatami to be sure this machine is supported . qtp-whatami -s case $? in 0 | 1) ;; * ) echo "Your distro is not supported, exiting." exit 1 ;; esac # see if dialog is installed - if not, use yum to install it if [ ! -x /usr/bin/dialog ]; then echo "" echo "" echo "$me - dialog is not installed, so I'll install it for you:" echo "" echo "" yum -y install dialog fi # set a temp file for the working scratch. $$ is the current shell ID. tempfile=$(tempfile 2>/dev/null) || tempfile=/tmp/$me.$$ # make sure the tempfile is deleted when we're done trap "rm -f $tempfile" 0 1 2 5 15 # define the window title, caption and size attributes TITLE="QmailToaster-Plus Menu" CAPTION="\ You can use the UP/DOWN arrow keys, \n\ the first letter of the choice as a hot key, \n\ or the number keys 1-6 to choose an option.\n\n\ Choose an Option:" W_HEIGHT=18 W_WIDTH=56 W_MENU_HEIGHT=8 } ##################################################################### ## display the menu and process the selection # a5_process_menu(){ ${DIALOG:=dialog} --clear \ --title "$TITLE" \ --menu "$CAPTION" $W_HEIGHT $W_WIDTH $W_MENU_HEIGHT \ install-watchall "Install watchall and cwatchall" \ drbl "Install default blacklists" \ lrbl "Install loose blacklists" \ mrbl "Install moderate blacklists" \ trbl "Install tight blacklists" \ saupdate "Install and run sa-update" \ sast "Run sa-stats against current log" \ up2date "Check for updated toaster packages" \ newmodel "Run the newmodel upgrade script" \ sanesecurity "Install sanesecurity filters" \ spamdyke "Install spamdyke filter" \ clean-spam "Install hourly cron to process spam" \ clean-trash "Install hourly cron to clean Trash folder" \ qtp-maildrop "Add maildrop to logrotate" \ QControlPE "Install QControlPE, a replacement for VqAdmin" \ install-gnome "Install the GNOME desktop and XWindows" 2>$tempfile case $? in 0 ) b55_process_selection ;; 1 ) # No or Cancel button was pressed break ;; 2 ) # Help button was pressed, if present break ;; 3 ) # Extra button was pressed, if present break ;; -1 ) # errors occured, or exited via the ESC key break ;; * ) # undefined return code break ;; esac } ##################################################################### ## process the menu selection # b55_process_selection(){ case `cat $tempfile` in "install-watchall" ) command="qtp-install-watchall" ;; "drbl" ) command="qtp-set-rbls -default" ;; "lrbl" ) command="qtp-set-rbls -loose" ;; "mrbl" ) command="qtp-set-rbls -moderate" ;; "trbl" ) command="qtp-set-rbls -tight" ;; "saupdate" ) command="qtp-sa-update" ;; "up2date" ) command="qtp-ami-up2date" ;; "newmodel" ) command="qtp-newmodel" ;; "sast" ) command="sa-stats" ;; "sanesecurity" ) command="qtp-install-sanesecurity" ;; "spamdyke" ) command="qtp-install-spamdyke" ;; "clean-spam" ) command="qtp-clean-spam" ;; "clean-trash" ) command="qtp-clean-trash" ;; "qtp-maildrop" ) command="qtp-maildrop" ;; "QControlPE" ) command="qtp-install-qcontrolpe" ;; "install-gnome" ) command="qtp-install-gnome" ;; * ) # shouldn't get here, but break just in case (breaks the loop, actually :) ) break ;; esac echo "Issuing command: $command" $command echo echo -n " --- Hit ENTER to return to menu --- " read } ##################################################################### ## begin main processing here # me=${0##*/} myver=v0.3.2 a1_initialization while true; do a5_process_menu done exit 0