@@ -43,38 +43,47 @@ chown -R amp:amp /home/amp
4343
4444# Make AMP binary executable
4545AMP_BIN=" /AMP/AMP_Linux_${ARCH} "
46- [ -f " ${AMP_BIN} " ] && chmod +x " ${AMP_BIN} "
46+ chmod +x " ${AMP_BIN} " || { echo " [Error] AMP binary not found or cannot be made executable " ; exit 101 ; }
4747
48- # Install extra dependencies if needed
48+ # Install extra dependencies if needed (non-fatal)
4949REQUIRED_DEPS=()
5050if [[ -n " ${AMP_CONTAINER_DEPS:- } " ]]; then
5151 # shellcheck disable=SC2207
52- REQUIRED_DEPS=($( jq -r ' .[]? | select(type=="string" and length>0)' <<< " ${AMP_CONTAINER_DEPS}" || echo) )
52+ REQUIRED_DEPS=($( jq -r ' .[]? | select(type=="string" and length>0)' <<< " ${AMP_CONTAINER_DEPS}" 2> /dev/null || echo) )
5353fi
5454
5555if (( ${# REQUIRED_DEPS[@]} )) ; then
5656 echo " [Info] Installing extra dependencies..."
57- apt-get update
58- apt-get install -o APT::Keep-Downloaded-Packages=" false" -y --no-install-recommends --allow-downgrades " ${REQUIRED_DEPS[@]} "
59- apt-get clean
60- rm -rf /var/lib/apt/lists/*
57+ (
58+ set +e
59+ apt-get update || echo " [Warn] apt-get update failed; continuing"
60+ apt-get install -y --no-install-recommends --allow-downgrades \
61+ -o APT::Keep-Downloaded-Packages=" false" " ${REQUIRED_DEPS[@]} " \
62+ || echo " [Warn] apt-get install failed (bad package name?); continuing"
63+ apt-get clean > /dev/null 2>&1 || true
64+ rm -rf /var/lib/apt/lists/* || true
65+ )
6166fi
6267
63- # Set custom mountpoint permissions if needed
64- if [ -n " ${AMP_MOUNTPOINTS} " ]; then
65- echo " [Info] Updating custom mountpoint permissions..."
68+ # Set custom mountpoint permissions if needed (non-fatal)
69+ if [[ -n " ${AMP_MOUNTPOINTS:- } " ] ]; then
70+ echo " [Info] Updating custom mountpoint permissions..."
6671 IFS=' :' read -r -a dirs <<< " ${AMP_MOUNTPOINTS}"
6772 for dir in " ${dirs[@]} " ; do
68- [ -n " ${dir} " ] || continue
69- chown -R amp:amp " ${dir} "
73+ [[ -n " ${dir} " ]] || continue
74+ if [[ -e " ${dir} " ]]; then
75+ chown -R amp:" ${AMPGROUPID} " " ${dir} " 2> /dev/null || echo " [Warn] chown failed for ${dir} ; continuing"
76+ else
77+ echo " [Warn] Mountpoint not found: ${dir} ; skipping"
78+ fi
7079 done
7180fi
7281
73- # Run custom start script if it exists
74- if [ -f " /AMP/customstart.sh" ]; then
82+ # Run custom start script if it exists (non-fatal)
83+ if [[ -f " /AMP/customstart.sh" ] ]; then
7584 echo " [Info] Running customstart.sh..."
76- chmod +x /AMP/customstart.sh
77- /AMP/customstart.sh
85+ chmod +x /AMP/customstart.sh 2> /dev/null || true
86+ ( set +e ; /AMP/customstart.sh; rc= $? ; (( rc == 0 )) || echo " [Warn] customstart.sh exited with $rc ; continuing " )
7887fi
7988
8089# Handoff
0 commit comments