Merge pull request #134 from fbelavenuto/synoinfo-loader-bug

Bug in loader synoinfo.conf patch
This commit is contained in:
Fabio Belavenuto 2022-08-25 14:39:41 -03:00 committed by GitHub
commit 4f2014ee14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 2 deletions

View File

@ -146,3 +146,25 @@ function arrayExistItem() {
done done
return ${EXISTS} return ${EXISTS}
} }
###############################################################################
# Replace/remove/add values in .conf K=V file
# 1 - name
# 2 - new_val
# 3 - path
function _set_conf_kv() {
# Delete
if [ -z "$2" ]; then
sed -i "$3" -e "s/^$1=.*$//"
return $?;
fi
# Replace
if grep -q "^$1=" "$3"; then
sed -i "$3" -e "s\"^$1=.*\"$1=\\\"$2\\\"\""
return $?
fi
# Add if doesn't exist
echo "$1=\"$2\"" >> $3
}

View File

@ -62,7 +62,7 @@ done < <(readModelArray "${MODEL}" "builds.${BUILD}.patch")
# Patch /etc/synoinfo.conf # Patch /etc/synoinfo.conf
echo -n "." echo -n "."
for KEY in ${!SYNOINFO[@]}; do for KEY in ${!SYNOINFO[@]}; do
sed -i "s|^${KEY}=.*|${KEY}=\"${SYNOINFO[${KEY}]}\"|" "${RAMDISK_PATH}/etc/synoinfo.conf" >"${LOG_FILE}" 2>&1 || dieLog _set_conf_kv "${KEY}" "${SYNOINFO[${KEY}]}" "${RAMDISK_PATH}/etc/synoinfo.conf" >"${LOG_FILE}" 2>&1 || dieLog
done done
# Patch /sbin/init.post # Patch /sbin/init.post