On 02/03/2013 06:26 PM, Ivan Kovnatsky wrote:
On Feb 03, 2013 at 17:14, "Armin K." <[email protected]> wrote:
On 02/03/2013 02:52 PM, Ivan Kovnatsky wrote:
Hello you guys!
I have successfully found init.d/bluetooth script, which obvious not needed
to me. But wpa_supplicant is pretty nice one to have.
I did a little patch to put that into blfs startup scripts. Please see if it
meats a purpose.
Thanks.
-Ivan
Hello and thanks for taking time to write this.
I do not like it though, because it is tied to one interface and one
configuration file.
wpa_supplicant should be added as a service (like dhclient, dhcpcd,
wireless) and it should be allowed to be configured via
/etc/sysconfig/ifup.wlan0 or whatever it's correct.
I did service-like script, which looks pretty much nicer by arch of
implementing services through init.d/network.
-Ivan
I didn't notice first time that I responded to your mail. Forwarding to
blfs-dev.
I don't like your script since it is tied to one config file and it is
basically a rewrite of ipv4 script. I've taken some time to write a
script of my own. It's in attachment
Place it as /lib/services/wpa, generate wpa configuration file for, eg,
wlan0 by running wpa_passphrase YourSSID YourSSIDPSK >
/etc/sysconfig/wpa_supplicant-wlan0.conf and if using dhcp (isc dhcp -
dhclient service), create /etc/sysconfig/ifconfig.wlan0 with the following:
ONBOOT="yes"
IFACE="wlan0"
SERVICE="wpa"
WPA_SERVICE="dhclient"
DHCP_START=""
DHCP_STOP=""
# 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"
Same should work for static-ipv4, just change WPA_SERVICE to whatever is
apropriate and add the rest like it would be.
Any feedback is welcome.
#!/bin/bash
# Begin services/wpa
# Origianlly based upon lfs-bootscripts-1.12 $NETWORK_DEVICES/if{down,up}
# Written by Armin K. <krejzi at email dot com>
# Call with: IFCONFIG=<filename> /lib/services/wpa <IFACE> <up | down>
#$LastChangedBy: krejzi $
#$Date: 2012-08-14 22:00:47 +0000 (Tue, 14 Aug 2012) $
. /lib/lsb/init-functions
. $IFCONFIG
# Make compatible with older versions of init-functions
unset is_true
is_true()
{
[ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] ||
[ "$1" = "y" ] || [ "$1" = "t" ]
}
case "$2" in
up)
log_info_msg "\nStarting wpa_supplicant on the $1 interface..."
mkdir -p /run/wpa_supplicant
if [ ! -e /etc/sysconfig/wpa_supplicant-$1.conf ]; then
log_info_msg "\nwpa_supplicant configuration file not present"
log_failure_msg2
exit 1
fi
/sbin/wpa_supplicant -q -B -Dnl80211,wext -P/run/wpa_supplicant/$1.pid
-C/run/wpa_supplicant -c/etc/sysconfig/wpa_supplicant-$1.conf -i$1
if [ "$?" != "0" ]; then
log_failure_msg2
exit 1
fi
log_success_msg2
if [ -n "${WPA_SERVICE}" ]; then
if [ ! -e /lib/services/${WPA_SERVICE} -a ! -x
/lib/services/${WPA_SERVICE} ]; then
log_info_msg "\nCannot start ${WPA_SERVICE} on $1"
log_failure_msg2
exit 1
fi
IFCONFIG=${IFCONFIG} /lib/services/${WPA_SERVICE} $1 up
evaluate_retval
fi
;;
down)
if [ -n "${WPA_SERVICE}" ]; then
if [ ! -e /lib/services/${WPA_SERVICE} -a ! -x
/lib/services/${WPA_SERVICE} ]; then
log_info_msg "\nCannot stop ${WPA_SERVICE} on $1"
log_failure_msg2
exit 1
fi
IFCONFIG=${IFCONFIG} /lib/services/${WPA_SERVICE} $1 down
evaluate_retval
fi
log_info_msg "Stopping wpa_supplicant on the $1 interface..."
if [ -e /run/wpa_supplicant/$1.pid ]; then
kill -9 $(cat /run/wpa_supplicant/$1.pid)
rm -f /run/wpa_supplicant/$1.pid /run/wpa_supplicant/$1
evaluate_retval
else
log_warning_msg "\nwpa_supplicant already stopped on $1"
exit 0
fi
;;
*)
echo "Usage: $0 [interface] {up|down}"
exit 1
;;
esac
# End services/wpa
--
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page