forked from taffybar/taffybar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quick-start.sh
executable file
·44 lines (37 loc) · 1.15 KB
/
quick-start.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
#!/usr/bin/env bash
REPO_URI="${1-https://github.com/taffybar/taffybar}"
CONFIG_DIR="${XDG_CONFIG_HOME-$HOME/.config}"
TAFFY_CONFIG_DIR="$CONFIG_DIR/taffybar"
ensure_in_taffybar_repo () {
mkdir -p "$TAFFY_CONFIG_DIR"
cd "$TAFFY_CONFIG_DIR"
if [ ! -e taffybar ]; then
git clone "$REPO_URI"
fi
cd taffybar || exit
}
# Check whether the given path is listed in the PATH environment variable
on_path () {
echo ":$PATH:" | grep -q :"$1":
}
ensure_stack_present () {
# Check whether ~/.local/bin is on the PATH, and put it there if it isn't
if ! on_path "$HOME/.local/bin" ; then
export PATH="$HOME/.local/bin:$PATH"
fi
# Get stack
curl -sSL https://get.haskellstack.org/ | sh
}
setup_taffy_config () {
cp -n example/my-taffybar.cabal "$TAFFY_CONFIG_DIR/my-taffybar.cabal"
cp -n example/taffybar.hs "$TAFFY_CONFIG_DIR/taffybar.hs"
cp -n example/stack.yaml "$TAFFY_CONFIG_DIR/stack.yaml"
cd "$TAFFY_CONFIG_DIR" || exit
stack install --install-ghc
}
ensure_in_taffybar_repo
TAFFYBAR_SHA="$(git rev-parse HEAD)"
TAFFYBAR_REPO="$(git remote -v | head -n 1 | awk '{print $2}')"
ensure_stack_present
stack install gtk2hs-buildtools --install-ghc
setup_taffy_config