r1074 - in trunk: . ATTACHMENTS/wpa-service

tushar at linuxfromscratch.org tushar at linuxfromscratch.org
Tue Mar 27 11:46:49 PDT 2007


Author: tushar
Date: 2007-03-27 12:46:49 -0600 (Tue, 27 Mar 2007)
New Revision: 1074

Removed:
   trunk/ATTACHMENTS/wpa-service/ifplugd_wrapper-script
   trunk/ATTACHMENTS/wpa-service/wpa-service2
Modified:
   trunk/ATTACHMENTS/wpa-service/wpa_actions-script
   trunk/ATTACHMENTS/wpa-service/wpa_service.conf
   trunk/wpa-service.txt
Log:
Update Hint: wpa-service

Deleted: trunk/ATTACHMENTS/wpa-service/ifplugd_wrapper-script
===================================================================
--- trunk/ATTACHMENTS/wpa-service/ifplugd_wrapper-script	2007-03-27 14:54:54 UTC (rev 1073)
+++ trunk/ATTACHMENTS/wpa-service/ifplugd_wrapper-script	2007-03-27 18:46:49 UTC (rev 1074)
@@ -1,19 +0,0 @@
-#!/bin/bash
-# ifplugd-wapper, to use ifplugd with the wpa_actions script
-# Eloi Primaux eloi AT bliscat DOT org
-
-. /etc/sysconfig/wpa_supplicant/wpa_service.conf
-
-if [ -z "$1" ] || [ -z "$2" ] ; then
-	echo "Wrong arguments" > /dev/stderr
-	exit 1
-fi
-
-case "$2" in
-up)
-	$WPA_ACTION_FILE $1 CONNECTED
-	;;
-up)
-	$WPA_ACTION_FILE $1 DISCONNECTED
-	;;
-esac

