summaryrefslogtreecommitdiffstats
path: root/builder/modules.d/wlan-boot/hooks/parse-wlan-kernel-command-line-parameter.sh
diff options
context:
space:
mode:
Diffstat (limited to 'builder/modules.d/wlan-boot/hooks/parse-wlan-kernel-command-line-parameter.sh')
-rwxr-xr-xbuilder/modules.d/wlan-boot/hooks/parse-wlan-kernel-command-line-parameter.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/builder/modules.d/wlan-boot/hooks/parse-wlan-kernel-command-line-parameter.sh b/builder/modules.d/wlan-boot/hooks/parse-wlan-kernel-command-line-parameter.sh
new file mode 100755
index 00000000..dbda284c
--- /dev/null
+++ b/builder/modules.d/wlan-boot/hooks/parse-wlan-kernel-command-line-parameter.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# this hook will be executed in cmdline as 10
+
+# generate the config file for wpa_supplicant from
+# the kernel commandline parameters
+
+WIFACE=wlan0
+CONFDIR=/etc/
+WPACONF="$CONFDIR"/wpa_supplicant.conf
+
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+SSID=$(getarg ssid=)
+PASSWORD=$(getarg pw=)
+USERNAME=$(getarg user=)
+
+if [ "$SSID" = "eduroam" ]; then
+ # write ssid and pw in wpa_supplicant.conf
+ cat > "$WPACONF" << EOF
+ # path to UNIX socket control interface
+ ctrl_interface=/var/run/wpa_supplicant
+ ap_scan=1
+ network={
+ ssid="$SSID"
+ proto=RSN
+ key_mgmt=WPA-EAP
+ eap=TTLS
+ identity="$USERNAME"
+ password="$PASSWORD"
+ ca_cert="$CONFDIR/ssl/certs/Deutsche_Telekom_Root_CA_2.pem"
+ phase2="auth=MSCHAPv2"
+ }
+EOF
+else
+ echo "ctrl_interface=/var/run/wpa_supplicant" > "$WPACONF"
+ wpa_passphrase "$SSID" "$PASSWORD" >> "$WPACONF"
+fi