ramdisk: fix

This commit is contained in:
AuxXxilium 2024-07-30 20:32:17 +02:00
parent f27324c152
commit bb89a21b17
2 changed files with 53 additions and 1 deletions

View File

@ -93,7 +93,9 @@ function modulesMenu() {
4 "Deselect all Modules" \
5 "Choose Modules" \
6 "Add external module" \
7 "Blacklist Modules to prevent loading in DSM" \
7 "Edit Modules copied to DSM" \
8 "Force-copy loaded Modules to DSM" \
9 "Blacklist Modules to prevent loading in DSM" \
2>"${TMP_PATH}/resp"
[ $? -ne 0 ] && break
case "$(cat ${TMP_PATH}/resp)" in
@ -207,6 +209,49 @@ function modulesMenu() {
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
;;
7)
if [ -f "${USER_UP_PATH}/modulelist" ]; then
cp -f "${USER_UP_PATH}/modulelist" "${TMP_PATH}/modulelist.tmp"
else
cp -f "${ARC_PATH}/include/modulelist" "${TMP_PATH}/modulelist.tmp"
fi
while true; do
dialog --backtitle "$(backtitle)" --title "Edit Modules copied to DSM" \
--editbox "${TMP_PATH}/modulelist.tmp" 0 0 2>"${TMP_PATH}/modulelist.user"
[ $? -ne 0 ] && return
[ ! -d "${USER_UP_PATH}" ] && mkdir -p "${USER_UP_PATH}"
mv -f "${TMP_PATH}/modulelist.user" "${USER_UP_PATH}/modulelist"
dos2unix "${USER_UP_PATH}/modulelist"
break
done
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
;;
8)
if [ -f "${USER_UP_PATH}/modulelist" ]; then
cp -f "${USER_UP_PATH}/modulelist" "${TMP_PATH}/modulelist.tmp"
else
cp -f "${ARC_PATH}/include/modulelist" "${TMP_PATH}/modulelist.tmp"
fi
echo -e "\n\n# Arc Modules" >>"${TMP_PATH}/modulelist.tmp"
KOLIST=""
for I in $(lsmod | awk -F' ' '{print $1}' | grep -v 'Module'); do
KOLIST+="$(getdepends "${PLATFORM}" "${KVERP}" "${I}") ${I} "
done
KOLIST=($(echo ${KOLIST} | tr ' ' '\n' | sort -u))
while read -r ID DESC; do
for MOD in ${KOLIST[@]}; do
[ "${MOD}" == "${ID}" ] && echo "F ${ID}.ko" >>"${TMP_PATH}/modulelist.tmp"
done
done < <(getAllModules "${PLATFORM}" "${KVERP}")
[ ! -d "${USER_UP_PATH}" ] && mkdir -p "${USER_UP_PATH}"
mv -f "${TMP_PATH}/modulelist.tmp" "${USER_UP_PATH}/modulelist"
dos2unix "${USER_UP_PATH}/modulelist"
dialog --backtitle "$(backtitle)" --title "Loaded Modules Copy" \
--msgbox "All loaded Modules will be copied to DSM!" 5 50
writeConfigKey "arc.builddone" "false" "${USER_CONFIG_FILE}"
BUILDDONE="$(readConfigKey "arc.builddone" "${USER_CONFIG_FILE}")"
;;
9)
MSG=""
MSG+="The blacklist is used to prevent the kernel from loading specific modules.\n"
MSG+="The blacklist is a list of module names separated by ','.\n"

View File

@ -192,6 +192,13 @@ echo "Modify files" >"${LOG_FILE}"
# Build modules dependencies
# ${ARC_PATH}/depmod -a -b ${RAMDISK_PATH} 2>/dev/null
# Copying modulelist
if [ -f "${USER_UP_PATH}/modulelist" ]; then
cp -f "${USER_UP_PATH}/modulelist" "${RAMDISK_PATH}/addons/modulelist"
else
cp -f "${ARC_PATH}/include/modulelist" "${RAMDISK_PATH}/addons/modulelist"
fi
# backup current loader configs
BACKUP_PATH="${RAMDISK_PATH}/usr/arc/backup"
rm -rf "${BACKUP_PATH}"