Deleted: trunk/ATTACHMENTS/wpa-service/wpa-service2
===================================================================
--- trunk/ATTACHMENTS/wpa-service/wpa-service2	2007-03-27 14:54:54 UTC (rev 1073)
+++ trunk/ATTACHMENTS/wpa-service/wpa-service2	2007-03-27 18:46:49 UTC (rev 1074)
@@ -1,258 +0,0 @@
-#!/bin/bash
-# Begin $network-devices/services/wpa-service
-# wpa-service 0.2
-# Based on dhcpcd script adapted for wpa networks with or without dhcp support
-# Rewritten by Eloi Primaux  - eloi AT bliscat DOT org
-# 2006-02-20 First script
-# 2006-03-31 wpa-service is functional
-# 2006-08-21 version by Maarten Lankhorst - m.b.lankhorst.(@).gmail.com
-# 2006-10-15 0.2 release by Eloi Primaux
-#	     merging Maarten work into configure_network function
-#	     can use both wpa_cli -a function and ifplugd.
-
-IFACE=$1
-BRING=$2
-
-. /etc/sysconfig/rc
-. $rc_functions
-. $IFCONFIG
-. /etc/sysconfig/wpa_supplicant/wpa_service.conf
-
-function get_real_pid {
-	if [ -e $1 ]; then
-	RET=`fuser $1` &> /dev/null
-	else
-	return 1
-	fi
-}
-
-function wpa_is_up {
-	get_real_pid $WPA_GLOBAL_FILE
-	if [ $? != 0 ]; then
-		return 2
-	fi
-}
-
-function wpa {
-	wpa_is_up
-	if [ $? != 0 ]; then
-		verbose '' "$WPA_DAEMON_NAME isn't running, please check why"
-		exit 1
-	fi
-}
-
-function is_iface_not_managed {
-	[ -n "`get_real_pid $WPA_ACCESS_DIR/$IFACE`" ] && return 2
-}
-
-function verbose {
-	[ "$VERBOSE" == "YES" ] && boot_mesg $1 "$2"
-}
-
-function test_fail {
-	[ "$1" != 0 ] && RET="FAIL:$1"
-	verbose '' " $RET"
-	if [[ $RET = FAIL* ]]; then
-		echo_failure ; return 2
-	else
-		return $1
-	fi
-}
-
-function add_iface {
-	verbose -n "$WPA_CLIENT_NAME -g$WPA_GLOBAL_FILE interface_add $IFACE '' $WPA_DRIVER $WPA_ACCESS_DIR :"
-	RET=`$WPA_CLIENT_NAME -g$WPA_GLOBAL_FILE interface_add $IFACE '' $WPA_DRIVER $WPA_ACCESS_DIR` &> /dev/null
-	test_fail $?
-}
-
-function ctrl_iface {
-	verbose -n "$WPA_CLIENT_NAME -i$IFACE $@ :"
-	RET=`$WPA_CLIENT_NAME -i$IFACE $@` &> /dev/null
-	test_fail $?
-}
-
-function remove_iface {
-	verbose -n "$WPA_CLIENT_NAME -g$WPA_GLOBAL_FILE interface_remove $IFACE :"
-	RET=`$WPA_CLIENT_NAME -g$WPA_GLOBAL_FILE interface_remove $IFACE` &> /dev/null
-	test_fail $?
-}
-
-function is_iface_status {
-	ctrl_iface status
-	echo $?
-	verbose '' "Expected status is $1, status is $RET"
-	echo $?
-	if [[ $RET = *$1 ]]; then
-		return 0
-	else
-		return 2
-	fi
-}
-
-function available_netwok {
-	ctrl_iface scan
-	while [ $? != 0 ]
-	do
-		sleep 2
-		is_iface_status SCANNING
-	done
-	ctrl_iface scan_results
-	RET0="`echo "$RET" | cut -f5- -d/`"
-	RET="`echo "$RET0" | cut -f5-`"
-	RET0="`echo "$RET" | grep -v "ssid"`"
-	RET="$RET0"
-	unset RET0
-}
-
-
-function configure_network {
-	#Read the wpa config file
-	LINENUMBER=0
-	CONFIGFILE="$WPA_CONFIG_DIR/$WPA_CONFIG_FILE"
-	LINES="$(wc -l $CONFIGFILE | sed 's/ .*//')"
-	while [ "$LINENUMBER" -lt "$LINES" ]
-	do
-		verbose '' "NETWORK=$NETWORK"
-		# Increase line number
-		let ++LINENUMBER
-		verbose '' "Parsing line ${LINENUMBER}"
-		# Fetch a line
-		preline="$(head -n $LINENUMBER $CONFIGFILE | tail -n 1)"
-		# Remove everything after a '#' (comment)
-		line="$(echo $preline | sed -e 's/#.*//')"
-
-		#echo "Parsing $LINENUMBER: '$preline' => '$line'"
-
-		if [ -z "`echo $line`" ]; then
-		# ignore now empty lines
-			continue
-		elif [ "$line" = "network={" ]; then
-		# creating a new network configuration,
-		# saving network number to NETWORK
-			ctrl_iface add_network
-			NETWORK="$RET"
-		elif [ "$line" = "}" ]; then
-		# now the network is configured, enabling it
-			ctrl_iface "enable_network $NETWORK"
-			unset NETWORK
-		elif [ -n "$( echo "$line" | grep -v "ctrl_interface")" ]; then
-			# all others lines should be network parameters...
-			# i need to replace the first '=' character by a pace
-			line="`echo "$line" | sed 's,=, ,'`"
-			verbose '' "ctrl_iface set_network $NETWORK $line"
-			RET="`$WPA_CLIENT_NAME -i $IFACE set_network $NETWORK $line`"
-			#ctrl_iface set_network $NETWORK $line
-		fi
-		if [[ $RET = FAIL* ]]; then
-			boot_mesg "Parse error on line ${LINENUMBER}"
-			remove_iface 
-			echo_failure
-			return 2
-		fi
-	done
-}
-
-function wait_for_events {
-# This is a new wpa_supplicant function: really usefull
-# but requires an additional action file to handle CONNECTED/DISCONNECTED events
-	ctrl_iface -a$WPA_ACTION_FILE &
-}
-
-
-function wait_for_up_loop {
-	COUNTER=0
-	while (( "$COUNTER" <= "$WPA_MAX_WAIT" ))
-	do let ++COUNTER
-		is_iface_status CONNECTED
-		if [ $? = 0 ]; then
-			return 0
-		fi
-		sleep 2s
-	done
-	return 1
-}
-
-function real_fail {
-	[ "$1" != 0 ] && RET="FAIL:$1"
-	verbose '' " $RET"
-	if [[ $RET = FAIL* ]]; then
-		exit $1
-	else
-		return $1
-	fi
-}
-
-function wait_for_up {
-	wait_for_up
-	real_fail $?
-	$WPA_ACTION_FILE $IFACE CONNECTED
-}
-
-
-function if_plugd {
-# Same as wait_for_event, using ifplugd
-# But requires an ifplugd action file
-	case "$1" in
-	start)
-	ifplugd -Msf -i $IFACE -r $IFPLUGD_WRAPPER
-	;;
-	stop)
-	ifplugd -k -i $IFACE
-	;;
-	esac
-}
-
-function iface_up {
-	wpa
-	is_iface_not_managed
-	if [ $? = 0 ]; then
-		verbose '' "Interface already managed, continuing"
-	else
-		add_iface
-		real_fail $?
-	fi
-	configure_network
-	real_fail $?
-	case "$IP_FUNCTION" in
-	wait_for_up)
-		wait_for_up
-		;;
-	wait_for_events)
-		wait_for_events
-		;;
-	if_plugd)
-		if_plugd start
-		;;
-	esac
-	}
-
-
-function iface_down {
-	wpa
-	ctrl_iface disconnect
-	test_fail $?
-	case "$IP_FUNCTION" in
-	wait_for_up)
-		$WPA_ACTION_FILE $IFACE DISCONNECTED
-		;;
-	wait_for_events)
-		verbose '' "wpa_cli -a will exit when interface will be removed"
-		;;
-	if_plugd)
-		if_plugd stop
-		;;
-	esac
-	test_fail $?
-	wpa_cli -g$WPA_GLOBAL_FILE interface_remove $IFACE
-	test_fail $?	
-}
-
-case "$2" in
-	up)
-	iface_up
-	;;
-	down)
-	iface_down
-	;;
-esac
-

