Merge ~alextu/pc-enablement/+git/prepare-checkbox-sanity:interactive-wifi-ssid-setting into ~oem-solutions-engineers/pc-enablement/+git/prepare-checkbox-sanity:master

Proposed by Alex Tu
Status: Merged
Merged at revision: 2c07f1af3667bd08a7d456b41f4fd381297efe9e
Proposed branch: ~alextu/pc-enablement/+git/prepare-checkbox-sanity:interactive-wifi-ssid-setting
Merge into: ~oem-solutions-engineers/pc-enablement/+git/prepare-checkbox-sanity:master
Diff against target: 75 lines (+35/-1)
1 file modified
usr/sbin/checkbox-run-plan (+35/-1)
Reviewer Review Type Date Requested Status
Yuan-Chen Cheng (community) Needs Information
Shih-Yuan Lee Pending
OEM Solutions Group: Engineers Pending
Review via email: mp+386159@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

can you make sure that it runs well?

review: Needs Information
Revision history for this message
Yuan-Chen Cheng (ycheng-twn) wrote :

if modify the config file is simple enough, and the temporary config won't be saved...

Shall we consider just ask user to modify the config file.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/usr/sbin/checkbox-run-plan b/usr/sbin/checkbox-run-plan
2index 48f07c1..bc2859b 100755
3--- a/usr/sbin/checkbox-run-plan
4+++ b/usr/sbin/checkbox-run-plan
5@@ -3,6 +3,7 @@
6 EXCLUDE=""
7 DEF_ENV="/etc/default/prepare-checkbox-sanity.conf"
8 source $DEF_ENV
9+WORKING_DIR="$(mktemp -d)"
10
11 usage() {
12 cat << EOF
13@@ -82,6 +83,11 @@ done
14
15 [ -z "$PLAN" ] && error
16
17+declare -A WPA_SSID_ARRAY
18+declare -A WPA_PWD_ARRAY
19+declare -A OPEN_SSID_ARRAY
20+supported_wpa_wifi="BG N AC"
21+supported_open_wifi="BG N AC"
22 interactive(){
23 echo "do you want to set the path of checkbox.conf? (refer to https://checkbox.readthedocs.io/en/latest/launcher-tutorial.html)"
24 read -p "(Y/N):" set_checkbox_conf
25@@ -90,6 +96,32 @@ interactive(){
26 else
27 echo "Keep the checkbox.conf as default from $DEF_ENV"
28 fi
29+
30+ for wifi_proto in $supported_wpa_wifi; do
31+ echo "do you want to set your WPA_""$wifi_proto""_SSID for wifi testing with password?(e.g. ubuntu-cert-{wifi protocal}-wpa-tpelab)"
32+ read -p "(Y/N):" set_ssid
33+ if [[ $set_ssid == [Yy] ]] ; then
34+ read -p "WPA_""$wifi_proto""_SSID(wifi SSID):" WPA_SSID_ARRAY[$wifi_proto]
35+ read -p "WPA_""$wifi_proto""_PSK(password):" WPA_PWD_ARRAY[$wifi_proto]
36+ fi
37+
38+ echo "do you want to set your OPEN_""$wifi_proto""_SSID for wifi testing without password?(e.g. ubuntu-cert-{wifi protocal}-open-tpelab)"
39+ read -p "(Y/N):" set_ssid
40+ if [[ $set_ssid == [Yy] ]] ; then
41+ read -p "OPEN_""$wifi_proto""_SSID(wifi SSID):" OPEN_SSID_ARRAY[$wifi_proto]
42+ fi
43+ done
44+ if [ "${#WPA_SSID_ARRAY[@]}" != 0 ] ||[ "${#OPEN_SSID_ARRAY[@]}" != 0 ] ;then
45+ echo "[environment]" > "$WORKING_DIR/wifi_env_vars"
46+ for a_key in ${!WPA_SSID_ARRAY[@]}; do
47+ echo "WPA_""$a_key""_SSID = ""${WPA_SSID_ARRAY[$a_key]}" >> "$WORKING_DIR/wifi_env_vars"
48+ echo "WPA_""$a_key""_PSK = ""${WPA_PWD_ARRAY[$a_key]}" >> "$WORKING_DIR/wifi_env_vars"
49+ done
50+
51+ for a_key in ${!OPEN_SSID_ARRAY[@]}; do
52+ echo "OPEN_""$a_key""_SSID = ""${OPEN_SSID_ARRAY[$a_key]}" >> "$WORKING_DIR/wifi_env_vars"
53+ done
54+ fi
55 }
56 [ "$SILENCE" == "TRUE" ] || interactive
57 if [ -n "$CHECKBOX_CONF" ] && [ -z "${CHECKBOX_CONF##http*}" ]; then
58@@ -97,7 +129,7 @@ if [ -n "$CHECKBOX_CONF" ] && [ -z "${CHECKBOX_CONF##http*}" ]; then
59 if wget --waitretry=5 -T 5 -t 3 $CHECKBOX_CONF -O $HOME/.cache/prepare-checkbox/checkbox.conf; then
60 CHECKBOX_CONF="$HOME/.cache/prepare-checkbox/checkbox.conf"
61 else
62- CHECKBOX_CONF="usr/lib/prepare-checkbox-sanity/fall-back-checkbox.conf"
63+ CHECKBOX_CONF="/usr/lib/prepare-checkbox-sanity/fall-back-checkbox.conf"
64 fi
65 fi
66
67@@ -128,6 +160,8 @@ exclude = $EXCLUDE
68
69 [ui]
70 type = silent
71+
72+$(cat "$WORKING_DIR/wifi_env_vars")
73 EOF
74 echo "========= the checkbox launcher will be run ========="
75 cat "$HOME/generated_launcher"

Subscribers

People subscribed via source and target branches