if [[ -z "$APP_PATH" ]]; then echo"Usage: $0 <app_path> [output_dmg]" >&2
exit 1 fi if [[ ! -d "$APP_PATH" ]]; then echo"Error: App not found: $APP_PATH" >&2
exit 1 fi
if [[ -z "$OUT_PATH" ]]; then
OUT_PATH="$BUILD_DIR/$DMG_NAME" fi
echo"Creating DMG: $OUT_PATH"
# Cleanup stuck volumes. for vol in "/Volumes/$DMG_VOLUME_NAME"* "/Volumes/$APP_NAME"*; do if [[ -d "$vol" ]]; then
hdiutil detach "$vol" -force 2>/dev/null || true
sleep 1 fi done
MOUNT_POINT="/Volumes/$DMG_VOLUME_NAME" if [[ -d "$MOUNT_POINT" ]]; then
hdiutil detach "$MOUNT_POINT" -force 2>/dev/null || true
sleep 2 fi
hdiutil attach "$DMG_RW_PATH" -mountpoint "$MOUNT_POINT" -nobrowse
if [[ "${SKIP_DMG_STYLE:-0}" != "1" ]]; then
mkdir -p "$MOUNT_POINT/.background" if [[ -f "$DMG_BACKGROUND_SMALL" ]]; then cp"$DMG_BACKGROUND_SMALL""$MOUNT_POINT/.background/background.png" elif [[ -f "$DMG_BACKGROUND_PATH" ]]; then cp"$DMG_BACKGROUND_PATH""$MOUNT_POINT/.background/background.png" else echo"WARN: DMG background missing: $DMG_BACKGROUND_SMALL / $DMG_BACKGROUND_PATH" >&2 fi
# Volume icon: reuse the app icon if available.
ICON_SRC="$ROOT_DIR/apps/macos/Sources/OpenClaw/Resources/OpenClaw.icns" if [[ -f "$ICON_SRC" ]]; then cp"$ICON_SRC""$MOUNT_POINT/.VolumeIcon.icns" if command -v SetFile >/dev/null 2>&1; then
SetFile -a C "$MOUNT_POINT" 2>/dev/null || true fi fi
osascript <<EOF
tell application "Finder"
tell disk "$DMG_VOLUME_NAME"
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {$(to_applescript_list4 "$DMG_WINDOW_BOUNDS")}
set viewOptions to the icon view options of container window
set arrangement of viewOptions to not arranged
set icon size of viewOptions to ${DMG_ICON_SIZE} if exists file ".background:background.png"then
set background picture of viewOptions to file ".background:background.png" endif
set text size of viewOptions to 12
set label position of viewOptions to bottom
set shows item info of viewOptions to false
set shows icon preview of viewOptions to true
set position of item "${APP_NAME}.app" of container window to {$(to_applescript_pair "$DMG_APP_POS")}
set position of item "Applications" of container window to {$(to_applescript_pair "$DMG_APPS_POS")}
update without registering applications
delay 2
close
open
delay 1 end tell end tell
EOF
sleep 2
osascript -e 'tell application "Finder" to close every window' || true fi
for i in {1..5}; do if hdiutil detach "$MOUNT_POINT" -quiet 2>/dev/null; then
break fi if [[ "$i" == "3" ]]; then
hdiutil detach "$MOUNT_POINT" -force 2>/dev/null || true fi
sleep 2 done
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.