Skip to content

Commit 5c624f1

Browse files
Add check for cachyos
1 parent b9f5a0c commit 5c624f1

File tree

1 file changed

+96
-96
lines changed

1 file changed

+96
-96
lines changed

install-system

Lines changed: 96 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ set -euo pipefail
44
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
55

66
if ! source /etc/os-release 2>/dev/null; then
7-
echo "Error: Unable to detect OS (missing /etc/os-release)."
8-
exit 1
7+
echo "Error: Unable to detect OS (missing /etc/os-release)."
8+
exit 1
99
fi
1010

1111
usage() {
12-
cat <<'EOF'
12+
cat <<'EOF'
1313
install-system - install Charitarth Chugh's dev environment
1414
1515
Default installs non-GUI applications.
@@ -25,87 +25,87 @@ EOF
2525

2626
GUI=false
2727
while getopts ":hg" opt; do
28-
case "$opt" in
29-
h)
30-
usage
31-
exit 0
32-
;;
33-
g) GUI=true ;;
34-
?)
35-
echo "Error: Invalid option -$OPTARG"
36-
echo
37-
usage
38-
exit 1
39-
;;
40-
esac
28+
case "$opt" in
29+
h)
30+
usage
31+
exit 0
32+
;;
33+
g) GUI=true ;;
34+
?)
35+
echo "Error: Invalid option -$OPTARG"
36+
echo
37+
usage
38+
exit 1
39+
;;
40+
esac
4141
done
4242

4343
run_cli() {
44-
# Determine package manager family using ID, with fallback to ID_LIKE
45-
local family
46-
family="$(detect_family)"
47-
case "$family" in
48-
apt) "$BASEDIR/scripts/apt-cli.sh" ;;
49-
yay) "$BASEDIR/scripts/yay-cli.sh" ;;
50-
dnf) "$BASEDIR/scripts/dnf-cli.sh" ;;
51-
*)
52-
echo "Error: Unsupported distribution: ID='${ID:-unknown}', ID_LIKE='${ID_LIKE:-}'"
53-
exit 1
54-
;;
55-
esac
44+
# Determine package manager family using ID, with fallback to ID_LIKE
45+
local family
46+
family="$(detect_family)"
47+
case "$family" in
48+
apt) "$BASEDIR/scripts/apt-cli.sh" ;;
49+
yay) "$BASEDIR/scripts/yay-cli.sh" ;;
50+
dnf) "$BASEDIR/scripts/dnf-cli.sh" ;;
51+
*)
52+
echo "Error: Unsupported distribution: ID='${ID:-unknown}', ID_LIKE='${ID_LIKE:-}'"
53+
exit 1
54+
;;
55+
esac
5656
}
5757

5858
run_gui() {
59-
# Determine package manager family using ID, with fallback to ID_LIKE
60-
local family
61-
family="$(detect_family)"
62-
case "$family" in
63-
apt) "$BASEDIR/scripts/apt-gui.sh" ;;
64-
yay) "$BASEDIR/scripts/yay-gui.sh" ;;
65-
dnf) "$BASEDIR/scripts/dnf-gui.sh" ;;
66-
*)
67-
echo "Error: Unsupported distribution: ID='${ID:-unknown}', ID_LIKE='${ID_LIKE:-}'"
68-
exit 1
69-
;;
70-
esac
59+
# Determine package manager family using ID, with fallback to ID_LIKE
60+
local family
61+
family="$(detect_family)"
62+
case "$family" in
63+
apt) "$BASEDIR/scripts/apt-gui.sh" ;;
64+
yay) "$BASEDIR/scripts/yay-gui.sh" ;;
65+
dnf) "$BASEDIR/scripts/dnf-gui.sh" ;;
66+
*)
67+
echo "Error: Unsupported distribution: ID='${ID:-unknown}', ID_LIKE='${ID_LIKE:-}'"
68+
exit 1
69+
;;
70+
esac
7171
}
7272

