Skip to content

Commit 643f3cf

Browse files
committed
Check both directions
1 parent b703236 commit 643f3cf

File tree

1 file changed

+12
-3
lines changed
  • application/console/views/cron/scripts/upload/default

1 file changed

+12
-3
lines changed

application/console/views/cron/scripts/upload/default/build.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -574,18 +574,27 @@ prepare_appbuilder_project() {
574574
# If modern-pwa, then update the subdirectory configuration from the rclone publish path if not defined
575575
for target in $TARGETS; do
576576
if [ "$target" = "modern-pwa" ]; then
577-
APPDEF_TMP=$(mktemp)
578577
INPUT_PUBLISH_PROPERTIES=$PUBLISH_PROPERTIES
579578
if [ -f "${OUTPUT_PUBLISH_PROPERTIES}" ]; then
580579
INPUT_PUBLISH_PROPERTIES=$OUTPUT_PUBLISH_PROPERTIES
581580
fi
582581
if jq -e '.PUBLISH_CLOUD_REMOTE_PATH' "${INPUT_PUBLISH_PROPERTIES}" >/dev/null; then
583-
echo "PUBLISH_CLOUD_REMOTE_PATH exists. Check PWA SUBDIR."
584582
if ! xmlstarlet sel -t -v "/app-definition/pwa-manifest/pwa-sub-directory" build.appDef 2>/dev/null; then
585-
echo "set missing PWA SUBDIR to PUBLISH_CLOUD_REMOTE_PATH."
583+
echo "PUBLISH_CLOUD_REMOTE_PATH exists, but PWA Sub Directory is missing."
584+
echo "PUBLISH_CLOUD_REMOTE_PATH=${PUBLISH_CLOUD_REMOTE_PATH} so update PWA Sub Directory=/${PUBLISH_CLOUD_REMOTE_PATH}"
585+
APPDEF_TMP=$(mktemp)
586586
xmlstarlet ed -s "/app-definition/pwa-manifest" -t elem -n "pwa-sub-directory" -v "/${PUBLISH_CLOUD_REMOTE_PATH}" build.appDef > "${APPDEF_TMP}"
587587
cp "${APPDEF_TMP}" build.appDef
588588
fi
589+
else
590+
PWA_SUBDIR=$(xmllint --xpath "/app-definition/pwa-manifest/pwa-sub-directory/text()" build.appDef 2>/dev/null || echo "")
591+
if [ "$PWA_SUBDIR" != "" ]; then
592+
echo "PUBLISH_CLOUD_REMOTE_PATH does not exist, but PWA Sub Directory is set."
593+
echo "PWA Sub Directory=${PWA_SUBDIR} so update PUBLISH_CLOUD_REMOTE_PATH=${PWA_SUBDIR#/}"
594+
PUBLISH_TMP=$(mktemp)
595+
jq -cM ".PUBLISH_CLOUD_REMOTE_PATH += \"${PWA_SUBDIR#/}\"" "${INPUT_PUBLISH_PROPERTIES}" > "${PUBLISH_TMP}"
596+
cp "${PUBLISH_TMP}" "${OUTPUT_PUBLISH_PROPERTIES}"
597+
fi
589598
fi
590599
fi
591600
done

0 commit comments

Comments
 (0)