Modified: trunk/ATTACHMENTS/wpa-service/wpa_actions-script
===================================================================
--- trunk/ATTACHMENTS/wpa-service/wpa_actions-script	2007-03-27 14:54:54 UTC (rev 1073)
+++ trunk/ATTACHMENTS/wpa-service/wpa_actions-script	2007-03-27 18:46:49 UTC (rev 1074)
@@ -5,8 +5,9 @@
 
 . /etc/sysconfig/wpa_supplicant/wpa_service.conf
 
-NETWORKDIR=/etc/sysconfig/wpa_supplicant
-SERVICESDIR=/etc/sysconfig/network-devices/services
+# already set...
+#NETWORKDIR=/etc/sysconfig/network.d
+#SERVICESDIR=/etc/sysconfig/network-devices/services
 
 . /etc/sysconfig/rc
 . $rc_functions

Modified: trunk/ATTACHMENTS/wpa-service/wpa_service.conf
===================================================================
--- trunk/ATTACHMENTS/wpa-service/wpa_service.conf	2007-03-27 14:54:54 UTC (rev 1073)
+++ trunk/ATTACHMENTS/wpa-service/wpa_service.conf	2007-03-27 18:46:49 UTC (rev 1074)
@@ -22,3 +22,8 @@
 	WPA_PID_FILE=/var/run/wpa_supplicant.pid
 	WPA_GLOBAL_FILE=/var/run/wpa_supplicant-global
 	WPA_ACCESS_DIR=/var/run/wpa_supplicant
+
+ # The service and network directories:
+ # SERVICESDIR is LFS/BLFS specific
+	NETWORKDIR=/etc/sysconfig/network.d
+	SERVICESDIR=/etc/sysconfig/network-devices/services

Modified: trunk/wpa-service.txt
===================================================================
--- trunk/wpa-service.txt	2007-03-27 14:54:54 UTC (rev 1073)
+++ trunk/wpa-service.txt	2007-03-27 18:46:49 UTC (rev 1074)
@@ -1,6 +1,6 @@
 AUTHOR: Eloi Primaux eloi AT bliscat dot org
 
-DATE: 2007-02-14
+DATE: 2007-03-27
 
 LICENSE: GNU Free Documentation License Version 2
 
@@ -46,7 +46,7 @@
 system.
 also when ready install it by executing :
 
-find ./ -name 'Makefile' -exec sed 's,/usr/local,/usr,g' {} \ &&
+find ./ -name 'Makefile' -exec sed 's,/usr/local,/usr,g' {} \; &&
 make &&
 make install
 
@@ -61,6 +61,7 @@
 1.1) Install Files and Directories (this is only a proposal)
 
   install -d /etc/sysconfig/wpa_supplicant
+  install -d /etc/sysconfig/network.d
   install -m644 wpa_service.conf /etc/sysconfig/wpa_supplicant
 
   install -m755 wpa-rcscript /etc/rc.d/init.d/wpa
