Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·48 lines (42 loc) · 1.61 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·48 lines (42 loc) · 1.61 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
#!/bin/bash
# Builds FinderFix, quits the running copy, replaces /Applications/FinderFix.app, and starts it.
# Pass "debug" to build a debug configuration; the default is release.
set -euo pipefail
PROJECT_ROOT="$(cd "$(dirname "$0")" && pwd)"
CONFIGURATION="${1:-release}"
BUILT_APP="${PROJECT_ROOT}/OUT/FinderFix.app"
INSTALLED_APP="/Applications/FinderFix.app"
BUNDLE_IDENTIFIER="com.timezonellc.FinderFixOS"
EXECUTABLE_PATTERN="FinderFix.app/Contents/MacOS/FinderFix"
# Build first: build.sh reads the signing identity from the installed copy.
"${PROJECT_ROOT}/build.sh" "${CONFIGURATION}"
if pgrep -f "${EXECUTABLE_PATTERN}" >/dev/null; then
echo "Quitting FinderFix."
osascript -e "tell application id \"${BUNDLE_IDENTIFIER}\" to quit" >/dev/null 2>&1 || true
# Quitting detaches the Accessibility observers, which can take a few
# seconds against a busy Finder.
for _ in $(seq 1 50); do
pgrep -f "${EXECUTABLE_PATTERN}" >/dev/null || break
sleep 0.2
done
if pgrep -f "${EXECUTABLE_PATTERN}" >/dev/null; then
echo "FinderFix did not quit in time; terminating it."
pkill -f "${EXECUTABLE_PATTERN}" || true
sleep 1
fi
fi
echo "Replacing ${INSTALLED_APP}."
rm -rf "${INSTALLED_APP}"
ditto "${BUILT_APP}" "${INSTALLED_APP}"
codesign --verify --deep --strict "${INSTALLED_APP}"
open "${INSTALLED_APP}"
for _ in $(seq 1 25); do
pgrep -f "${EXECUTABLE_PATTERN}" >/dev/null && break
sleep 0.2
done
if pgrep -f "${EXECUTABLE_PATTERN}" >/dev/null; then
echo "FinderFix is running from ${INSTALLED_APP}."
else
echo "FinderFix did not start." >&2
exit 1
fi