-
Notifications
You must be signed in to change notification settings - Fork 1
/
cowfortune
executable file
·33 lines (25 loc) · 1.03 KB
/
cowfortune
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
#!/usr/bin/env bash
# Copyright (C) 2021 Rodrigo Silva (MestreLion) <[email protected]>
# License: GPLv3 or later. See <http://www.gnu.org/licenses/gpl.html>
# -----------------------------------------------------------------------------
DESCRIPTION='Cowfortune'
setuplib=${SETUP_LIB_PATH:-"$(dirname "$(readlink -f "$0")")"/../setuplib}
# shellcheck source=../setuplib
if [[ -r "$setuplib" ]]; then source "$setuplib"; else
echo "Setup library not found: $setuplib" >&2; exit 1;
fi
# -----------------------------------------------------------------------------
repo='[email protected]:MestreLion/cowfortune.git'
slug=cowfortune # must match executable name in repo
data_dir=${XDG_DATA_HOME:-"$HOME"/.local/share}/$slug
bin_dir=${XDG_BIN_HOME:-"$HOME"/.local/bin}
target=$(relpath "$data_dir" "$bin_dir")/$slug
exec=$bin_dir/$slug
packages=(
cowsay
fortunes{,-br,-off}
lolcat
)
install_package "${packages[@]}"
if ! [[ -d "$data_dir" ]]; then git clone "$repo" -- "$data_dir"; fi
if ! [[ -e "$exec" ]]; then ln -s "$target" -- "$exec"; fi