Fix init script to work also when we do not get a device node automatically
authorStefan Schweizer <genstef@gentoo.org>
Sat, 22 Oct 2005 22:45:07 +0000 (22:45 +0000)
committerStefan Schweizer <genstef@gentoo.org>
Sat, 22 Oct 2005 22:45:07 +0000 (22:45 +0000)
Package-Manager: portage-2.0.53_rc6

net-dialup/slmodem/ChangeLog
net-dialup/slmodem/Manifest
net-dialup/slmodem/files/digest-slmodem-2.9.11_pre20051009-r1 [new file with mode: 0644]
net-dialup/slmodem/files/slmodem-2.9.11.init [new file with mode: 0644]
net-dialup/slmodem/slmodem-2.9.11_pre20051009-r1.ebuild [new file with mode: 0644]

index 21a091dfe202e9c575411a6d75506e198e9ced3a..2028ffefc65d1d6c9fa12954f69769e8255e1b69 100644 (file)
@@ -1,6 +1,12 @@
 # ChangeLog for net-dialup/slmodem
 # Copyright 2000-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-dialup/slmodem/ChangeLog,v 1.53 2005/10/16 09:11:45 mrness Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-dialup/slmodem/ChangeLog,v 1.54 2005/10/22 22:45:06 genstef Exp $
+
+*slmodem-2.9.11_pre20051009-r1 (22 Oct 2005)
+
+  22 Oct 2005; Stefan Schweizer <genstef@gentoo.org>
+  +files/slmodem-2.9.11.init, +slmodem-2.9.11_pre20051009-r1.ebuild:
+  Fix init script to work also when we do not get a device node automatically
 
   16 Oct 2005; Alin Nastac <mrness@gentoo.org> slmodem-2.9.9d.ebuild,
   slmodem-2.9.11_pre20050816.ebuild, slmodem-2.9.11_pre20051009.ebuild:
index fd76e57f5a9b827615291204da17a26dbd51286f..553a2df7fa9ca5a312ba5d374908c7d8547fcfd1 100644 (file)
@@ -1,28 +1,21 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-MD5 54c73f3777213c30e2a93b7ff18bd711 slmodem-2.9.11_pre20051009.ebuild 4549
-MD5 efbbb8c40614e5c3d370b0c55eb6b67e slmodem-2.9.11_pre20050816.ebuild 4345
-MD5 da3f5db025a3799ee1bdf5b9eef53601 slmodem-2.9.9d.ebuild 3553
-MD5 4bd2f6ad36ec51657c5facdabbde4331 ChangeLog 12471
-MD5 e487a8ab7ec754f06a85f64f4aaa7540 metadata.xml 409
-MD5 a5c2c40e3a6c4665033c97bb9088f03d files/slusb.hotplug 262
-MD5 618a9ebd35ccb49bf34e6ea522afcb8b files/slmodem-class-simple-to-class.diff 6847
-MD5 e91d1df68be76c531a8514dba77c1886 files/slmodem-2.9.11.modules 106
-MD5 8834a62c67909059cef10887bfbcc853 files/slmodem-2.9.modules 494
-MD5 1a0b854bbe34e01e918b855b7c81ffba files/slmodem-2.9.conf 649
-MD5 3d00e935ef9592cf6538298cacd92a02 files/slmodem-2.9.init 2702
+MD5 c0a2b060e89d0375f0967bd2408cc7c7 ChangeLog 12719
 MD5 8338cfc9815a953d85195bdccd9fbc97 files/digest-slmodem-2.9.11_pre20050816 140
 MD5 cae2ec761f3db78791ab4ec7f0e83d5b files/digest-slmodem-2.9.11_pre20051009 140
+MD5 cae2ec761f3db78791ab4ec7f0e83d5b files/digest-slmodem-2.9.11_pre20051009-r1 140
 MD5 fd55ef399408a109742263cd5b4a5219 files/digest-slmodem-2.9.9d 66
+MD5 67168d0e7a1be3e5041ec3cb8dabb50d files/slmodem-2.9.11.init 2182
+MD5 e91d1df68be76c531a8514dba77c1886 files/slmodem-2.9.11.modules 106
 MD5 fd0f0a405fb7f059cc2f5078d54fd884 files/slmodem-2.9.9b-gcc4.patch 463
-MD5 1561aebe43beb20809e47ea1dd62115f files/slmodem-amd64-Makefile.diff 762
+MD5 1a0b854bbe34e01e918b855b7c81ffba files/slmodem-2.9.conf 649
 MD5 c80ecf5c3d5605220e4b0055850260a5 files/slmodem-2.9.devfs 786
