diff --git a/README.md b/README.md index 79c2178..61f36e0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## v1.2.5 -### Updated on 2026-Feb-18 +### Updated on 2026-Mar-21 ## About diff --git a/YazDHCP.sh b/YazDHCP.sh index cd2da0d..e5c94eb 100644 --- a/YazDHCP.sh +++ b/YazDHCP.sh @@ -13,7 +13,7 @@ ## Forked from https://github.com/jackyaz/YazDHCP ## ## ## ########################################################## -# Last Modified: 2026-Feb-18 +# Last Modified: 2026-Mar-21 #--------------------------------------------------------- ############################################# @@ -30,7 +30,7 @@ ### Start of script variables ### readonly SCRIPT_NAME="YazDHCP" readonly SCRIPT_VERSION="v1.2.5" -readonly SCRIPT_VERSTAG="26021800" +readonly SCRIPT_VERSTAG="26032100" SCRIPT_BRANCH="develop" SCRIPT_REPO="https://raw.githubusercontent.com/AMTM-OSR/$SCRIPT_NAME/$SCRIPT_BRANCH" readonly SCRIPT_DIR="/jffs/addons/$SCRIPT_NAME.d" @@ -112,7 +112,6 @@ readonly NVRAM_3004_DHCPvar_RegExp="dhcp_staticlist=[<]?${MACaddr_RegEx}>.+" readonly NVRAM_3006_DHCPvar_RegExp0="dhcpres[1-9][0-9]?_rl=" readonly NVRAM_3006_DHCPvar_RegExp1="${NVRAM_3006_DHCPvar_RegExp0}<${MACaddr_RegEx}>.+" -readonly addnDHCP_HostNames=true readonly guestNetInfoJSfileName="GuestNetworkSubnetInfo.js" readonly guestNetInfoJSfilePath="${SCRIPT_DIR}/$guestNetInfoJSfileName" readonly dhcpGuestNetAllowVarKey="allowGuestNet_IPaddr_Reservations" @@ -3617,7 +3616,7 @@ Update_Hostnames_GuestNet() gnExistingMD5="$(md5sum "$hostNamesFileGNET" | awk '{print $1}')" mv -f "$hostNamesFileGNET" "$hostNamesFileBKUP" fi - printf "" > "$hostNamesFileGNET" + printf '' > "$hostNamesFileGNET" gnIFaceVarStr="GNIFACE_${gnIFaceName}=" gnStartIPaddr4="$(echo "$gnInfoStr" | grep -E "^${gnIFaceVarStr}.*" | cut -d'=' -f2 | cut -d',' -f1)" @@ -3808,7 +3807,7 @@ Update_StaticList_GuestNet() gnExistingMD5="$(md5sum "$staticListFileGNET" | awk '{print $1}')" mv -f "$staticListFileGNET" "$staticListFileBKUP" fi - printf "" > "$staticListFileGNET" + printf '' > "$staticListFileGNET" gnIFaceVarStr="GNIFACE_${gnIFaceName}=" gnStartIPaddr4="$(echo "$gnInfoStr" | grep -E "^${gnIFaceVarStr}.*" | cut -d'=' -f2 | cut -d',' -f1)" @@ -3999,7 +3998,7 @@ Update_OptionsList_GuestNet() gnExistingMD5="$(md5sum "$optionsListFileGNET" | awk '{print $1}')" mv -f "$optionsListFileGNET" "$optionsListFileBKUP" fi - printf "" > "$optionsListFileGNET" + printf '' > "$optionsListFileGNET" gnIFaceVarStr="GNIFACE_${gnIFaceName}=" gnStartIPaddr4="$(echo "$gnInfoStr" | grep -E "^${gnIFaceVarStr}.*" | cut -d'=' -f2 | cut -d',' -f1)" @@ -4104,17 +4103,14 @@ CleanUp_OptionsList_GuestNet() Update_Hostnames() { local lanExistingMD5="" lanUpdatedMD5="" msgTagStr="" - local hostNamesFilePATH="$SCRIPT_DIR/.hostnames" local hostNamesFileBKUP="${hostNamesFilePATH}.BKUP" - ##OFF## ! "$addnDHCP_HostNames" && return 0 ##OFF## - if [ -s "$hostNamesFilePATH" ] then lanExistingMD5="$(md5sum "$hostNamesFilePATH" | awk '{print $1}')" mv -f "$hostNamesFilePATH" "$hostNamesFileBKUP" fi - printf "" > "$hostNamesFilePATH" + printf '' > "$hostNamesFilePATH" Update_Hostnames_MainLAN Update_Hostnames_GuestNet @@ -4150,7 +4146,6 @@ Update_Hostnames() Update_StaticList() { local lanExistingMD5="" lanUpdatedMD5="" msgTagStr="" - local staticListFilePATH="$SCRIPT_DIR/.staticlist" local staticListFileBKUP="${staticListFilePATH}.BKUP" if [ -s "$staticListFilePATH" ] @@ -4158,7 +4153,7 @@ Update_StaticList() lanExistingMD5="$(md5sum "$staticListFilePATH" | awk '{print $1}')" mv -f "$staticListFilePATH" "$staticListFileBKUP" fi - printf "" > "$staticListFilePATH" + printf '' > "$staticListFilePATH" Update_StaticList_MainLAN Update_StaticList_GuestNet @@ -4194,7 +4189,6 @@ Update_StaticList() Update_OptionsList() { local lanExistingMD5="" lanUpdatedMD5="" msgTagStr="" - local optionsListFilePATH="$SCRIPT_DIR/.optionslist" local optionsListFileBKUP="${optionsListFilePATH}.BKUP" if [ -s "$optionsListFilePATH" ] @@ -4202,7 +4196,7 @@ Update_OptionsList() lanExistingMD5="$(md5sum "$optionsListFilePATH" | awk '{print $1}')" mv -f "$optionsListFilePATH" "$optionsListFileBKUP" fi - printf "" > "$optionsListFilePATH" + printf '' > "$optionsListFilePATH" Update_OptionsList_MainLAN Update_OptionsList_GuestNet @@ -4238,6 +4232,10 @@ Update_OptionsList() Process_DHCP_Clients() { local retCode=1 delBkupCopy=true verboseMode + local hostNamesFilePATH="$SCRIPT_DIR/.hostnames" + local staticListFilePATH="$SCRIPT_DIR/.staticlist" + local optionsListFilePATH="$SCRIPT_DIR/.optionslist" + if [ $# -gt 0 ] && { [ "$1" = "true" ] || [ "$1" = "false" ] ; } then RESTART_DNSMASQ="$1" else RESTART_DNSMASQ=false @@ -4246,6 +4244,9 @@ Process_DHCP_Clients() if [ ! -s "$SCRIPT_CONF" ] || \ ! grep -qv "MAC,IP,HOSTNAME,DNS" "$SCRIPT_CONF" then + printf '' > "$hostNamesFilePATH" + printf '' > "$staticListFilePATH" + printf '' > "$optionsListFilePATH" Print_Output true "No DHCP client IP address assignments were found." "$WARN" return 1 fi