-
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·111 lines (92 loc) · 3.02 KB
/
install.sh
File metadata and controls
executable file
·111 lines (92 loc) · 3.02 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
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
UV_INSTALLATION_PATH=`mktemp -d`
BIN_DIR=""
HINTS_VERSION=""
while [[ $# -gt 0 ]]; do
case "$1" in
--version)
HINTS_VERSION="$2"
shift 2
;;
*)
shift
;;
esac
done
print_instruction_header() {
echo ""
echo "####################################"
echo "$1"
echo "####################################"
echo ""
}
install_dependencies_using_apt() {
sudo apt update && \
sudo apt install -y git libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-4.0 cmake libdbus-1-dev && \
[ $XDG_SESSION_TYPE = "wayland" ] && sudo apt install -y libgtk-layer-shell0 grim
}
install_dependencies_using_pacman() {
sudo pacman -Sy && \
sudo pacman -S --noconfirm --needed git python cairo pkgconf gobject-introspection gtk4 && \
[ $XDG_SESSION_TYPE = "wayland" ] && sudo pacman -S --noconfirm --needed gtk-layer-shell grim || sudo pacman -S --noconfirm --needed libwnck3
}
install_dependencies_using_dnf() {
sudo dnf install -y git gcc cmake gobject-introspection-devel cairo-gobject-devel pkg-config python3-devel dbus-devel gtk4 && \
[ $XDG_SESSION_TYPE = "wayland" ] && sudo dnf install -y gtk-layer-shell grim
}
available() { command -v "${1:?}" >/dev/null; }
install_system_dependencies() {
print_instruction_header "Installing system dependencies."
if available apt;
then
install_dependencies_using_apt
elif available pacman;
then
install_dependencies_using_pacman
elif available dnf;
then
install_dependencies_using_dnf
else
echo "Could not find supported package manager, you will need to install hints manually. If you want your distribution to be supported by the install script, open an issue: https://github.com/AlfredoSequeida/hints/issues"
exit 1
fi
}
install_uv() {
print_instruction_header "Installing UV."
curl -LsSf https://astral.sh/uv/install.sh | UV_NO_MODIFY_PATH=1 UV_INSTALL_DIR=$UV_INSTALLATION_PATH sh
sudo chown -R $USER `$UV_INSTALLATION_PATH/uv tool dir`
BIN_DIR=`$UV_INSTALLATION_PATH/uv tool dir --bin`
}
get_latest_tag() {
git ls-remote --tags --sort=-v:refname https://github.com/AlfredoSequeida/hints \
| grep -v '\^{}' \
| head -n 1 \
| sed 's/.*refs\/tags\///'
}
install_hints() {
print_instruction_header "Installing hints."
if [ -z "$HINTS_VERSION" ]; then
HINTS_VERSION=$(get_latest_tag)
[ -n "$HINTS_VERSION" ] && echo "Using latest tag: $HINTS_VERSION"
else
echo "Using version: $HINTS_VERSION"
fi
local ref=""
[ -n "$HINTS_VERSION" ] && ref="@$HINTS_VERSION"
HINTS_EXPECTED_BIN_DIR="$BIN_DIR" $UV_INSTALLATION_PATH/uv tool install --force "git+https://github.com/AlfredoSequeida/hints${ref}"
$UV_INSTALLATION_PATH/uv tool update-shell
}
cleanup () {
rm -r $UV_INSTALLATION_PATH
}
greet() {
echo ""
echo "🌟 All done, to setup hints run the setup script:"
echo "sudo env XDG_SESSION_TYPE=$XDG_SESSION_TYPE env XDG_CURRENT_DESKTOP=$XDG_CURRENT_DESKTOP $BIN_DIR/hints --setup"
echo ""
}
install_system_dependencies
install_uv
install_hints
cleanup
greet