Files
EurKEY-macOS/scripts/build-dmg.sh
Felix Förtsch 92422e1bf1 fix modifier key order, add EU badge template icons, rename build scripts
- fix modifier key order to Apple canonical: Option+Shift (not Shift+Option)
  across parser, validator, PDF generator, website keyboard viewer, README
- add EU badge template icons for v1.2/v1.3/v1.4 matching Apple's built-in
  keyboard layout icon style (edge-to-edge rounded square, text knockout)
- add build-icons.sh to generate .icns from SVG source via rsvg-convert
- rename create-dmg.sh → build-dmg.sh, update CI workflows
- add website feature icons (install, pdf, versions)
- update website icon to star-on-key design

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 11:01:56 +01:00

69 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Create a .dmg installer for EurKEY-macOS keyboard layouts.
#
# The DMG contains the keyboard layout bundle, layout PDFs, and a symlink
# to /Library/Keyboard Layouts/ for drag-and-drop installation.
#
# Auto-builds the bundle and PDFs if missing.
#
# Usage: bash scripts/build-dmg.sh [--version YYYY.MM.DD]
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
BUILD_DIR="${PROJECT_DIR}/build"
BUNDLE_DIR="${BUILD_DIR}/EurKey-macOS.bundle"
# parse arguments
VERSION="${1:-$(date +%Y.%m.%d)}"
if [[ "${1:-}" == "--version" ]]; then
VERSION="${2:?missing version argument}"
fi
DMG_NAME="EurKEY-macOS-${VERSION}"
DMG_PATH="${BUILD_DIR}/${DMG_NAME}.dmg"
STAGING_DIR="${BUILD_DIR}/dmg-staging"
echo "Creating DMG: ${DMG_NAME}"
# --- build bundle (includes validation) ---
bash "${SCRIPT_DIR}/build-bundle.sh" --version "${VERSION}"
# --- auto-build PDFs ---
echo "Building PDFs..."
bash "${SCRIPT_DIR}/build-pdf.sh" --output "${BUILD_DIR}"
# --- prepare staging directory ---
rm -rf "${STAGING_DIR}"
mkdir -p "${STAGING_DIR}"
# copy the bundle
cp -R "${BUNDLE_DIR}" "${STAGING_DIR}/"
# copy layout PDFs
cp "${BUILD_DIR}"/eurkey-*-layout.pdf "${STAGING_DIR}/"
# create symlink to installation target
ln -s "/Library/Keyboard Layouts" "${STAGING_DIR}/Install Here (Keyboard Layouts)"
echo "Staged files:"
ls -la "${STAGING_DIR}/"
# --- create DMG ---
mkdir -p "${BUILD_DIR}"
rm -f "${DMG_PATH}"
hdiutil create \
-volname "${DMG_NAME}" \
-srcfolder "${STAGING_DIR}" \
-ov \
-format UDZO \
"${DMG_PATH}"
# --- clean up ---
rm -rf "${STAGING_DIR}"
echo
echo "DMG created: ${DMG_PATH}"
echo "Size: $(du -h "${DMG_PATH}" | cut -f1)"