Drag & Drop Installer
mac에서 흔히 사용하는 설치기 방식 (application.app을 Applications 바로가기로 넣어주는 방식으로 설치)
- dmg로 만들 directory를 생성
- directory에 .app 파일 넣기
- Applications 바로가기 만들기
ln -s /Applications /path/to/directory/ - .background/background.png에 배경화면 저장
- 아래 shell script 실행
SRC_PATH=./gye-mong
DEST_PATH=./GyeMong-temp.dmg
FINAL_PATH=./GyeMong.dmg
NAME="GyeMong"
APP_NAME="GyeMong.app"
hdiutil create -srcfolder $SRC_PATH \
-volname $NAME \
-format UDRW \
$DEST_PATH
MOUNT_DIR=$(hdiutil attach $DEST_PATH | grep Volumes | awk '{print $3}')
osascript <<EOF
tell application "Finder"
tell disk "$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 bounds of container window to {100, 100, 695, 500}
-- 아이콘 위치
set position of item "$APP_NAME" to {120, 200}
set position of item "Applications" to {440, 200}
-- 배경 이미지 설정
set background picture of icon view options of container window to file ".background:background.png"
end tell
delay 1
end tell
EOF
hdiutil detach "$MOUNT_DIR"
hdiutil convert "$DEST_PATH" \
-format UDZO \
-o "$FINAL_PATH"
rm -rf $DEST_PATH