+MD5 3d00e935ef9592cf6538298cacd92a02 files/slmodem-2.9.init 2702
+MD5 8834a62c67909059cef10887bfbcc853 files/slmodem-2.9.modules 494
+MD5 1561aebe43beb20809e47ea1dd62115f files/slmodem-amd64-Makefile.diff 762
+MD5 618a9ebd35ccb49bf34e6ea522afcb8b files/slmodem-class-simple-to-class.diff 6847
 MD5 9c47e598fd639d46a03493fe7a52595e files/slmodem-remove-URB_ASYNC_UNLINK.patch 436
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.1 (GNU/Linux)
-
-iD8DBQFDUhlqNSP4Vda7IdsRAoO+AJ0dup4MCO9v7nqGAqKaZf+fx/3fjgCcDJFw
-We8gc+hDC5zS0U1+IBm1ZV4=
-=pD7w
------END PGP SIGNATURE-----
+MD5 a5c2c40e3a6c4665033c97bb9088f03d files/slusb.hotplug 262
+MD5 e487a8ab7ec754f06a85f64f4aaa7540 metadata.xml 409
+MD5 efbbb8c40614e5c3d370b0c55eb6b67e slmodem-2.9.11_pre20050816.ebuild 4345
+MD5 d674ea9e8c47078b3bc481b565f1998f slmodem-2.9.11_pre20051009-r1.ebuild 4556
+MD5 54c73f3777213c30e2a93b7ff18bd711 slmodem-2.9.11_pre20051009.ebuild 4549
+MD5 da3f5db025a3799ee1bdf5b9eef53601 slmodem-2.9.9d.ebuild 3553
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 (file)
index 0000000..96c7de9
--- /dev/null
@@ -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 (file)
index 0000000..e781176
--- /dev/null
@@ -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
+}
diff --git a/net-dialup/slmodem/slmodem-2.9.11_pre20051009-r1.ebuild b/net-dialup/slmodem/slmodem-2.9.11_pre20051009-r1.ebuild
new file mode 100644 (file)
index 0000000..0b58f9a
--- /dev/null
@@ -0,0 +1,153 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-dialup/slmodem/slmodem-2.9.11_pre20051009-r1.ebuild,v 1.1 2005/10/22 22:45:07 genstef Exp $
+
+inherit eutils linux-mod multilib
+
+DESCRIPTION="Driver for Smart Link modem"
+HOMEPAGE="http://linmodems.technion.ac.il/packages/smartlink/"
+SRC_URI="http://linmodems.technion.ac.il/packages/smartlink/${P/_pre/-}.tar.gz
+       http://linmodems.technion.ac.il/packages/smartlink/ungrab-winmodem.tar.gz"
+LICENSE="Smart-Link"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86"
+IUSE="alsa usb"
+
+RDEPEND="virtual/libc
+       alsa? ( media-libs/alsa-lib )
+       amd64? ( app-emulation/emul-linux-x86-soundlibs )"
+
+DEPEND="${RDEPEND}
+       >=sys-apps/sed-4"
+S=${WORKDIR}/${P/_pre/-}
+
+pkg_setup() {
+       has_multilib_profile && ABI=x86
+
+       MODULE_NAMES="ungrab-winmodem(:${WORKDIR}/ungrab-winmodem)"
+       if ! use amd64; then
+               MODULE_NAMES="${MODULE_NAMES} slamr(net:${S}/drivers)"
+               if use usb; then
+                       MODULE_NAMES="${MODULE_NAMES} slusb(net:${S}/drivers)"
+                       CONFIG_CHECK="USB"
+               fi
+       fi
+       BUILD_TARGETS="all"
+       linux-mod_pkg_setup
+       BUILD_PARAMS="KERNEL_DIR=${KV_DIR}"
+       MODULESD_UNGRAB_WINMODEM_ENABLED="no"
+       MODULESD_SLAMR_ENABLED="no"
+       MODULESD_SLUSB_ENABLED="no"
+}
+
+src_unpack() {
+       unpack ${A}
+       sed -i "s:SUBDIRS=\$(shell pwd):SUBDIRS=${WORKDIR}/ungrab-winmodem:" \
+               ${WORKDIR}/ungrab-winmodem/Makefile
+       convert_to_m ${WORKDIR}/ungrab-winmodem/Makefile
+
+       cd ${S}
+       sed -i "s:SUBDIRS=\$(shell pwd):SUBDIRS=${S}/drivers:" \
+               ${S}/drivers/Makefile
+       convert_to_m ${S}/drivers/Makefile
+       epatch ${FILESDIR}/slmodem-remove-URB_ASYNC_UNLINK.patch
+       epatch ${FILESDIR}/slmodem-amd64-Makefile.diff
+}
+
+src_compile() {
+       local MAKE_PARAMS=""
+       if use alsa || use amd64; then
+               MAKE_PARAMS="SUPPORT_ALSA=1"
+       fi
+       emake ${MAKE_PARAMS} modem || die "failed to build modem"
+
+       has_multilib_profile && ABI=${DEFAULT_ABI}
+       linux-mod_src_compile
+}
+
+src_install() {
+       linux-mod_src_install
+
+       cd ${S}
+       newsbin modem/modem_test slmodem_test
+       dosbin modem/slmodemd
+       dodir /var/lib/slmodem
+       fowners root:dialout /var/lib/slmodem
+       keepdir /var/lib/slmodem
+
+       insinto /etc/conf.d/; newins ${FILESDIR}/${PN}-2.9.conf ${PN}
+       exeinto /etc/init.d/; newexe ${FILESDIR}/${PN}-2.9.11.init ${PN}
+
+       # configure for alsa - or not for alsa
+       if use alsa; then
+               sed -i -e "s/# MODULE=alsa/MODULE=alsa/" \
+                       -e "s/# HW_SLOT=modem:1/HW_SLOT=modem:1/" ${D}/etc/conf.d/slmodem
+       else
+               sed -i "s/# MODULE=slamr/MODULE=slamr/" ${D}/etc/conf.d/slmodem
+       fi
+
+
+       # Add module aliases and install hotplug script
+       insinto /etc/modules.d/; newins ${FILESDIR}/${PN}-2.9.11.modules ${PN}
+       if use usb; then
+               exeinto /etc/hotplug/usb; newexe ${FILESDIR}/slusb.hotplug slusb
+       fi
+
+       dodir /etc/hotplug/blacklist.d
+       echo -e "slusb\nslamr\nsnd-intel8x0m" >> ${D}/etc/hotplug/blacklist.d/${PN}
+
+       # Add configuration for devfs, udev
+       if [ -e ${ROOT}/dev/.devfsd ] ; then
+               insinto /etc/devfs.d/; newins ${FILESDIR}/${PN}-2.9.devfs ${PN}
+       elif [ -e ${ROOT}/dev/.udev ] ; then
+               dodir /etc/udev/rules.d/
+               echo 'KERNEL="slamr", NAME="slamr0" GROUP="dialout"' > \
+                        ${D}/etc/udev/rules.d/55-${PN}.rules
+               echo 'KERNEL="slusb", NAME="slusb0" GROUP="dialout"' >> \
+                        ${D}/etc/udev/rules.d/55-${PN}.rules
+       fi
+
+       dodoc Changes README ${WORKDIR}/ungrab-winmodem/Readme.txt
+}
+
+pkg_postinst() {
+       linux-mod_pkg_postinst
+
+       # Make some devices if we aren't using devfs or udev
+       if [ -e ${ROOT}/dev/.devfsd ]; then
+               ebegin "Restarting devfsd to reread devfs rules"
+                       killall -HUP devfsd
+               eend $?
+
+       elif [ -e ${ROOT}/dev/.udev ]; then
+               ebegin "Restarting udev to reread udev rules"
+                       udevstart
+               eend $?
+       else
+               cd ${S}/drivers
+               make DESTDIR=${ROOT} install-devices
+       fi
+
+       if [ ! -e ${ROOT}/dev/ppp ]; then
+               mknod ${ROOT}/dev/ppp c 108 0
+       fi
+
+       ewarn "To avoid problems, slusb/slamr have been added to /etc/hotplug/blacklist"
+       einfo "You must edit /etc/conf.d/${PN} for your configuration"
+       einfo "To add slmodem to your startup - type : rc-update add slmodem default"
+
+       if use alsa; then
+               einfo "I hope you have already added alsa to your startup: "
+               einfo "otherwise type: rc-update add alsasound boot"
+               einfo
+               einfo "If you need to use snd-intel8x0m from the kernel"
+               einfo "compile it as a module and edit /etc/modules.d/alsa"
+               einfo 'to: "alias snd-card-(number) snd-intel8x0m"'
+       fi
+
+       einfo "You need to be in the uucp AND dialout group to make calls as a user."
+       einfo
+       einfo "If you see the following in dmesg:"
+       echo slamr: device 10b9:5457 is grabbed by driver serial
+       einfo "you need to modprobe ungrab-winmodem before slamr"
+}