diff options
author | 2005-10-22 22:45:07 +0000 | |
---|---|---|
committer | 2005-10-22 22:45:07 +0000 | |
commit | 74b53cf015291889e2d85ae526d7355d6c4e9197 (patch) | |
tree | 6f51a00fdc63f7728f787b1736680781c9ecdd5b /net-dialup/slmodem/files | |
parent | Added space requirements for bug #110071. (diff) | |
download | historical-74b53cf015291889e2d85ae526d7355d6c4e9197.tar.gz historical-74b53cf015291889e2d85ae526d7355d6c4e9197.tar.bz2 historical-74b53cf015291889e2d85ae526d7355d6c4e9197.zip |
Fix init script to work also when we do not get a device node automatically
Package-Manager: portage-2.0.53_rc6
Diffstat (limited to 'net-dialup/slmodem/files')
-rw-r--r-- | net-dialup/slmodem/files/digest-slmodem-2.9.11_pre20051009-r1 | 2 | ||||
-rw-r--r-- | net-dialup/slmodem/files/slmodem-2.9.11.init | 93 |
2 files changed, 95 insertions, 0 deletions
diff --git a/net-dialup/slmodem/files/digest-slmodem-2.9.11_pre20051009-r1 b/net-dialup/slmodem/files/digest-slmodem-2.9.11_pre20051009-r1 new file mode 100644 index 000000000000..96c7de961cbb --- /dev/null +++ b/net-dialup/slmodem/files/digest-slmodem-2.9.11_pre20051009-r1 @@ -0,0 +1,2 @@ +MD5 292fec9aab5b2225cc94acc3a3c2adf2 slmodem-2.9.11-20051009.tar.gz 833615 +MD5 a23326976632fe7774e110cbc0636f70 ungrab-winmodem.tar.gz 1872 diff --git a/net-dialup/slmodem/files/slmodem-2.9.11.init b/net-dialup/slmodem/files/slmodem-2.9.11.init new file mode 100644 index 000000000000..e7811769530d --- /dev/null +++ b/net-dialup/slmodem/files/slmodem-2.9.11.init @@ -0,0 +1,93 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later + +if [ "${MODULE}" = "alsa" ]; +then + needalsasound="alsasound" +fi +depend() { + need logger $needalsasound +} + + +checkconfig() { + if [ -z "${COUNTRY}" ]; then + eerror "You need to config /etc/conf.d/slmodem first" + return 1 + fi +} + +function loadsalsa { + ebegin "Starting slmodemd for ${DEV}" + start-stop-daemon --start --background --nicelevel=${NICE} --make-pidfile \ + --pidfile /var/run/slmodemd.pid --startas /usr/sbin/slmodemd \ + -- -country=${COUNTRY} -g=${GROUP} --alsa ${HW_SLOT} + return ${?} +} + +function loadsmodule { + modprobe ${MODULE}; + + if [ "$?" -gt 0 ] + then + eerror "Missing ${MODULE}. Please set up /etc/conf.d/slmodem" + return 1; + fi + + if [ -z "${MDEV}" ]; then MDEV="/dev/${MODULE}0"; fi + if [ ! -c "${MDEV}" ]; then mknod ${MDEV} c 242 0; fi + + if [ ! -c /dev/ppp ]; then mknod /dev/ppp c 108 0; fi + + ebegin "Starting slmodemd for ${DEV}" + start-stop-daemon --start --background --nicelevel=${NICE} --make-pidfile \ + --pidfile /var/run/slmodemd.pid --startas /usr/sbin/slmodemd \ + -- -country=${COUNTRY} -g=${GROUP} ${MDEV} + return ${?} +} + +start() { + + checkconfig || return 1 + + # either if we use alsa or not, the only thing we need is + # ttySL0, which is created by slmodemd when started (points to a pts) + + if [ "${MODULE}" == "alsa" ]; then + loadsalsa + else + loadsmodule + fi + + result=${?} + + test ! -z "${LN_DEV}" && /bin/ln -s ${DEV} ${LN_DEV} 2> /dev/null + + eend ${result} +} + +stop() { + ebegin "Shutting down slmodemd" + start-stop-daemon --stop --quiet --pidfile /var/run/slmodemd.pid + result=${?} + [ -e /var/run/slmodemd.pid ] && rm /var/run/slmodemd.pid + unlink ${LN_DEV} 2> /dev/null + eend ${result} + if [ ! "${MODULE}" == "alsa" ]; + then + ebegin "Waiting for ${MODULE} modem driver unload" + if [ "$RC_NOCOLOR" != "yes" ]; then + echo -e "\e[A\e[44G " + echo -ne "\e[A\e[44G" + fi + for ((a=0,result=1; result==1 && a <= 5 ; a++)) + do + sleep 0.25 + echo -n "." + modprobe -r slamr 2> /dev/null && result=0 + done + if [ "$RC_NOCOLOR" != "yes" ]; then echo; fi + eend ${result} + fi +} |