Fix entrypoint patch - insert before exec node-red
This commit is contained in:
@@ -71,7 +71,8 @@ if [[ -f "$ENTRYPOINT" ]]; then
|
||||
cp "$ENTRYPOINT" "$ENTRYPOINT.bak.$(date +%s)"
|
||||
|
||||
if ! grep -q "$PACKAGE_NAME" "$ENTRYPOINT"; then
|
||||
cat >> "$ENTRYPOINT" << 'PATCH_EOF'
|
||||
PATCH_TMP=$(mktemp)
|
||||
cat > "$PATCH_TMP" << 'PATCH_EOF'
|
||||
|
||||
# --- node-red-contrib-nextcloud-woocommerce ---
|
||||
SRC_WC="/opt/nextcloud-nodes/node-red-contrib-nextcloud-woocommerce"
|
||||
@@ -83,10 +84,16 @@ if [ -d "$SRC_WC" ]; then
|
||||
cp -a "$SRC_WC" /data/node_modules/
|
||||
chown -R node-red:node-red "$DST_WC" 2>/dev/null || true
|
||||
chmod -R a+rX "$DST_WC" 2>/dev/null || true
|
||||
echo "[entrypoint] WooCommerce nodes installed."
|
||||
fi
|
||||
|
||||
PATCH_EOF
|
||||
echo " entrypoint.sh patched."
|
||||
|
||||
awk -v patchfile="$PATCH_TMP" '
|
||||
/^exec/ && !done { while ((getline line < patchfile) > 0) print line; close(patchfile); done=1 }
|
||||
{ print }
|
||||
' "$ENTRYPOINT" > "$ENTRYPOINT.tmp" && mv "$ENTRYPOINT.tmp" "$ENTRYPOINT"
|
||||
rm -f "$PATCH_TMP"
|
||||
echo " entrypoint.sh patched (inserted before exec)."
|
||||
else
|
||||
echo " entrypoint.sh already contains $PACKAGE_NAME."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user