wok-current rev 3498

get-softmodem-driver: Add automatic country detection during martian install
author Dominique Corbex <domcox@users.sourceforge.net>
date Thu Jun 18 21:10:59 2009 +0200 (2009-06-18)
parents 8d681e35f63d
children 3934f2921b68
files get-softmodem-driver/receipt get-softmodem-driver/stuff/get-softmodem-driver get-softmodem-driver/stuff/martian.country get-softmodem-driver/stuff/martian.init get-softmodem-driver/stuff/martian.receipt get-softmodem-driver/stuff/slmodem.country get-softmodem-driver/stuff/slmodem.receipt
line diff
     1.1 --- a/get-softmodem-driver/receipt	Thu Jun 18 23:55:12 2009 +0800
     1.2 +++ b/get-softmodem-driver/receipt	Thu Jun 18 21:10:59 2009 +0200
     1.3 @@ -1,7 +1,7 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="get-softmodem-driver"
     1.7 -VERSION="0.9"
     1.8 +VERSION="0.11"
     1.9  CATEGORY="non-free"
    1.10  SHORT_DESC="Get misc softmodem drivers."
    1.11  MAINTAINER="domcox@slitaz.org"
     2.1 --- a/get-softmodem-driver/stuff/get-softmodem-driver	Thu Jun 18 23:55:12 2009 +0800
     2.2 +++ b/get-softmodem-driver/stuff/get-softmodem-driver	Thu Jun 18 21:10:59 2009 +0200
     2.3 @@ -9,25 +9,21 @@
     2.4  {
     2.5  echo "--------------------------------------------------------"
     2.6  echo "Due to a lack of compatible hardware for troubleshooting,"
     2.7 -echo "this $PACKAGE package has not been tested."
     2.8 -echo "Please report any bug to SliTaz Labs or SliTaz Forum."
     2.9 +echo "this $PACKAGE package has not been tested. Please report"
    2.10 +echo "any success, failure, bug to SliTaz Labs or SliTaz Forum."
    2.11  echo "--------------------------------------------------------"
    2.12  sleep 1
    2.13  }
    2.14  
    2.15  case "$PACKAGE" in
    2.16  hsfmodem)
    2.17 -	. /usr/share/softmodem/hsfmodem.receipt
    2.18 -	echo $SHORT_DESC;;
    2.19 +	. /usr/share/softmodem/hsfmodem.receipt ;;
    2.20  hcfpcimodem)
    2.21 -	. /usr/share/softmodem/hcfpcimodem.receipt
    2.22 -	echo $SHORT_DESC;;
    2.23 +	. /usr/share/softmodem/hcfpcimodem.receipt ;;
    2.24  martian)
    2.25 -	. /usr/share/softmodem/martian.receipt
    2.26 -	echo $SHORT_DESC;;
    2.27 +	. /usr/share/softmodem/martian.receipt ;;
    2.28  slmodem)
    2.29 -	. /usr/share/softmodem/slmodem.receipt
    2.30 -	echo $SHORT_DESC;;
    2.31 +	. /usr/share/softmodem/slmodem.receipt ;;
    2.32  *)
    2.33  	echo "Unknown modem driver. Please run one of the following commands:"
    2.34  	for i in $(cd $(dirname $0); ls get-*-driver); do
    2.35 @@ -38,6 +34,9 @@
    2.36  	exit 1;;
    2.37  esac
    2.38  
    2.39 +# Report
    2.40 +echo "Installing $SHORT_DESC.."
    2.41 +
    2.42  # Check if user is root to install.
    2.43  if test $(id -u) != 0 ; then
    2.44  	echo -e "\nYou must be root to run `basename $0`."
    2.45 @@ -142,6 +141,11 @@
    2.46  	cp -a kmodule/martian_dev.ko $fs/lib/modules/`uname -r`/martian
    2.47  	mkdir -p $fs/etc/init.d
    2.48  	cp -a /usr/share/softmodem/martian.init $fs/etc/init.d/martian
    2.49 +	chmod +x $fs/etc/init.d/martian
    2.50 +	# Data for automatic region setting
    2.51 +	mkdir -p $fs/usr/share/martian
    2.52 +	cp -a /usr/share/softmodem/zone.tab $fs/usr/share/martian
    2.53 +	cp -a /usr/share/softmodem/martian.country $fs/usr/share/martian
    2.54  	rm -rf $src
    2.55  	;;
    2.56  slmodem)
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/get-softmodem-driver/stuff/martian.country	Thu Jun 18 21:10:59 2009 +0200
     3.3 @@ -0,0 +1,88 @@
     3.4 +AE	ae	UNITED_ARAB_EMIRATES
     3.5 +AR	ar	ARGENTINA
     3.6 +AT	at	AUSTRIA
     3.7 +AU	au	AUSTRALIA
     3.8 +BB	bb	BARBADOS
     3.9 +BD	bd	BANGLADESH
    3.10 +BG	bg	BULGARIA
    3.11 +BO	bo	BOLIVIA
    3.12 +BR	br	BRAZIL
    3.13 +BY	by	BELARUS
    3.14 +CA	ca	CANADA
    3.15 +CH	ch	SWITZERLAND
    3.16 +CL	cl	CHILE
    3.17 +CN	cn	CHINA
    3.18 +CO	co	COLOMBIA
    3.19 +CR	cr	COSTA_RICA
    3.20 +CY	cy	CYPRUS
    3.21 +CZ	cz	CZECH_REPUBLIC
    3.22 +DE	de	GERMANY
    3.23 +DK	dk	DENMARK
    3.24 +EC	ec	ECUADOR
    3.25 +EE	ee	ESTONIA
    3.26 +EG	eg	EGYPT
    3.27 +ES	es	SPAIN
    3.28 +EU	eu	EUROPE
    3.29 +FI	fi	FINLAND
    3.30 +FR	fr	FRANCE
    3.31 +GP	fr	GUADELOUPE
    3.32 +GR	gr	GREECE
    3.33 +GT	gt	GUATEMALA
    3.34 +GU	gu	GUAM
    3.35 +HK	hk	HONG_KONG
    3.36 +HR	hr	CROATIA
    3.37 +HU	hu	HUNGARY
    3.38 +ID	id	INDONESIA
    3.39 +IE	ie	IRELAND
    3.40 +IL	il	ISRAEL
    3.41 +IN	in	INDIA
    3.42 +IS	is	ICELAND
    3.43 +IT	it	ITALY
    3.44 +JP	jp	JAPAN
    3.45 +KR	kr	REPUBLIC_OF_KOREA
    3.46 +KW	kw	KUWAIT
    3.47 +LB	lb	LEBANON
    3.48 +LI	li	LIECHTENSTEIN
    3.49 +LK	lk	SRI_LANKA
    3.50 +LT	lt	LITHUANIA
    3.51 +LU	lu	LUXEMBOURG
    3.52 +LV	lv	LATVIA
    3.53 +MA	ma	MOROCCO
    3.54 +MQ	fr	MARTINIQUE
    3.55 +MT	mt	MALTA
    3.56 +MX	mx	MEXICO
    3.57 +MY	my	MALAYSIA
    3.58 +NC	fr	NEW_CALEDONIA
    3.59 +NI	ni	NICARAGUA
    3.60 +NL	nl	NETHERLANDS
    3.61 +NO	no	NORWAY
    3.62 +NZ	nz	NEW_ZEALAND
    3.63 +OM	om	OMAN
    3.64 +PA	pa	PANAMA
    3.65 +PE	pe	PERU
    3.66 +PH	ph	PHILIPPINES
    3.67 +PJ	fr	FRENCH_POLYNESIA
    3.68 +PK	pk	PAKISTAN
    3.69 +PL	pl	POLAND
    3.70 +PR	pr	PUERTO_RICO
    3.71 +PT	pt	PORTUGAL
    3.72 +PY	py	PARAGUAY
    3.73 +RO	ro	ROMANIA
    3.74 +RU	ru	RUSSIA
    3.75 +SA	sa	SAUDI_ARABIA
    3.76 +SE	se	SWEDEN
    3.77 +SG	sg	SINGAPORE
    3.78 +SI	si	SLOVENIA
    3.79 +SK	sk	SLOVAKIA
    3.80 +TH	th	THAILAND
    3.81 +TN	tn	TUNISIA
    3.82 +TR	tr	TURKEY
    3.83 +TW	tw	TAIWAN
    3.84 +UA	ua	UKRAINE
    3.85 +UK	uk	UNITED_KINGDOM
    3.86 +US	us	UNITED_STATES
    3.87 +UY	uy	URUGUAY
    3.88 +VE	ve	VENEZUELA
    3.89 +VI	vi	VIRGIN_ISLANDS_U.S.
    3.90 +VN	vn	VIET_NAM
    3.91 +ZA	za	SOUTH_AFRICA
     4.1 --- a/get-softmodem-driver/stuff/martian.init	Thu Jun 18 23:55:12 2009 +0800
     4.2 +++ b/get-softmodem-driver/stuff/martian.init	Thu Jun 18 21:10:59 2009 +0200
     4.3 @@ -11,7 +11,7 @@
     4.4  NAME="Martian modem"
     4.5  DESC="Agere Systems PCI Modem deamon"
     4.6  DAEMON=/usr/sbin/martian_modem
     4.7 -OPTIONS="--daemon $MARTIAN_OPTIONS /dev/ttySM0"
     4.8 +OPTIONS="--daemon $MARTIAN_OPTIONS"
     4.9  PIDFILE=/var/run/martian.pid
    4.10  MODULE="martian_dev"
    4.11  
    4.12 @@ -36,7 +36,8 @@
    4.13        exit 1
    4.14      fi
    4.15      echo -n "Stopping $DESC: $NAME... "
    4.16 -    kill `cat $PIDFILE`
    4.17 +    killall martian_modem
    4.18 +	rm $PIDFILE
    4.19      status
    4.20      ;;
    4.21    restart)
    4.22 @@ -45,7 +46,7 @@
    4.23        exit 1
    4.24      fi
    4.25      echo -n "Restarting $DESC: $NAME... "
    4.26 -    kill `cat $PIDFILE`
    4.27 +    killall martian_modem
    4.28      sleep 2
    4.29      $DAEMON $OPTIONS &&  echo `/bin/pidof $DAEMON` > $PIDFILE
    4.30      status
     5.1 --- a/get-softmodem-driver/stuff/martian.receipt	Thu Jun 18 23:55:12 2009 +0800
     5.2 +++ b/get-softmodem-driver/stuff/martian.receipt	Thu Jun 18 21:10:59 2009 +0200
     5.3 @@ -17,21 +17,33 @@
     5.4  	# Country settings
     5.5  	if [ -e /etc/TZ ]; then
     5.6  		ZONE=`cat /etc/TZ`
     5.7 -		CODE=`grep $ZONE /usr/share/softmodem/marszone.tab | cut -f1'`
     5.8 +		CODE=`grep $ZONE /usr/share/martian/zone.tab | cut -f1'`
     5.9  		if [ -n $CODE ]; then
    5.10 -			COUNTRY=`grep ^$CODE /usr/share/softmodem/martian.country | cut -f2`
    5.11 +			COUNTRY=`grep ^$CODE /usr/share/martian/martian.country | cut -f2`
    5.12 +			COUNTRY_NAME=`grep ^$CODE /usr/share/martian/martian.country | cut -f3`
    5.13  		fi
    5.14  	fi
    5.15  	if [ -z $COUNTRY ]; then
    5.16 -		COUNTRY="USA"
    5.17 +		COUNTRY="us"
    5.18 +		COUNTRY_NAME="USA"
    5.19  	fi
    5.20 -	cat >> $root/etc/daemons.conf << "EOT"
    5.21 -# martian daemon options.
    5.22 -MARTIAN_OPTIONS="--country=$COUNTRY"
    5.23 -
    5.24 -EOT
    5.25 +	echo "Automatic country setting: $COUNTRY_NAME"
    5.26 +	# Save options
    5.27 +	if [ `grep -c MARTIAN_OPTIONS /etc/daemons.conf` -gt 0 ]; then
    5.28 +		sed -i 's/MARTIAN_OPTIONS=.*/MARTIAN_OPTIONS="--country='"$COUNTRY"' \/dev\/ttySM0"/' /etc/daemons.conf
    5.29 +	else
    5.30 +	echo "# slmodemd daemon options." >> $root/etc/daemons.conf
    5.31 +		echo "MARTIAN_OPTIONS=\"--country=$COUNTRY /dev/ttySM0\"" >> $root/etc/daemons.conf
    5.32 +		echo  >> $root/etc/daemons.conf
    5.33 +	fi
    5.34  	# Load module
    5.35  	/sbin/depmod -a
    5.36  	/sbin/modprobe martian_dev && \
    5.37  	/etc/init.d/martian start
    5.38  }
    5.39 +
    5.40 +post_remove()
    5.41 +{
    5.42 +	/etc/init.d/martian stop
    5.43 +	rm -rf /usr/share/martian
    5.44 +}
     6.1 --- a/get-softmodem-driver/stuff/slmodem.country	Thu Jun 18 23:55:12 2009 +0800
     6.2 +++ b/get-softmodem-driver/stuff/slmodem.country	Thu Jun 18 21:10:59 2009 +0200
     6.3 @@ -28,7 +28,6 @@
     6.4  GL	CTR21EUROPE
     6.5  GP	FRANCE
     6.6  GR	GREECE
     6.7 -GY	FRANCE
     6.8  HK	HONG_KONG
     6.9  HU	HUNGARY
    6.10  ID	INDONESIA
     7.1 --- a/get-softmodem-driver/stuff/slmodem.receipt	Thu Jun 18 23:55:12 2009 +0800
     7.2 +++ b/get-softmodem-driver/stuff/slmodem.receipt	Thu Jun 18 21:10:59 2009 +0200
     7.3 @@ -6,7 +6,7 @@
     7.4  SHORT_DESC="Support for the SmartLink Softmodem and ALSA supported chipsets."
     7.5  MAINTAINER="domcox@slitaz.org"
     7.6  TARBALL="$PACKAGE-$VERSION.tar.gz"
     7.7 -DEPENDS="module-init-tools linux-source"
     7.8 +DEPENDS="alsa-lib module-init-tools linux-source"
     7.9  WEB_SITE="http://linmodems.technion.ac.il"
    7.10  WGET_URL="http://linmodems.technion.ac.il/packages/smartlink/$TARBALL"
    7.11  
    7.12 @@ -41,5 +41,6 @@
    7.13  
    7.14  post_remove()
    7.15  {
    7.16 +	/etc/init.d/slmodem stop
    7.17  	rm -rf /usr/share/slmodem
    7.18  }
    7.19 \ No newline at end of file