Gmane
From: Pavel Roskin <svn-commits <at> madwifi.org>
Subject: revision 3840 committed
Newsgroups: gmane.linux.drivers.madwifi.cvs
Date: 2008-08-01 03:20:47 GMT (23 weeks, 1 day, 1 hour and 13 minutes ago)
Project     : madwifi
Revision    : 3840
Author      : proski (Pavel Roskin)
Date        : 2008-08-01 05:20:46 +0200 (Fri, 01 Aug 2008)

Log Message :
Replace madwifi-unload.bash with the new madwifi-unload from trunk

Add "make unload" support.

Affected Files:
* madwifi/branches/madwifi-0.9.4/Makefile             updated             
* madwifi/branches/madwifi-0.9.4/scripts/madwifi-unload  added               
* madwifi/branches/madwifi-0.9.4/scripts/madwifi-unload.bash  deleted             
* madwifi/branches/madwifi-0.9.4/tools/Makefile       updated             

Modified: madwifi/branches/madwifi-0.9.4/Makefile
===================================================================
--- madwifi/branches/madwifi-0.9.4/Makefile	2008-08-01 03:08:43 UTC (rev 3839)
+++ madwifi/branches/madwifi-0.9.4/Makefile	2008-08-01 03:20:46 UTC (rev 3840)
@@ -137,6 +137,10 @@
 release:
 	sh scripts/make-release.bash

+.PHONY: unload
+unload:
+	bash scripts/madwifi-unload
+
 configcheck: sanitycheck
 	@echo -n "Checking kernel configuration... "
 	

Added: madwifi/branches/madwifi-0.9.4/scripts/madwifi-unload
===================================================================
--- madwifi/branches/madwifi-0.9.4/scripts/madwifi-unload	                        (rev 0)
+++ madwifi/branches/madwifi-0.9.4/scripts/madwifi-unload	2008-08-01 03:20:46 UTC (rev 3840)
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+: ${PATTERN='\(ath_.*\|wlan_.*\|wlan\)$'}
+: ${MAX_TRIES=10}
+
+test "$(id -u)" = 0 || {
+	echo "ERROR: You must be root to run this script" >&2
+	exit 1
+}
+
+test -r /proc/modules || {
+	echo "ERROR: Cannot read /proc/modules" >&2
+	exit 1
+}
+
+tries="$MAX_TRIES"
+while test "$tries" != "0"; do
+	skipped=0
+	IFS='
+'
+	for line in $(cat /proc/modules); do
+		IFS=' 	'
+		set x $line
+		name="$2"
+		size="$3"
+		use_count="$4"
+		use_name="$5"
+		state="$6"
+		expr "$name" : "$PATTERN" >/dev/null || continue
+
+		# Compatibility for Linux 2.4.x
+		test -z "$state" && { use_name="-"; state="Live"; }
+
+		if test "$state" != "Live" || test "$use_count" != "0" || \
+		   test "$use_name" != "-"; then
+			# Don't skip unload in the last run
+			if test "$tries" != "1"; then
+				skipped=1
+				continue
+			fi
+		fi
+
+		echo "Unloading \"$name\""
+		sync	# to be safe
+		/sbin/rmmod "$name" || {
+			echo "ERROR: cannot unload module \"$name\"" >&2
+			exit 1
+		}
+		sync    # to be even safer
+	done
+	test "$skipped" = "0" && break
+	tries=$(($tries - 1))
+done
+
+exit 0

Property changes on: madwifi/branches/madwifi-0.9.4/scripts/madwifi-unload
___________________________________________________________________
Name: svn:executable
   + *

Deleted: madwifi/branches/madwifi-0.9.4/scripts/madwifi-unload.bash

Modified: madwifi/branches/madwifi-0.9.4/tools/Makefile
===================================================================
--- madwifi/branches/madwifi-0.9.4/tools/Makefile	2008-08-01 03:08:43 UTC (rev 3839)
+++ madwifi/branches/madwifi-0.9.4/tools/Makefile	2008-08-01 03:20:46 UTC (rev 3840)
@@ -82,6 +82,7 @@
 	done
 	install -d $(DESTDIR)$(MANDIR)/man8
 	install -m 0644 man/*.8 $(DESTDIR)$(MANDIR)/man8
+	install $(TOP)/scripts/madwifi-unload $(DESTDIR)$(BINDIR)/madwifi-unload

 uninstall:
 	for i in $(ALL); do \

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/