-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·50 lines (43 loc) · 1.16 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·50 lines (43 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
set -e
cargo build --release
cargo install --path . --force
APP_NAME="docs"
BUILD_DIR="$(mktemp -d)"
APP="$BUILD_DIR/$APP_NAME.app"
MACOS="$APP/Contents/MacOS"
mkdir -p "$MACOS"
cp target/release/d "$MACOS/d-bin"
cat > "$MACOS/$APP_NAME" <<'STUB'
#!/bin/sh
exec "$(dirname "$0")/d-bin" --app "$@"
STUB
chmod +x "$MACOS/$APP_NAME" "$MACOS/d-bin"
cat > "$APP/Contents/Info.plist" <<'PLIST'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>docs</string>
<key>CFBundleIdentifier</key>
<string>com.docs.viewer</string>
<key>CFBundleName</key>
<string>docs</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<key>CFBundleVersion</key>
<string>0.1.0</string>
</dict>
</plist>
PLIST
DEST="$HOME/Applications"
mkdir -p "$DEST"
echo "Installing $APP_NAME.app to $DEST"
rm -rf "$DEST/$APP_NAME.app"
cp -R "$APP" "$DEST/$APP_NAME.app"
rm -rf "$BUILD_DIR"
echo "Done. Use 'd <file>' to view markdown."