zshrc: feat: Add distro type determination

This commit is contained in:
PorridgePi
2022-09-28 19:35:23 +08:00
parent 29b3e9dea0
commit 3e4bb8c57d

11
.zshrc
View File

@@ -31,6 +31,17 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
DISTRO=$(uname -s) DISTRO=$(uname -s)
VER=$(uname -r) VER=$(uname -r)
fi fi
if command -v dpkg &> /dev/null; then
# Debian-based
DISTRO_TYPE=debian
elif command -v yum &> /dev/null; then
# RPM-based
DISTRO_TYPE=rpm
elif command -v pacman &> /dev/null; then
# Arch-based
DISTRO_TYPE=arc
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then elif [[ "$OSTYPE" == "darwin"* ]]; then
# macOS # macOS
OSNAME=macOS OSNAME=macOS