-
Notifications
You must be signed in to change notification settings - Fork 138
/
install-from-source.sh
executable file
·53 lines (43 loc) · 1.24 KB
/
install-from-source.sh
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
51
52
53
#!/bin/bash
set -u
abort() {
printf "%s\n" "$@"
exit 1
}
if [ -z "${BASH_VERSION:-}" ]; then
abort "Bash is required to interpret this script."
fi
if [[ "$(uname)" != "Darwin" ]]; then
abort "WebViewScreenSaver is only supported on macOS."
fi
if ! command -v git >/dev/null; then
abort "Install process requires Git."
fi
if ! command -v xcodebuild >/dev/null; then
abort "Install process requires Xcode."
fi
GIT_REMOTE="https://github.com/liquidx/webviewscreensaver.git"
DIR_NAME="webviewscreensaver"
PRJ_NAME="WebViewScreenSaver"
BUILD_DIR="build"
printf 'Cloning %s...' "$GIT_REMOTE"
cd "$TMPDIR" || exit 1
rm -rf "$DIR_NAME"
git clone -q --depth 1 "$GIT_REMOTE" "$DIR_NAME"
printf ' Done\n'
printf 'Building %s...' "$PRJ_NAME"
cd "$DIR_NAME/$PRJ_NAME" || exit 1
mkdir "$BUILD_DIR"
xcodebuild -project WebViewScreenSaver.xcodeproj \
-scheme WebViewScreenSaver \
-configuration Release clean archive \
-archivePath "$BUILD_DIR/build.xcarchive" \
CODE_SIGN_IDENTITY="-" CODE_SIGNING_REQUIRED=YES > "$BUILD_DIR/build.log"
printf ' Done\n'
printf 'Installing %s...' "$PRJ_NAME"
cp -pr "$(find "$BUILD_DIR" -iname "*.saver")" "${HOME}/Library/Screen Savers"
printf ' Done\n'
printf 'Cleaning up...'
cd ../../
rm -rf "$DIR_NAME"
printf ' Done\n'