diff options
author | Mike Frysinger <vapier@gentoo.org> | 2004-08-25 00:04:32 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2004-08-25 00:04:32 +0000 |
commit | 5a8cb2d4187a3e88615c00cafb68f843938de8de (patch) | |
tree | dc964d1f623564411e4a1f68837f9803d8a2dec0 /net-misc | |
parent | version bump (diff) | |
download | historical-5a8cb2d4187a3e88615c00cafb68f843938de8de.tar.gz historical-5a8cb2d4187a3e88615c00cafb68f843938de8de.tar.bz2 historical-5a8cb2d4187a3e88615c00cafb68f843938de8de.zip |
clean up init script
Diffstat (limited to 'net-misc')
-rw-r--r-- | net-misc/cisco-vpnclient-3des/ChangeLog | 7 | ||||
-rw-r--r-- | net-misc/cisco-vpnclient-3des/Manifest | 12 | ||||
-rw-r--r-- | net-misc/cisco-vpnclient-3des/cisco-vpnclient-3des-4.0.5.ebuild | 6 | ||||
-rw-r--r-- | net-misc/cisco-vpnclient-3des/files/vpnclient.rc | 129 |
4 files changed, 78 insertions, 76 deletions
diff --git a/net-misc/cisco-vpnclient-3des/ChangeLog b/net-misc/cisco-vpnclient-3des/ChangeLog index e8ddc05fb05c..cf876aa674a1 100644 --- a/net-misc/cisco-vpnclient-3des/ChangeLog +++ b/net-misc/cisco-vpnclient-3des/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for net-misc/cisco-vpnclient-3des # Copyright 2000-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/cisco-vpnclient-3des/ChangeLog,v 1.18 2004/08/11 16:03:52 wolf31o2 Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/cisco-vpnclient-3des/ChangeLog,v 1.19 2004/08/25 00:04:32 vapier Exp $ + + 24 Aug 2004; Mike Frysinger <vapier@gentoo.org> files/vpnclient.rc, + cisco-vpnclient-3des-4.0.5.ebuild: + Rewrite the vpnclient script to make it flow better (eerror/exit is not the + way to go; eend/return is). *cisco-vpnclient-3des-4.0.5 (11 Aug 2004) diff --git a/net-misc/cisco-vpnclient-3des/Manifest b/net-misc/cisco-vpnclient-3des/Manifest index 0fe6ceacc16c..1da0ff4c490f 100644 --- a/net-misc/cisco-vpnclient-3des/Manifest +++ b/net-misc/cisco-vpnclient-3des/Manifest @@ -1,14 +1,14 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -MD5 e5a9df4c6285f4c166f507105ccc2b79 ChangeLog 3760 +MD5 0a7d27154b2f53ef6e7a8bbbe59fdf2f ChangeLog 3974 MD5 6599d9a77e743f14728d01b4c67c5b14 cisco-vpnclient-3des-4.0.1a-r1.ebuild 1770 MD5 ceed2261b61bf3fd7ae45aed33117100 metadata.xml 460 MD5 ae95fc7e09cd212607b833d565556473 cisco-vpnclient-3des-4.0.3b-r4.ebuild 2152 -MD5 1acace3acac33727806aa7daa82b9367 cisco-vpnclient-3des-4.0.5.ebuild 1930 +MD5 07e1eda5b9e9b622e9aaabc38da684bc cisco-vpnclient-3des-4.0.5.ebuild 1845 MD5 968b0edd0fc5b128c1c78f03d0b49336 files/4.0.1a-linux26-gentoo.patch 686 MD5 71958f1bfd76d8fc63b6c5c1a3069b0b files/digest-cisco-vpnclient-3des-4.0.1a-r1 79 -MD5 31a30abbad4557ac43d335e049d7c2ac files/vpnclient.rc 2497 +MD5 ca9acd2b20bd1b92519e520a8ec5a5c2 files/vpnclient.rc 2306 MD5 0181d77c1dd8b6929b7dd81fb2db45f1 files/atheros.patch 478 MD5 fffa4fdd9a7bd0eeae2d4832895ce99f files/driver_build_CC.patch 547 MD5 33ae35139cf3bc489e1454c3cb550659 files/digest-cisco-vpnclient-3des-4.0.3b-r4 79 @@ -17,7 +17,7 @@ MD5 49c26fcaba6aec15a8116f8868e39d88 files/register_netdevice.patch 1233 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.9.10 (GNU/Linux) -iD8DBQFBK9F3HTu7gpaalycRAt23AJ4hnN/kolC0rywmcHJQ7QZfeQmdzQCeOeH6 -/IOrQ7LvgQUv1oOEA+qxYcM= -=+hIT +iD4DBQFBK9eXHTu7gpaalycRAnWEAJiRDDQ0eX1UbEf3LU1gGiADYG0iAKDYaYsS +FRq2/M0Yb1jVqemU7Giw/Q== +=BLTJ -----END PGP SIGNATURE----- diff --git a/net-misc/cisco-vpnclient-3des/cisco-vpnclient-3des-4.0.5.ebuild b/net-misc/cisco-vpnclient-3des/cisco-vpnclient-3des-4.0.5.ebuild index 2cb4dd1ac5fa..6f0d1ac3a71e 100644 --- a/net-misc/cisco-vpnclient-3des/cisco-vpnclient-3des-4.0.5.ebuild +++ b/net-misc/cisco-vpnclient-3des/cisco-vpnclient-3des-4.0.5.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/cisco-vpnclient-3des/cisco-vpnclient-3des-4.0.5.ebuild,v 1.2 2004/08/24 23:38:21 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/cisco-vpnclient-3des/cisco-vpnclient-3des-4.0.5.ebuild,v 1.3 2004/08/25 00:04:32 vapier Exp $ inherit eutils kmod @@ -44,7 +44,7 @@ src_compile () { unset ARCH fi sh ./driver_build.sh /lib/modules/${KV}/build - [ ! -f ./cisco_ipsec -o ! -f ./cisco_ipsec.ko ] \ + [ ! -f ./cisco_ipsec -a ! -f ./cisco_ipsec.ko ] \ && die "Failed to make module 'cisco_ipsec'" sed -i "s#@VPNBINDIR@#/usr/bin#" vpnclient_init sed -i "s#@VPNBINDIR@#/usr/bin#" vpnclient.ini.in @@ -64,8 +64,6 @@ src_install() { insinto /lib/modules/${KV}/CiscoVPN if is_kernel 2 5 || is_kernel 2 6 ; then doins cisco_ipsec.ko - dosed 's/VPNMOD="cisco_ipsec"/VPNMOD="cisco_ipsec.ko"/' \ - /etc/init.d/vpnclient else doins cisco_ipsec fi diff --git a/net-misc/cisco-vpnclient-3des/files/vpnclient.rc b/net-misc/cisco-vpnclient-3des/files/vpnclient.rc index e332e9c39373..0a1ae4a4c6a1 100644 --- a/net-misc/cisco-vpnclient-3des/files/vpnclient.rc +++ b/net-misc/cisco-vpnclient-3des/files/vpnclient.rc @@ -1,27 +1,37 @@ #!/sbin/runscript # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/cisco-vpnclient-3des/files/vpnclient.rc,v 1.5 2004/07/14 23:55:56 agriffis Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/cisco-vpnclient-3des/files/vpnclient.rc,v 1.6 2004/08/25 00:04:32 vapier Exp $ opts="start stop status" VPNCLIENT="/usr/bin/vpnclient" VPNDEV="cipsec0" -VPNMOD="cisco_ipsec" - -ID="`which id`" -if [ "$?" != "0" ]; then - eerror "Failed: Unable to determine access level (can't find $HILITE id $NORMAL in \$PATH)." - unset ID - exit 1 -fi -WHOAMI="`$ID -u`" depend() { need net } +checkconfig() { + export KV="$(uname -r)" + + export VPNMOD="cisco_ipsec" + case "${KV}" in + 2.6.*|2.5.*) VPNMOD_FILE="${VPNMOD}.ko";; + 2.4.*|2.2.*|2.0.*) VPNMOD_FILE="${VPNMOD}.o";; + *) + eerror "Kernel version '${KV}' is not supported" + return 1;; + esac + export VPNMOD_FILE + return 0 +} + start() { + checkconfig || return 1 + + local PC="" + ebegin "Starting Cisco VPN Client" if [ -f /etc/resolv.conf.vpnbackup ]; then @@ -29,88 +39,77 @@ start() { mv /etc/resolv.conf.vpnbackup /etc/resolv.conf fi - if [ -d /lib/modules/preferred ]; then - PC=/lib/modules/preferred/CiscoVPN - else - PC=/lib/modules/`uname -r`/CiscoVPN - fi - - if [ -d $PC ] ; then - /sbin/insmod ${PC}/${VPNMOD} >/dev/null 2>&1 - if [ "$?" != "0" ] ; then - eerror "Failed to load module ${VPNMOD}" - exit 1 - fi - else - eerror "module directory $PC not found." - exit 1 - fi - case "`uname -r`" in - 2.6.*) - ;; - 2.5.*) - ;; - 2.4.*) - ;; - 2.2.*) - ;; - 2.0.*) - # - # This is only needed due to a bug in 2.0.x kernels that affects - # arp lookups. - # - ifconfig $VPNDEV 222.222.222.222 ; - if [ "$?" != "0" ] ; then - eerror "Failed (ifconfig)." - /sbin/rmmod ${VPNMOD} - exit 1 - fi - ;; - *) - eerror "Failed (unsupported Linux version)." + if [ -d /lib/modules/preferred ]; then + PC="/lib/modules/preferred/CiscoVPN" + else + PC="/lib/modules/${KV}/CiscoVPN" + fi + + if [ -d "${PC}" ] ; then + /sbin/insmod ${PC}/${VPNMOD_FILE} >/dev/null 2>&1 + if [ "$?" != "0" ] ; then + eend 1 "Failed to load module '${VPNMOD}'" + return 1 + fi + else + eend 1 "module directory '$PC' not found" + return 1 + fi + + if [ "${KV:0:3}" == "2.0" ] ; then + # This is only needed due to a bug in 2.0.x kernels that affects + # arp lookups. + ifconfig $VPNDEV 222.222.222.222 ; + if [ "$?" != "0" ] ; then + eerror "Failed (ifconfig)" /sbin/rmmod ${VPNMOD} exit 1 - ;; - esac - eend $? + fi + fi + + eend 0 } stop() { + checkconfig || return 1 + ebegin "Stopping Cisco VPN Client" + if [ -x $VPNCLIENT ]; then $VPNCLIENT disconnect > /dev/null 2>&1 fi /sbin/lsmod | grep -q "${VPNMOD}" if [ "$?" != "0" ] ; then - eerror "Failed: module ${VPNMOD} is not running." - exit 1 + eend 1 "Failed: module ${VPNMOD} is not running" + return 1 fi /sbin/ifconfig $VPNDEV down if [ "$?" != "0" ] ; then - eerror "Failed (ifconfig)." - exit 1 + eend 1 "Failed (ifconfig)" + return 1 fi /sbin/rmmod ${VPNMOD} if [ "$?" != "0" ] ; then - eerror "Failed (rmmod)." - exit 1 + eend 1 "Failed (rmmod)" + return 1 fi - eend $? + + eend 0 } status() { - /sbin/lsmod | egrep 'Module' + checkconfig || return 1 + /sbin/lsmod | egrep "${VPNMOD}" if [ "$?" != "0" ] ; then - echo - eerror "Failed (lsmod ${VPNMOD}): the VPN module is not loaded." - exit 1 + eerror "Failed (lsmod ${VPNMOD}): the VPN module is not loaded" + return 1 fi echo /sbin/ifconfig $VPNDEV if [ "$?" != "0" ] ; then echo - eerror "Failed (ifconfig ${VPNDEV}): the virtual interface is not present." - exit 1 + eerror "Failed (ifconfig ${VPNDEV}): the virtual interface is not present" + return 1 fi } |