#!/bin/sh
# synopkgland: the SDK steps run in synopkgland_sdk; the App's dsm-scripts/preinst runs from scripts/app/preinst.
synopkgland_sdk() (
if [ "${SYNOPKG_PKG_STATUS:-}" != UPGRADE ]; then
  case "${delegate_home:-false}" in
    true|1|yes|on) selected_scope=home ;;
    *)
      selected_share="${delegate_share:-}"
      case "$selected_share" in
        ''|.|*..*|*/*|*'\'*|*:*|*'"'*|*'%'*|*[[:cntrl:]]*|[hH][oO][mM][eE]|[hH][oO][mM][eE][sS]|[[:space:]]*|*[[:space:]]) echo "Select a shared folder or choose home." >&2; exit 1 ;;
      esac
      selected_scope="shared:$selected_share" ;;
  esac
fi
exit 0
)
synopkgland_app="$(dirname "$0")/app/preinst"
synopkgland_sdk "$@" || exit $?
exec "$synopkgland_app" "$@"
