-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
45 lines (37 loc) · 979 Bytes
/
setup.sh
File metadata and controls
45 lines (37 loc) · 979 Bytes
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
#!/bin/bash
source ./shellib/dot-local/lib/shellib/tasklib.sh
get_gnu_stow_latest_tar_gz() {
wget --secure-protocol=auto https://ftpmirror.gnu.org/gnu/stow/stow-latest.tar.gz || {
echo "Error: Failed to download GNU Stow" >&2
return 1
}
}
unpack_stow_tar_gz_archive() {
if [[ ! -f "stow-latest.tar.gz" ]]; then
echo "Error: stow-latest.tar.gz not found" >&2
return 1
fi
tar xvf stow-latest.tar.gz
}
install_stow_latest_from_source() {
local stow_dir=$(find . -name "stow-*" -type d | head -1)
if [[ -z "$stow_dir" ]]; then
echo "Error: Stow source directory not found" >&2
return 1
fi
cd "$stow_dir" || return 1
./configure --prefix="$HOME/.local" || return 1
make || return 1
make install || return 1
cd - > /dev/null
}
install_gnu_stow() {
if grep -q 'ID=fedora' /etc/os-release 2>/dev/null; then
sudo dnf install -y stow
else
get_gnu_stow_latest_tar_gz && \
unpack_stow_tar_gz_archive && \
install_stow_latest_from_source
fi
}
"@"