Can use wifi networks config file from the image builder
This commit is contained in:
parent
494af60013
commit
2b14e18748
|
@ -106,6 +106,7 @@ WIFI_SSID=
|
|||
WIFI_TYPE='wpa-psk'
|
||||
WIFI_PASSPHRASE=
|
||||
WIFI_HOTSPOT='no'
|
||||
WIFI_NETWORKS_FILE=${PROJECT_NAME}-wifi.cfg
|
||||
|
||||
mesh_router_setup_script() {
|
||||
# create a setup script for a mesh router
|
||||
|
@ -249,6 +250,10 @@ do
|
|||
WIFI_HOTSPOT='yes'
|
||||
fi
|
||||
;;
|
||||
--wifinetworks)
|
||||
shift
|
||||
WIFI_NETWORKS_FILE="$1"
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
;;
|
||||
|
@ -356,7 +361,8 @@ make $IMAGE_TYPE \
|
|||
WIFI_SSID="$WIFI_SSID" \
|
||||
WIFI_TYPE="$WIFI_TYPE" \
|
||||
WIFI_PASSPHRASE="$WIFI_PASSPHRASE" \
|
||||
WIFI_HOTSPOT="$WIFI_HOTSPOT"
|
||||
WIFI_HOTSPOT="$WIFI_HOTSPOT" \
|
||||
WIFI_NETWORKS_FILE="$WIFI_NETWORKS_FILE"
|
||||
|
||||
if [ ! "$?" = "0" ]; then
|
||||
echo $'Build failed'
|
||||
|
|
|
@ -84,6 +84,7 @@ WIFI_SSID=
|
|||
WIFI_TYPE='wpa-psk'
|
||||
WIFI_PASSPHRASE=
|
||||
WIFI_HOTSPOT='no'
|
||||
WIFI_NETWORKS_FILE=${PROJECT_NAME}-wifi.cfg
|
||||
|
||||
enable_eatmydata_override() {
|
||||
chroot $rootdir apt-get install --no-install-recommends -y eatmydata
|
||||
|
@ -430,6 +431,12 @@ configure_wifi() {
|
|||
if [[ $VARIANT == "mesh" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -f $WIFI_NETWORKS_FILE ]; then
|
||||
chroot "$rootdir" ${PROJECT_NAME}-wifi -i $WIFI_INTERFACE --networks $WIFI_NETWORKS_FILE
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ $WIFI_TYPE != 'none' ]]; then
|
||||
if [ ! $WIFI_PASSPHRASE ]; then
|
||||
return
|
||||
|
|
|
@ -61,6 +61,7 @@ export WIFI_SSID
|
|||
export WIFI_TYPE
|
||||
export WIFI_PASSPHRASE
|
||||
export WIFI_HOTSPOT
|
||||
export WIFI_NETWORKS_FILE
|
||||
|
||||
# Locate vmdebootstrap program fetched in Makefile
|
||||
basedir=`pwd`
|
||||
|
@ -181,6 +182,7 @@ sudo sed -i "s|WIFI_SSID=.*|WIFI_SSID=\"${WIFI_SSID}\"|g" $TEMP_CUSTOMISE
|
|||
sudo sed -i "s|WIFI_TYPE=.*|WIFI_TYPE=\"${WIFI_TYPE}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|WIFI_PASSPHRASE=.*|WIFI_PASSPHRASE=\"${WIFI_PASSPHRASE}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|WIFI_HOTSPOT=.*|WIFI_HOTSPOT=\"${WIFI_HOTSPOT}\"|g" $TEMP_CUSTOMISE
|
||||
sudo sed -i "s|WIFI_NETWORKS_FILE=.*|WIFI_NETWORKS_FILE=\"${WIFI_NETWORKS_FILE}\"|g" $TEMP_CUSTOMISE
|
||||
|
||||
echo $"starting $VMDEBOOTSTRAP"
|
||||
# Run vmdebootstrap script to create image
|
||||
|
|
|
@ -42,7 +42,7 @@ WIFI_SSID=
|
|||
WIFI_PASSPHRASE=
|
||||
WIFI_HOTSPOT='no'
|
||||
WIFI_CONFIG=/etc/wpa_supplicant/wpa_supplicant.conf
|
||||
WIFI_FILE=/root/${PROJECT_NAME}-wifi.cfg
|
||||
WIFI_NETWORKS_FILE=/root/${PROJECT_NAME}-wifi.cfg
|
||||
|
||||
function wifi_get_psk {
|
||||
ssid=$1
|
||||
|
@ -197,8 +197,8 @@ function wifi_none {
|
|||
}
|
||||
|
||||
function create_networks_from_file {
|
||||
if [ ! -f $WIFI_FILE ]; then
|
||||
return
|
||||
if [ ! -f $WIFI_NETWORKS_FILE ]; then
|
||||
exit 4
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/network/interfaces_original ]; then
|
||||
|
@ -254,7 +254,7 @@ function create_networks_from_file {
|
|||
ctr=$((ctr + 1))
|
||||
fi
|
||||
fi
|
||||
done < $WIFI_FILE
|
||||
done < $WIFI_NETWORKS_FILE
|
||||
|
||||
systemctl restart network-manager
|
||||
}
|
||||
|
@ -303,9 +303,9 @@ do
|
|||
shift
|
||||
WIFI_HOTSPOT=${1}
|
||||
;;
|
||||
--config)
|
||||
--networks)
|
||||
shift
|
||||
WIFI_FILE=${1}
|
||||
WIFI_NETWORKS_FILE=${1}
|
||||
;;
|
||||
*)
|
||||
# unknown option
|
||||
|
@ -314,7 +314,7 @@ do
|
|||
shift
|
||||
done
|
||||
|
||||
if [ -f $WIFI_FILE ]; then
|
||||
if [ -f $WIFI_NETWORKS_FILE ]; then
|
||||
create_networks_from_file
|
||||
exit 0
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue