Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #563 from fbelavenuto/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
fbelavenuto authored Feb 2, 2023
2 parents 920b999 + 3c84a9f commit 7acfb99
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 42 deletions.
8 changes: 4 additions & 4 deletions files/board/arpl/overlayfs/opt/arpl/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ CMDLINE['pid']="${PID}"
CMDLINE['sn']="${SN}"

# Read cmdline
while IFS="=" read KEY VALUE; do
while IFS=": " read KEY VALUE; do
[ -n "${KEY}" ] && CMDLINE["${KEY}"]="${VALUE}"
done < <(readModelMap "${MODEL}" "builds.${BUILD}.cmdline")
while IFS="=" read KEY VALUE; do
while IFS=": " read KEY VALUE; do
[ -n "${KEY}" ] && CMDLINE["${KEY}"]="${VALUE}"
done < <(readConfigMap "cmdline" "${USER_CONFIG_FILE}")

Expand Down Expand Up @@ -100,7 +100,7 @@ fi
# Prepare command line
CMDLINE_LINE=""
grep -q "force_junior" /proc/cmdline && CMDLINE_LINE+="force_junior "
[ ${EFI} -eq 1 ] && CMDLINE_LINE+="withefi "
[ ${EFI} -eq 1 ] && CMDLINE_LINE+="withefi " || CMDLINE_LINE+="noefi "
[ "${BUS}" = "ata" ] && CMDLINE_LINE+="synoboot_satadom=${DOM} dom_szmax=${SIZE} "
CMDLINE_DIRECT="${CMDLINE_LINE}"
CMDLINE_LINE+="console=ttyS0,115200n8 earlyprintk earlycon=uart8250,io,0x3f8,115200n8 root=/dev/md0 loglevel=15 log_buf_len=32M"
Expand All @@ -112,7 +112,7 @@ for KEY in ${!CMDLINE[@]}; do
[ -n "${VALUE}" ] && CMDLINE_DIRECT+="=${VALUE}"
done
# Escape special chars
CMDLINE_LINE=`echo ${CMDLINE_LINE} | sed "s/>/\\\\>/g"`
#CMDLINE_LINE=`echo ${CMDLINE_LINE} | sed "s/>/\\\\>/g"`
CMDLINE_DIRECT=`echo ${CMDLINE_DIRECT} | sed 's/>/\\\\>/g'`
echo -e "Cmdline:\n\033[1;36m${CMDLINE_LINE}\033[0m"

Expand Down
2 changes: 1 addition & 1 deletion files/board/arpl/overlayfs/opt/arpl/include/configFile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function readConfigKey() {
# 2 - Path of yaml config file
# Returns map of values
function readConfigMap() {
yq eval "."${1}" | explode(.) | to_entries | map([.key, .value] | join("=")) | .[]" "${2}"
yq eval "."${1}" | explode(.) | to_entries | map([.key, .value] | join(": ")) | .[]" "${2}"
}

###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion files/board/arpl/overlayfs/opt/arpl/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ if [ ! -f "${USER_CONFIG_FILE}" ]; then
writeConfigKey "model" "" "${USER_CONFIG_FILE}"
writeConfigKey "build" "" "${USER_CONFIG_FILE}"
writeConfigKey "sn" "" "${USER_CONFIG_FILE}"
writeConfigKey "maxdisks" "" "${USER_CONFIG_FILE}"
# writeConfigKey "maxdisks" "" "${USER_CONFIG_FILE}"
writeConfigKey "layout" "qwerty" "${USER_CONFIG_FILE}"
writeConfigKey "keymap" "" "${USER_CONFIG_FILE}"
writeConfigKey "zimage-hash" "" "${USER_CONFIG_FILE}"
Expand Down
35 changes: 11 additions & 24 deletions files/board/arpl/overlayfs/opt/arpl/menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ function buildMenu() {
writeConfigKey "build" "${BUILD}" "${USER_CONFIG_FILE}"
# Delete synoinfo and reload model/build synoinfo
writeConfigKey "synoinfo" "{}" "${USER_CONFIG_FILE}"
while IFS="=" read KEY VALUE; do
while IFS=": " read KEY VALUE; do
writeConfigKey "synoinfo.${KEY}" "${VALUE}" "${USER_CONFIG_FILE}"
done < <(readModelMap "${MODEL}" "builds.${BUILD}.synoinfo")
# Check addons
PLATFORM="`readModelKey "${MODEL}" "platform"`"
KVER="`readModelKey "${MODEL}" "builds.${BUILD}.kver"`"
while IFS="=" read ADDON PARAM; do
while IFS=": " read ADDON PARAM; do
[ -z "${ADDON}" ] && continue
if ! checkAddonExist "${ADDON}" "${PLATFORM}" "${KVER}"; then
deleteConfigKey "addons.${ADDON}" "${USER_CONFIG_FILE}"
Expand Down Expand Up @@ -215,7 +215,7 @@ function addonMenu() {
# Read addons from user config
unset ADDONS
declare -A ADDONS
while IFS="=" read KEY VALUE; do
while IFS=": " read KEY VALUE; do
[ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}"
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")
NEXT="a"
Expand Down Expand Up @@ -331,10 +331,10 @@ function addonMenu() {
function cmdlineMenu() {
unset CMDLINE
declare -A CMDLINE
while IFS="=" read KEY VALUE; do
while IFS=": " read KEY VALUE; do
[ -n "${KEY}" ] && CMDLINE["${KEY}"]="${VALUE}"
done < <(readConfigMap "cmdline" "${USER_CONFIG_FILE}")
echo "a \"Add/edit a cmdline item\"" > "${TMP_PATH}/menu"
echo "a \"Add/edit a cmdline item\"" > "${TMP_PATH}/menu"
echo "d \"Delete cmdline item(s)\"" >> "${TMP_PATH}/menu"
echo "c \"Define a custom MAC\"" >> "${TMP_PATH}/menu"
echo "s \"Show user cmdline\"" >> "${TMP_PATH}/menu"
Expand Down Expand Up @@ -414,7 +414,7 @@ function cmdlineMenu() {
;;
m)
ITEMS=""
while IFS="=" read KEY VALUE; do
while IFS=": " read KEY VALUE; do
ITEMS+="${KEY}: ${VALUE}\n"
done < <(readModelMap "${MODEL}" "builds.${BUILD}.cmdline")
dialog --backtitle "`backtitle`" --title "Model/build cmdline" \
Expand All @@ -427,20 +427,15 @@ function cmdlineMenu() {

###############################################################################
function synoinfoMenu() {
# Get dt flag from model
DT="`readModelKey "${MODEL}" "dt"`"
# Read synoinfo from user config
unset SYNOINFO
declare -A SYNOINFO
while IFS="=" read KEY VALUE; do
while IFS=": " read KEY VALUE; do
[ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}"
done < <(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")

echo "a \"Add/edit a synoinfo item\"" > "${TMP_PATH}/menu"
echo "d \"Delete synoinfo item(s)\"" >> "${TMP_PATH}/menu"
if [ "${DT}" != "true" ]; then
echo "x \"Set maxdisks manually\"" >> "${TMP_PATH}/menu"
fi
echo "s \"Show synoinfo entries\"" >> "${TMP_PATH}/menu"
echo "e \"Exit\"" >> "${TMP_PATH}/menu"

Expand Down Expand Up @@ -487,15 +482,6 @@ function synoinfoMenu() {
done
DIRTY=1
;;
x)
MAXDISKS=`readConfigKey "maxdisks" "${USER_CONFIG_FILE}"`
dialog --backtitle "`backtitle`" --title "Maxdisks" \
--inputbox "Type a value for maxdisks" 0 0 "${MAXDISKS}" \
2>${TMP_PATH}/resp
[ $? -ne 0 ] && continue
VALUE="`<"${TMP_PATH}/resp"`"
[ "${VALUE}" != "${MAXDISKS}" ] && writeConfigKey "maxdisks" "${VALUE}" "${USER_CONFIG_FILE}"
;;
s)
ITEMS=""
for KEY in ${!SYNOINFO[@]}; do
Expand Down Expand Up @@ -685,7 +671,7 @@ function make() {
KVER="`readModelKey "${MODEL}" "builds.${BUILD}.kver"`"

# Check if all addon exists
while IFS="=" read ADDON PARAM; do
while IFS=": " read ADDON PARAM; do
[ -z "${ADDON}" ] && continue
if ! checkAddonExist "${ADDON}" "${PLATFORM}" "${KVER}"; then
dialog --backtitle "`backtitle`" --title "Error" --aspect 18 \
Expand Down Expand Up @@ -840,7 +826,7 @@ function selectModules() {
ALLMODULES=`getAllModules "${PLATFORM}" "${KVER}"`
unset USERMODULES
declare -A USERMODULES
while IFS="=" read KEY VALUE; do
while IFS=": " read KEY VALUE; do
[ -n "${KEY}" ] && USERMODULES["${KEY}"]="${VALUE}"
done < <(readConfigMap "modules" "${USER_CONFIG_FILE}")
# menu loop
Expand Down Expand Up @@ -1030,7 +1016,7 @@ function updateMenu() {
[ -f "${F}" ] && rm -f "${F}"
[ -d "${F}" ] && rm -Rf "${F}"
done < <(readConfigArray "remove" "/tmp/update-list.yml")
while IFS="=" read KEY VALUE; do
while IFS=": " read KEY VALUE; do
if [ "${KEY: -1}" = "/" ]; then
rm -Rf "${VALUE}"
mkdir -p "${VALUE}"
Expand Down Expand Up @@ -1161,6 +1147,7 @@ function updateMenu() {
###############################################################################

if [ "x$1" = "xb" -a -n "${MODEL}" -a -n "${BUILD}" -a loaderIsConfigured ]; then
install-addons.sh
make
boot && exit 0 || sleep 5
fi
Expand Down
19 changes: 7 additions & 12 deletions files/board/arpl/overlayfs/opt/arpl/ramdisk-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ declare -A ADDONS
declare -A USERMODULES

# Read synoinfo and addons from config
while IFS="=" read KEY VALUE; do
while IFS=": " read KEY VALUE; do
[ -n "${KEY}" ] && SYNOINFO["${KEY}"]="${VALUE}"
done < <(readConfigMap "synoinfo" "${USER_CONFIG_FILE}")
while IFS="=" read KEY VALUE; do
while IFS=": " read KEY VALUE; do
[ -n "${KEY}" ] && ADDONS["${KEY}"]="${VALUE}"
done < <(readConfigMap "addons" "${USER_CONFIG_FILE}")

# Read modules from user config
while IFS="=" read KEY VALUE; do
while IFS=": " read KEY VALUE; do
[ -n "${KEY}" ] && USERMODULES["${KEY}"]="${VALUE}"
done < <(readConfigMap "modules" "${USER_CONFIG_FILE}")

Expand Down Expand Up @@ -125,7 +125,7 @@ cp "${PATCH_PATH}/iosched-trampoline.sh" "${RAMDISK_PATH}/usr/sbin/modprobe"
gzip -dc "${LKM_PATH}/rp-${PLATFORM}-${KVER}-${LKM}.ko.gz" > "${RAMDISK_PATH}/usr/lib/modules/rp.ko"

# Addons
MAXDISKS=`readConfigKey "maxdisks" "${USER_CONFIG_FILE}"`
#MAXDISKS=`readConfigKey "maxdisks" "${USER_CONFIG_FILE}"`
# Check if model needs Device-tree dynamic patch
DT="`readModelKey "${MODEL}" "dt"`"

Expand All @@ -140,16 +140,11 @@ echo "export LAYOUT=${LAYOUT}" >> "${RAMDISK_PATH}/addons/addon
echo "export KEYMAP=${KEYMAP}" >> "${RAMDISK_PATH}/addons/addons.sh"
chmod +x "${RAMDISK_PATH}/addons/addons.sh"

# Required addons: eudev, dtbpatch/maxdisks, wol
# Required addons: eudev, disks, wol
installAddon eudev
echo "/addons/eudev.sh \${1} " >> "${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
if [ "${DT}" = "true" ]; then
installAddon dtbpatch
echo "/addons/dtbpatch.sh \${1} ${UNIQUE}" >> "${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
else
installAddon maxdisks
echo "/addons/maxdisks.sh \${1} ${MAXDISKS}" >> "${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
fi
installAddon disks
echo "/addons/disks.sh \${1} ${DT} ${UNIQUE}" >> "${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
installAddon wol
echo "/addons/wol.sh \${1} " >> "${RAMDISK_PATH}/addons/addons.sh" 2>"${LOG_FILE}" || dieLog
# User addons
Expand Down

0 comments on commit 7acfb99

Please sign in to comment.