@@ -101,10 +102,10 @@
 
  Those ssid descriptors are named with the name of the SSID they
 describe,
- and took place in the /etc/sysconfig/wpa_supplicant directory.
+ and took place in the /etc/sysconfig/network.d directory.
  
  the "AzErTy" SSID descriptor will
-be /etc/sysconfig/wpa_supplicant/AzeRtY
+be /etc/sysconfig/network.d/AzeRtY
 
 2.1) SSID descriptor syntax:
 An SSID descriptor is a regular network configuration file as used in
@@ -112,57 +113,58 @@
 it means that if SSID "IPV4" use ipv4-static, the the descriptor "IPV4"
 will be
 
-	cat > /etc/sysconfig/wpa_supplicant/IPV4 << "EOF"
-	ONBOOT=yes
-	SERVICE=ipv4-static
-	IP=192.168.1.1
-	GATEWAY=192.168.1.2
-	PREFIX=24
-	BROADCAST=192.168.1.255
-	EOF
+        cat > /etc/sysconfig/network.d/IPV4 << "EOF"
+        ONBOOT=yes
+        SERVICE=ipv4-static
+        IP=192.168.1.1
+        GATEWAY=192.168.1.2
+        PREFIX=24
+        BROADCAST=192.168.1.255
+        EOF
 
 and if the "DHCP" SSID use dhcp :
 
-	cat > /etc/sysconfig/wpa_supplicant/DHCP << "EOF"
-	ONBOOT="yes"
-	SERVICE="dhcpcd"
-	DHCP_START="-o"
-	DHCP_STOP="-k -o" # the '-o' prevent your interface being destroyed by
+        cat > /etc/sysconfig/network.d/DHCP << "EOF"
+        ONBOOT="yes"
+        SERVICE="dhcpcd"
+        DHCP_START="-o"
+        DHCP_STOP="-k -o" # the '-o' prevent your interface being destroyed by
 dhcpcd 
 
-	# Set PRINTIP="yes" to have the script print
-	# the DHCP assigned IP address
-	PRINTIP="no"
+        # Set PRINTIP="yes" to have the script print
+        # the DHCP assigned IP address
+        PRINTIP="no"
 
-	# Set PRINTALL="yes" to print the DHCP assigned values for
-	# IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
-	PRINTALL="no"
-	EOF
+        # Set PRINTALL="yes" to print the DHCP assigned values for
+        # IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
+        PRINTALL="no"
+        EOF
 
 for convenience, wpa_actions fall back
-to /etc/sysconfig/wpa_supplicant/AUTO
+to /etc/sysconfig/network.d/AUTO
 when no SSID descriptor is available,
 
 Then install a common/automatic network configuration:
 I use dhcpcd:   
 
-	cat > /etc/sysconfig/wpa_supplicant/AUTO << "EOF"
-	ONBOOT="yes"
-	SERVICE="dhcpcd"
-	DHCP_START="-o"
-	DHCP_STOP="-k -o" # the '-o' prevent your interface being destroyed by
+        cat > /etc/sysconfig/network.d/AUTO << "EOF"
+        ONBOOT="yes"
+        SERVICE="dhcpcd"
+        DHCP_START="-o"
+        DHCP_STOP="-k -o" # the '-o' prevent your interface being destroyed by
 dhcpcd
 
-	# Set PRINTIP="yes" to have the script print
-	# the DHCP assigned IP address
-	PRINTIP="no"
+        # Set PRINTIP="yes" to have the script print
+        # the DHCP assigned IP address
+        PRINTIP="no"
 
-	# Set PRINTALL="yes" to print the DHCP assigned values for
-	# IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
-	PRINTALL="no"
-	EOF
+        # Set PRINTALL="yes" to print the DHCP assigned values for
+        # IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
+        PRINTALL="no"
+        EOF
 
 
+(this files can be symlinked, to prevent duplication)
 
 3) The wpa_supplicant.conf (The network keys description) 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -344,3 +346,7 @@
 2006 10 15 wpa-service 0.2
 2006 02 14 some typo fix in scripts, removed ifplugd support, and
 wait_for_up function
+2007 03 27 Typo fix, ssid descriptors moved to /etc/sysconfig/network.d
+	this modifiy wpa_actions and wpa_service.conf
+	NETWORKDIR and SERVICESDIR moved to wpa_service.conf
+




More information about the hints mailing list