Files

28 lines
1.1 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Build the signed app and package a read-only drag-to-install disk image.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$ROOT"
./scripts/build.sh release
APP="$ROOT/dist/TinySTT.app"
VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Contents/Info.plist")"
ARCH="$(lipo -archs "$APP/Contents/MacOS/TinySTT" | tr ' ' '-')"
DMG="$ROOT/dist/TinySTT-${VERSION}-${ARCH}.dmg"
STAGING="$(mktemp -d "${TMPDIR:-/tmp}/tinystt-dmg.XXXXXX")"
trap 'rm -rf "$STAGING"' EXIT
ditto "$APP" "$STAGING/TinySTT.app"
ln -s /Applications "$STAGING/Applications"
cat > "$STAGING/安装说明.txt" <<'EOF'
TinySTT — 本地语音输入
将 TinySTT.app 拖到 Applications 文件夹,再从「应用程序」启动。
更新前请先从菜单栏退出旧版本。
允许麦克风与辅助功能权限,等待本地语音引擎就绪。
按一次右 Option 开始说话,再按一次结束,文字会直接输入当前输入框。
Esc 取消。默认直接输入不会占用剪贴板。
EOF
hdiutil create -volname "TinySTT" -srcfolder "$STAGING" -format UDZO -ov "$DMG"
hdiutil verify "$DMG"
echo "==> DMG:$DMG"