-
-
Notifications
You must be signed in to change notification settings - Fork 708
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·99 lines (84 loc) · 2.92 KB
/
install.sh
File metadata and controls
executable file
·99 lines (84 loc) · 2.92 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env sh
#
# This script will install the latest pre-built yabai release from GitHub.
# Depends on curl, shasum, tar, cp, cut.
#
# ARG1: Directory in which to store the yabai binary; must be an absolutepath.
# Fallback: /usr/local/bin
#
# ARG2: Directory in which to store the yabai man-page; must be an absolutepath.
# Fallback: /usr/local/man/man1
#
# Author: Åsmund Vikane
# Date: 2024-02-13
#
BIN_DIR="$1"
MAN_DIR="$2"
if [ -z "$BIN_DIR" ]; then
BIN_DIR="/usr/local/bin"
fi
if [ -z "$MAN_DIR" ]; then
MAN_DIR="/usr/local/share/man/man1"
fi
if [ "${BIN_DIR%%/*}" ]; then
echo "Error: Binary target directory '${BIN_DIR}' is not an absolutepath."
exit 1
fi
if [ ! -d "$BIN_DIR" ]; then
echo "Error: Binary target directory '${BIN_DIR}' does not exist."
exit 1
fi
if [ ! -w "$BIN_DIR" ]; then
echo "Error: User does not have write permission for binary target directory '${BIN_DIR}'."
exit 1
fi
if [ "${MAN_DIR%%/*}" ]; then
echo "Error: Man-page target directory '${MAN_DIR}' is not an absolutepath."
exit 1
fi
if [ ! -d "$MAN_DIR" ]; then
echo "Error: Man-page target directory '${MAN_DIR}' does not exist."
exit 1
fi
if [ ! -w "$MAN_DIR" ]; then
echo "Error: User does not have write permission for man-page target directory '${MAN_DIR}'."
exit 1
fi
AUTHOR="asmvik"
NAME="yabai"
VERSION="7.1.18"
EXPECTED_HASH="946d0915a7acb3db0b102899311fa086cfd4837cf3e24bae4d955bdebecc395b"
TMP_DIR="./${AUTHOR}-${NAME}-v${VERSION}-installer"
mkdir $TMP_DIR
pushd $TMP_DIR
curl --location --remote-name https://github.com/${AUTHOR}/${NAME}/releases/download/v${VERSION}/${NAME}-v${VERSION}.tar.gz
FILE_HASH=$(shasum -a 256 ./${NAME}-v${VERSION}.tar.gz | cut -d " " -f 1)
if [ "$FILE_HASH" = "$EXPECTED_HASH" ]; then
echo "Hash verified. Preparing files.."
tar -xzvf ${NAME}-v${VERSION}.tar.gz
rm ${BIN_DIR}/${NAME}
rm ${MAN_DIR}/${NAME}.1
cp -v ./archive/bin/${NAME} ${BIN_DIR}/${NAME}
cp -v ./archive/doc/${NAME}.1 ${MAN_DIR}/${NAME}.1
echo "Finished copying files.."
echo ""
echo "If you want yabai to be managed by launchd (start automatically upon login):"
echo " yabai --start-service"
echo ""
echo "When running as a launchd service logs will be found in:"
echo " /tmp/yabai_<user>.[out|err].log"
echo ""
echo "If you are using the scripting-addition; remember to update your sudoers file:"
echo " sudo visudo -f /private/etc/sudoers.d/yabai"
echo ""
echo "Sudoers file configuration row:"
echo " $(whoami) ALL=(root) NOPASSWD: sha256:$(shasum -a 256 ${BIN_DIR}/yabai | cut -d " " -f 1) ${BIN_DIR}/yabai --load-sa"
echo ""
echo "README: https://github.com/asmvik/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition"
else
echo "Hash does not match the expected value.. abort."
echo "Expected hash: $EXPECTED_HASH"
echo " Actual hash: $FILE_HASH"
fi
popd
rm -rf $TMP_DIR