arc/addons/modules: more checks and fixes

Signed-off-by: AuxXxilium <info@auxxxilium.tech>
This commit is contained in:
AuxXxilium 2024-01-19 17:54:30 +01:00
parent 314765ddae
commit 3d09e6bf8f
3 changed files with 34 additions and 0 deletions

View File

@ -243,5 +243,9 @@ for T in $(w | grep -v "TTY" | awk -F' ' '{print $2}')
do do
echo -e "\n\033[1;37mThis interface will not be operational. Wait a few minutes.\033[0m\nUse \033[1;34mhttp://${IPCON}:5000\033[0m or try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n" >"/dev/${T}" 2>/dev/null || true echo -e "\n\033[1;37mThis interface will not be operational. Wait a few minutes.\033[0m\nUse \033[1;34mhttp://${IPCON}:5000\033[0m or try \033[1;34mhttp://find.synology.com/ \033[0mto find DSM and proceed.\n" >"/dev/${T}" 2>/dev/null || true
done done
# Clear logs for dbgutils addons
rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true
[ "${KERNELLOAD}" = "kexec" ] && kexec -f -e || poweroff [ "${KERNELLOAD}" = "kexec" ] && kexec -f -e || poweroff
exit 0 exit 0

View File

@ -3,6 +3,10 @@
# 1 - Platform # 1 - Platform
# 2 - Kernel Version # 2 - Kernel Version
function availableAddons() { function availableAddons() {
if [[ -z "${1}" || -z "${2}" ]]; then
echo ""
return 1
fi
while read -r D; do while read -r D; do
[ ! -f "${D}/manifest.yml" ] && continue [ ! -f "${D}/manifest.yml" ] && continue
ADDON=$(basename ${D}) ADDON=$(basename ${D})
@ -24,6 +28,9 @@ function availableAddons() {
# 3 - Kernel Version # 3 - Kernel Version
# Return ERROR if not exists # Return ERROR if not exists
function checkAddonExist() { function checkAddonExist() {
if [[ -z "${1}" || -z "${2}" || -z "${3}" ]]; then
return 1 # ERROR
fi
# First check generic files # First check generic files
if [ -f "${ADDONS_PATH}/${1}/all.tgz" ]; then if [ -f "${ADDONS_PATH}/${1}/all.tgz" ]; then
return 0 # OK return 0 # OK
@ -39,6 +46,9 @@ function checkAddonExist() {
# Install Addon into ramdisk image # Install Addon into ramdisk image
# 1 - Addon id # 1 - Addon id
function installAddon() { function installAddon() {
if [ -z "${1}" ]; then
return 1
fi
ADDON="${1}" ADDON="${1}"
mkdir -p "${TMP_PATH}/${ADDON}" mkdir -p "${TMP_PATH}/${ADDON}"
HAS_FILES=0 HAS_FILES=0
@ -66,6 +76,10 @@ function installAddon() {
# 1 - Addon file path # 1 - Addon file path
# Return name of addon on sucess or empty on error # Return name of addon on sucess or empty on error
function untarAddon() { function untarAddon() {
if [ -z "${1}" ]; then
echo ""
return 1
fi
rm -rf "${TMP_PATH}/${ADDON:?}" rm -rf "${TMP_PATH}/${ADDON:?}"
mkdir -p "${TMP_PATH}/${ADDON}" mkdir -p "${TMP_PATH}/${ADDON}"
tar -xaf "${1}" -C "${TMP_PATH}/${ADDON}" || return tar -xaf "${1}" -C "${TMP_PATH}/${ADDON}" || return

View File

@ -6,6 +6,10 @@
function getAllModules() { function getAllModules() {
PLATFORM=${1} PLATFORM=${1}
KVER=${2} KVER=${2}
if [[ -z "${PLATFORM}" || -z "${KVER}" ]]; then
echo ""
return 1
fi
# Unzip modules for temporary folder # Unzip modules for temporary folder
rm -rf "${TMP_PATH}/modules" rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules"
@ -30,6 +34,10 @@ function addToModules() {
PLATFORM=${1} PLATFORM=${1}
KVER=${2} KVER=${2}
KOFILE=${3} KOFILE=${3}
if [[ -z "${PLATFORM}" || -z "${KVER}" || -z "${KOFILE}" ]]; then
echo ""
return 1
fi
# Unzip modules for temporary folder # Unzip modules for temporary folder
rm -rf "${TMP_PATH}/modules" rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules"
@ -47,6 +55,10 @@ function delToModules() {
PLATFORM=${1} PLATFORM=${1}
KVER=${2} KVER=${2}
KONAME=${3} KONAME=${3}
if [[ -z "${PLATFORM}" || -z "${KVER}" || -z "${KOFILE}" ]]; then
echo ""
return 1
fi
# Unzip modules for temporary folder # Unzip modules for temporary folder
rm -rf "${TMP_PATH}/modules" rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules"
@ -75,6 +87,10 @@ function getdepends() {
PLATFORM=${1} PLATFORM=${1}
KVER=${2} KVER=${2}
KONAME=${3} KONAME=${3}
if [[ -z "${PLATFORM}" || -z "${KVER}" || -z "${KOFILE}" ]]; then
echo ""
return 1
fi
# Unzip modules for temporary folder # Unzip modules for temporary folder
rm -rf "${TMP_PATH}/modules" rm -rf "${TMP_PATH}/modules"
mkdir -p "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules"