From c2fe5877161a786b165d8825fede75903cc9753a Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Sun, 3 Mar 2024 15:49:18 +0100 Subject: [PATCH] Unifying style of variables --- extensions/preset-firstrun.sh | 24 +++++++++---------- .../common/usr/lib/armbian/armbian-firstlogin | 22 ++++++++--------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/extensions/preset-firstrun.sh b/extensions/preset-firstrun.sh index d191c48a539e..0c2044144984 100644 --- a/extensions/preset-firstrun.sh +++ b/extensions/preset-firstrun.sh @@ -1,27 +1,27 @@ function post_family_tweaks__preset_configs() { display_alert "$BOARD" "preset configs for rootfs" "info" - # Set FR_net_change_defaults to 1 to apply any network related settings below - echo "FR_net_change_defaults=1" > "${SDCARD}"/root/.not_logged_in_yet + # Set PRESET_NET_CHANGE_DEFAULTS to 1 to apply any network related settings below + echo "PRESET_NET_CHANGE_DEFAULTS=1" > "${SDCARD}"/root/.not_logged_in_yet # Enable WiFi or Ethernet. # NB: If both are enabled, WiFi will take priority and Ethernet will be disabled. - echo "FR_net_ethernet_enabled=1" >> "${SDCARD}"/root/.not_logged_in_yet - echo "FR_net_wifi_enabled=1" >> "${SDCARD}"/root/.not_logged_in_yet + echo "PRESET_NET_ETHERNET_ENABLED=1" >> "${SDCARD}"/root/.not_logged_in_yet + echo "PRESET_NET_WIFI_ENABLED=1" >> "${SDCARD}"/root/.not_logged_in_yet #Enter your WiFi creds # SECURITY WARN: Your wifi keys will be stored in plaintext, no encryption. - echo "FR_net_wifi_ssid='MySSID'" >> "${SDCARD}"/root/.not_logged_in_yet - echo "FR_net_wifi_key='MyWiFiKEY'" >> "${SDCARD}"/root/.not_logged_in_yet + echo "PRESET_NET_WIFI_SSID='MySSID'" >> "${SDCARD}"/root/.not_logged_in_yet + echo "PRESET_NET_WIFI_KEY='MyWiFiKEY'" >> "${SDCARD}"/root/.not_logged_in_yet # Country code to enable power ratings and channels for your country. eg: GB US DE | https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 - echo "FR_net_wifi_countrycode='GB'" >> "${SDCARD}"/root/.not_logged_in_yet + echo "PRESET_NET_WIFI_COUNTRYCODE='GB'" >> "${SDCARD}"/root/.not_logged_in_yet #If you want to use a static ip, set it here - echo "FR_net_use_static=1" >> "${SDCARD}"/root/.not_logged_in_yet - echo "FR_net_static_ip='192.168.0.100'" >> "${SDCARD}"/root/.not_logged_in_yet - echo "FR_net_static_mask='255.255.255.0'" >> "${SDCARD}"/root/.not_logged_in_yet - echo "FR_net_static_gateway='192.168.0.1'" >> "${SDCARD}"/root/.not_logged_in_yet - echo "FR_net_static_dns='8.8.8.8 8.8.4.4'" >> "${SDCARD}"/root/.not_logged_in_yet + echo "PRESET_NET_USE_STATIC=1" >> "${SDCARD}"/root/.not_logged_in_yet + echo "PRESET_NET_STATIC_IP='192.168.0.100'" >> "${SDCARD}"/root/.not_logged_in_yet + echo "PRESET_NET_STATIC_MASK='255.255.255.0'" >> "${SDCARD}"/root/.not_logged_in_yet + echo "PRESET_NET_STATIC_GATEWAY='192.168.0.1'" >> "${SDCARD}"/root/.not_logged_in_yet + echo "PRESET_NET_STATIC_DNS='8.8.8.8 8.8.4.4'" >> "${SDCARD}"/root/.not_logged_in_yet # Preset user default shell, you can choose bash or zsh echo "PRESET_USER_SHELL=bash" >> "${SDCARD}"/root/.not_logged_in_yet diff --git a/packages/bsp/common/usr/lib/armbian/armbian-firstlogin b/packages/bsp/common/usr/lib/armbian/armbian-firstlogin index 7f6398e9c777..116b5563cdb7 100755 --- a/packages/bsp/common/usr/lib/armbian/armbian-firstlogin +++ b/packages/bsp/common/usr/lib/armbian/armbian-firstlogin @@ -67,12 +67,12 @@ do_firstrun_automated_network_configuration() source "$fp_config" # Obtain backward configuration compatibility - FR_net_static_dns=${FR_net_static_dns// /,} - FR_net_static_mask=$(mask2cidr $FR_net_static_mask) + PRESET_NET_STATIC_DNS=${PRESET_NET_STATIC_DNS// /,} + PRESET_NET_STATIC_MASK=$(mask2cidr $PRESET_NET_STATIC_MASK) #----------------------------------------------------------------------------- # Set Network - if [[ $FR_net_change_defaults == 1 ]]; then + if [[ $PRESET_NET_CHANGE_DEFAULTS == 1 ]]; then # Only run at tty1 if [ "$(who am i | awk '{print $2}')" != "tty1" ];then exit @@ -82,8 +82,8 @@ do_firstrun_automated_network_configuration() wlan_index="$(nmcli d | grep wifi | cut -d ' ' -f 1 | head -n 1)" # for static IP we only append settings - if [[ $FR_net_use_static == 1 ]]; then - local FIXED_IP_SETTINGS="ipv4.method manual ipv4.address ${FR_net_static_ip}/${FR_net_static_mask} ipv4.dns ${FR_net_static_dns} ipv4.gateway ${FR_net_static_gateway}" + if [[ $PRESET_NET_USE_STATIC == 1 ]]; then + local FIXED_IP_SETTINGS="ipv4.method manual ipv4.address ${PRESET_NET_STATIC_IP}/${PRESET_NET_STATIC_MASK} ipv4.dns ${PRESET_NET_STATIC_DNS} ipv4.gateway ${PRESET_NET_STATIC_GATEWAY}" fi if [[ -n $eth_index || -n $wlan_index ]]; then @@ -91,25 +91,25 @@ do_firstrun_automated_network_configuration() LC_ALL=C nmcli -t -f UUID,DEVICE connection show | awk '{print $1}' | cut -f1 -d":" | xargs nmcli connection delete # - Wifi enable - if [[ $FR_net_wifi_enabled == 1 ]]; then + if [[ $PRESET_NET_WIFI_ENABLED == 1 ]]; then #Set wifi country code - iw reg set "$FR_net_wifi_countrycode" + iw reg set "$PRESET_NET_WIFI_COUNTRYCODE" - nmcli con add con-name "Armbian wireless" type wifi ifname ${wlan_index} ssid "$FR_net_wifi_ssid" -- wifi-sec.key-mgmt wpa-psk wifi-sec.psk "$FR_net_wifi_key" ${FIXED_IP_SETTINGS} + nmcli con add con-name "Armbian wireless" type wifi ifname ${wlan_index} ssid "$PRESET_NET_WIFI_SSID" -- wifi-sec.key-mgmt wpa-psk wifi-sec.psk "$PRESET_NET_WIFI_KEY" ${FIXED_IP_SETTINGS} nmcli con up "Armbian wireless" #Enable Wlan, disable Eth - FR_net_ethernet_enabled=0 + PRESET_NET_ETHERNET_ENABLED=0 # - Ethernet enable - elif [[ $FR_net_ethernet_enabled == 1 ]]; then + elif [[ $PRESET_NET_ETHERNET_ENABLED == 1 ]]; then nmcli con add con-name "Armbian ethernet" type ethernet ifname ${eth_index} -- ${FIXED_IP_SETTINGS} nmcli con up "Armbian ethernet" #Enable Eth, disable Wlan - FR_net_wifi_enabled=0 + PRESET_NET_WIFI_ENABLED=0 fi fi