7373
detect_family() {
74-
# Maps distro IDs to a package manager "family": apt | yay | dnf
75-
case "${ID:-}" in
76-
ubuntu | debian)
77-
echo apt
78-
return 0
79-
;;
80-
arch | artix)
81-
echo yay
82-
return 0
83-
;;
84-
fedora | rhel | centos)
85-
echo dnf
86-
return 0
87-
;;
88-
esac
89-
90-
# Fallback: try ID_LIKE tokens
91-
for like in ${ID_LIKE:-}; do
92-
case "$like" in
93-
ubuntu | debian)
94-
echo apt
95-
return 0
96-
;;
97-
arch | manjaro | artix)
98-
echo yay
99-
return 0
100-
;;
101-
fedora | rhel | centos)
102-
echo dnf
103-
return 0
104-
;;
105-
esac
106-
done
107-
108-
echo unknown
74+
# Maps distro IDs to a package manager "family": apt | yay | dnf
75+
case "${ID:-}" in
76+
ubuntu | debian)
77+
echo apt
78+
return 0
79+
;;
80+
arch | artix | cachyos)
81+
echo yay
82+
return 0
83+
;;
84+
fedora | rhel | centos)
85+
echo dnf
86+
return 0
87+
;;
88+
esac
89+
90+
# Fallback: try ID_LIKE tokens
91+
for like in ${ID_LIKE:-}; do
92+
case "$like" in
93+
ubuntu | debian)
94+
echo apt
95+
return 0
96+
;;
97+
arch | manjaro | artix)
98+
echo yay
99+
return 0
100+
;;
101+
fedora | rhel | centos)
102+
echo dnf
103+
return 0
104+
;;
105+
esac
106+
done
107+
108+
echo unknown
109109
}
110110
echo "[1/3] Installing CLI packages for '$ID'..."
111111
run_cli
@@ -114,31 +114,31 @@ echo "[2/3] Installing dotfiles..."
114114
"$BASEDIR/install"
115115

116116
if $GUI; then
117-
echo "[3/3] Installing GUI packages for '$ID'..."
118-
run_gui
119-
if command -v flatpak >/dev/null 2>&1; then
120-
echo "Installing Flatpak packages..."
121-
"$BASEDIR/scripts/flatpak.sh"
122-
else
123-
echo "Flatpak not found; skipping Flatpak packages."
124-
fi
117+
echo "[3/3] Installing GUI packages for '$ID'..."
118+
run_gui
119+
if command -v flatpak >/dev/null 2>&1; then
120+
echo "Installing Flatpak packages..."
121+
"$BASEDIR/scripts/flatpak.sh"
122+
else
123+
echo "Flatpak not found; skipping Flatpak packages."
124+
fi
125125

126126
else
127-
echo "[3/3] Skipping GUI packages (run with -g to include)."
127+
echo "[3/3] Skipping GUI packages (run with -g to include)."
128128
fi
129129
if command -v systemctl >/dev/null 2>&1; then
130-
if command -v tailscaled >/dev/null 2>&1 || systemctl list-unit-files --type=service 2>/dev/null | grep -q '^tailscaled\.service'; then
131-
echo "Ensuring tailscaled service is enabled and running..."
132-
if ! systemctl is-enabled tailscaled >/dev/null 2>&1 || ! systemctl is-active tailscaled >/dev/null 2>&1; then
133-
if command -v sudo >/dev/null 2>&1; then
134-
sudo systemctl enable --now tailscaled || true
135-
sudo tailscaled set --operator="$USER"
136-
echo "Enabled tailscaled service and set operator to current user."
137-
else
138-
systemctl enable --now tailscaled || true
139-
fi
140-
fi
141-
fi
130+
if command -v tailscaled >/dev/null 2>&1 || systemctl list-unit-files --type=service 2>/dev/null | grep -q '^tailscaled\.service'; then
131+
echo "Ensuring tailscaled service is enabled and running..."
132+
if ! systemctl is-enabled tailscaled >/dev/null 2>&1 || ! systemctl is-active tailscaled >/dev/null 2>&1; then
133+
if command -v sudo >/dev/null 2>&1; then
134+
sudo systemctl enable --now tailscaled || true
135+
sudo tailscaled set --operator="$USER"
136+
echo "Enabled tailscaled service and set operator to current user."
137+
else
138+
systemctl enable --now tailscaled || true
139+
fi
140+
fi
141+
fi
142142
fi
143143

144144
echo "Done."

0 commit comments

Comments
 (0)