diff --git a/files/initrd/opt/arc/boot.sh b/files/initrd/opt/arc/boot.sh index fdc81c6..1e57f4e 100755 --- a/files/initrd/opt/arc/boot.sh +++ b/files/initrd/opt/arc/boot.sh @@ -243,5 +243,9 @@ for T in $(w | grep -v "TTY" | awk -F' ' '{print $2}') 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 done + +# Clear logs for dbgutils addons +rm -rf "${PART1_PATH}/logs" >/dev/null 2>&1 || true + [ "${KERNELLOAD}" = "kexec" ] && kexec -f -e || poweroff exit 0 \ No newline at end of file diff --git a/files/initrd/opt/arc/include/addons.sh b/files/initrd/opt/arc/include/addons.sh index 23ee542..5123130 100755 --- a/files/initrd/opt/arc/include/addons.sh +++ b/files/initrd/opt/arc/include/addons.sh @@ -3,6 +3,10 @@ # 1 - Platform # 2 - Kernel Version function availableAddons() { + if [[ -z "${1}" || -z "${2}" ]]; then + echo "" + return 1 + fi while read -r D; do [ ! -f "${D}/manifest.yml" ] && continue ADDON=$(basename ${D}) @@ -24,6 +28,9 @@ function availableAddons() { # 3 - Kernel Version # Return ERROR if not exists function checkAddonExist() { + if [[ -z "${1}" || -z "${2}" || -z "${3}" ]]; then + return 1 # ERROR + fi # First check generic files if [ -f "${ADDONS_PATH}/${1}/all.tgz" ]; then return 0 # OK @@ -39,6 +46,9 @@ function checkAddonExist() { # Install Addon into ramdisk image # 1 - Addon id function installAddon() { + if [ -z "${1}" ]; then + return 1 + fi ADDON="${1}" mkdir -p "${TMP_PATH}/${ADDON}" HAS_FILES=0 @@ -66,6 +76,10 @@ function installAddon() { # 1 - Addon file path # Return name of addon on sucess or empty on error function untarAddon() { + if [ -z "${1}" ]; then + echo "" + return 1 + fi rm -rf "${TMP_PATH}/${ADDON:?}" mkdir -p "${TMP_PATH}/${ADDON}" tar -xaf "${1}" -C "${TMP_PATH}/${ADDON}" || return diff --git a/files/initrd/opt/arc/include/modules.sh b/files/initrd/opt/arc/include/modules.sh index 07456a2..1033732 100755 --- a/files/initrd/opt/arc/include/modules.sh +++ b/files/initrd/opt/arc/include/modules.sh @@ -6,6 +6,10 @@ function getAllModules() { PLATFORM=${1} KVER=${2} + if [[ -z "${PLATFORM}" || -z "${KVER}" ]]; then + echo "" + return 1 + fi # Unzip modules for temporary folder rm -rf "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules" @@ -30,6 +34,10 @@ function addToModules() { PLATFORM=${1} KVER=${2} KOFILE=${3} + if [[ -z "${PLATFORM}" || -z "${KVER}" || -z "${KOFILE}" ]]; then + echo "" + return 1 + fi # Unzip modules for temporary folder rm -rf "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules" @@ -47,6 +55,10 @@ function delToModules() { PLATFORM=${1} KVER=${2} KONAME=${3} + if [[ -z "${PLATFORM}" || -z "${KVER}" || -z "${KOFILE}" ]]; then + echo "" + return 1 + fi # Unzip modules for temporary folder rm -rf "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules" @@ -75,6 +87,10 @@ function getdepends() { PLATFORM=${1} KVER=${2} KONAME=${3} + if [[ -z "${PLATFORM}" || -z "${KVER}" || -z "${KOFILE}" ]]; then + echo "" + return 1 + fi # Unzip modules for temporary folder rm -rf "${TMP_PATH}/modules" mkdir -p "${TMP_PATH}/modules"