[Netadm-devel] gwc/scripts gwc,1.2,1.3 install.sh,1.7,1.8
Status: Beta
Brought to you by:
linuxpark
From: linuxpark <lin...@us...> - 2006-02-19 22:00:22
|
Update of /cvsroot/netadm/gwc/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32144/scripts Modified Files: gwc install.sh Log Message: MOD: MOD: modify current install.sh script to show error message in terminal whenever someone meets error during installation. FIX: fix 'vq', 'cq' option of gwc script from now on, gwc script will show or clear QoS policies more exactly. because it will check current valid interfaces of local system. Index: gwc =================================================================== RCS file: /cvsroot/netadm/gwc/scripts/gwc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gwc 17 Feb 2006 06:59:00 -0000 1.2 --- gwc 19 Feb 2006 21:59:59 -0000 1.3 *************** *** 19,22 **** --- 19,24 ---- MODDIR=${MAINDIR}/modules SZSYSIPC="/tmp/.NETADM_GWC.CLI_WITH_ADMD" + TMP="/tmp" + TC_CMD="/sbin/tc" killproc() { *************** *** 38,41 **** --- 40,57 ---- + check_if() + { + netstat -in > ${TMP}/netstat.$$ + cp /dev/null ${TMP}/iflist.$$ + while read NAME MTU NET ADDR TAIL + do + if [ ! -z ${NAME} -a ${NAME} != "Name" -a ${NAME} != "lo0" -a ${NAME} != "Kernel" -a ${NAME} != "Iface" ] + then + echo ${NAME} ${ADDR} >> ${TMP}/iflist.$$ + fi + done < ${TMP}/netstat.$$ + rm -f ${TMP}/netstat.$$ + } + chkstate(){ pid=`/bin/ps -e | *************** *** 89,123 **** view_queue (){ ! echo "----------------------- qdisc -------------------------" >&2 ! tc -s qdisc ! ! echo "" ! echo "" ! echo "" ! echo "---------------------- classes ------------------------" >&2 ! echo "" ! echo "--- classes eth0 ---------" >&2 ! tc -s class show dev eth0 ! echo "" ! echo "--- classes eth1 ---------" >&2 ! tc -s class show dev eth1 ! echo "" ! echo "" ! echo "" ! echo "--------------------- filter -----------------------" >&2 ! echo "" ! echo "--- filter eth0 ---------" >&2 ! tc -s filter show dev eth0 ! echo "" ! echo "--- filter eth1 ---------" >&2 ! tc -s filter show dev eth1 } clear_queue(){ ! echo "> Shut down previous qdisc" >&2 ! tc qdisc del root dev eth0 ! echo "> Shut down previous qdisc" >&2 ! tc qdisc del root dev eth1 ! } --- 105,141 ---- view_queue (){ ! check_if ! echo "============ Qdisc ================" ! $TC_CMD -s qdisc ! echo "-----------------------------------" ! IFCNT=0 ! while read INTERFACE ADDR ! do ! IFCNT=`expr ${IFCNT} + 1` ! echo ${IFCNT} > ${TMP}/ifcnt.$$ ! printf "Class of %-16s -----------\n" ${INTERFACE} ! ${TC_CMD} -s class show dev ${INTERFACE} ! printf "filter of %-16s -----------\n" ${INTERFACE} ! ${TC_CMD} -s filter show dev ${INTERFACE} ! done < ${TMP}/iflist.$$ ! echo "===================================" ! IFCNT=`cat ${TMP}/ifcnt.$$` ! rm -f ${TMP}/ifcnt.$$ } clear_queue(){ ! ! check_if ! IFCNT=0 ! while read INTERFACE ADDR ! do ! IFCNT=`expr ${IFCNT} + 1` ! echo ${IFCNT} > ${TMP}/ifcnt.$$ ! printf "Shut down qdisc of %-16s -----------\n" ${INTERFACE} ! ${TC_CMD} qdisc del root dev ${INTERFACE} ! done < ${TMP}/iflist.$$ ! echo "===================================" ! IFCNT=`cat ${TMP}/ifcnt.$$` ! rm -f ${TMP}/ifcnt.$$ } Index: install.sh =================================================================== RCS file: /cvsroot/netadm/gwc/scripts/install.sh,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** install.sh 17 Feb 2006 08:09:18 -0000 1.7 --- install.sh 19 Feb 2006 21:59:59 -0000 1.8 *************** *** 24,27 **** --- 24,29 ---- INST=/usr/bin/install LOGFILE=install.log + TC_CMD="/sbin/tc" + IPTABLES_CMD="/sbin/iptables" TMP_CONFIG=config.$$ *************** *** 39,42 **** --- 41,45 ---- SUPPORT_SNMP="" SNMP_COMMUNITY_NAME="" + ERROR="" # i18n stuff *************** *** 89,92 **** --- 92,96 ---- xecho "The installation was aborted." + xecho "fatal error: ${ERROR}" log "The installation was aborted." >&2 exit 1 *************** *** 121,125 **** if [ ${kernel_ver} != "2.6" ]; then ! $DIALOG --msgbox "Kernel must above than 2.6.0 but your kernel isn't so abort ..." 20 75 || acex 0 abort_install exit 1 --- 125,130 ---- if [ ${kernel_ver} != "2.6" ]; then ! ERROR="Kernel must above than 2.6.0 but your kernel isn't so abort ..." ! $DIALOG --msgbox "${ERROR}" 20 75 || acex 0 abort_install exit 1 *************** *** 242,246 **** check_usr(){ if [ "$UID" != "0" ]; then ! local msg=$(xmsg "error: Installation process requires superuser priviliges abort install ...") $DIALOG --infobox "$msg" 5 75 sleep 2 --- 247,252 ---- check_usr(){ if [ "$UID" != "0" ]; then ! ERROR="error: Installation process requires superuser priviliges abort install ..." ! local msg=$(xmsg "${ERROR}") $DIALOG --infobox "$msg" 5 75 sleep 2 *************** *** 262,266 **** file_check(){ if [ ! -f gwccli/gwccli ]; then ! $DIALOG --infobox "gwccli binary does not exist, compile first! abort install ..." 5 75 sleep 2 abort_install --- 268,273 ---- file_check(){ if [ ! -f gwccli/gwccli ]; then ! ERROR="gwccli binary does not exist, compile first! abort install ..." ! $DIALOG --infobox "${ERROR}" 5 75 sleep 2 abort_install *************** *** 270,274 **** if [ ! -f gwcguid/gwcguid ]; then ! $DIALOG --infobox "gwcguid binary does not exist, compile first! abort install ..." 5 75 sleep 2 abort_install --- 277,282 ---- if [ ! -f gwcguid/gwcguid ]; then ! ERROR="gwcguid binary does not exist, compile first! abort install ..." ! $DIALOG --infobox "${ERROR}" 5 75 sleep 2 abort_install *************** *** 278,282 **** if [ ! -f gwcadmd/gwcadmd ]; then ! $DIALOG --infobox "gwcadmd binary does not exist, compile first! abort install ..." 5 75 sleep 2 abort_install --- 286,291 ---- if [ ! -f gwcadmd/gwcadmd ]; then ! ERROR="gwcadmd binary does not exist, compile first! abort install ..." ! $DIALOG --infobox "${ERROR}" 5 75 sleep 2 abort_install *************** *** 287,291 **** if [ $KVER == 2 ]; then if [ ! -f pf/pf.ko ]; then ! $DIALOG --infobox "pf module does not exist, compile first! abort install ..." 5 75 sleep 2 abort_install --- 296,301 ---- if [ $KVER == 2 ]; then if [ ! -f pf/pf.ko ]; then ! ERROR="pf module does not exist, compile first! abort install ..." ! $DIALOG --infobox "${ERROR}" 5 75 sleep 2 abort_install *************** *** 296,300 **** if [ ! -f scripts/gwc ]; then ! $DIALOG --infobox "gwc script does not exist, abort install ..." 5 75 sleep 2 abort_install --- 306,311 ---- if [ ! -f scripts/gwc ]; then ! ERROR="gwc script does not exist, abort install ..." ! $DIALOG --infobox "${ERROR}" 5 75 sleep 2 abort_install *************** *** 302,305 **** --- 313,334 ---- exit 1 fi + + if [ ! -f $TC_CMD ]; then + ERROR="$TC_CMD does not exist, abort install ..." + $DIALOG --infobox "${ERROR}" 5 75 + sleep 2 + abort_install + log "iproute tools does not exist , abort ..." + exit 1 + fi + + if [ ! -f $IPTABLES_CMD ]; then + ERROR="$IPTABLES_CMD tools does not exist, abort install ..." + $DIALOG --infobox "${ERROR}" 5 75 + sleep 2 + abort_install + log "iproute tools does not exist , abort ..." + exit 1 + fi } *************** *** 307,311 **** config_file_check () { if [ ! -f config.$$ ]; then ! $DIALOG --infobox "temporary config file does not exist , abort install..." 5 80 sleep 2 abort_install --- 336,341 ---- config_file_check () { if [ ! -f config.$$ ]; then ! ERROR="temporary config file does not exist , abort install..." ! $DIALOG --infobox "${ERROR}" 5 80 sleep 2 abort_install *************** *** 323,327 **** sleep 1 else ! $DIALOG --infobox "No ${FILES} found, abort install ..." 5 80 sleep 2 abort_install --- 353,358 ---- sleep 1 else ! ERROR="No ${FILES} found, abort install ..." ! $DIALOG --infobox "${ERROR}" 5 80 sleep 2 abort_install *************** *** 479,483 **** OS=`uname -s` if [ "${OS}" != "Linux" ]; then ! $DIALOG --infobox "Can't support for OS: $OS, abort install ..." 10 75 sleep 2 abort_install --- 510,515 ---- OS=`uname -s` if [ "${OS}" != "Linux" ]; then ! ERROR="Can't support for OS: $OS, abort install ..." ! $DIALOG --infobox "${ERROR}" 10 75 sleep 2 abort_install *************** *** 487,491 **** if [ -e ${MAINDIR} ]; then ! $DIALOG --infobox "Already installed, abort ..." 5 75 || acex 0 sleep 2 log "Already installed, abort ...">&2 --- 519,524 ---- if [ -e ${MAINDIR} ]; then ! ERROR="Already installed, abort ..." ! $DIALOG --infobox "${ERROR}" 5 75 || acex 0 sleep 2 log "Already installed, abort ...">&2 *************** *** 526,530 **** get_snmp_info ! $DIALOG --infobox "Initialize first gwc config ..." 5 75 sleep 2 init_config --- 559,563 ---- get_snmp_info ! $DIALOG --infobox "Initialize gwc config ..." 5 75 sleep 2 init_config |