Compare commits

...

2 Commits

Author SHA1 Message Date
PorridgePi
81dc78a3f9 bootstrap: lsd: Initial commit 2022-09-28 19:42:05 +08:00
PorridgePi
3e4bb8c57d zshrc: feat: Add distro type determination 2022-09-28 19:35:23 +08:00
2 changed files with 32 additions and 0 deletions

21
.config/yadm/bootstrap.d/lsd.sh Executable file
View File

@@ -0,0 +1,21 @@
if [[ "$OSNAME" == "Linux" ]]; then
# Linux
if [[ "DISTRO_TYPE" == "debian" ]]; then
# Debian-based
URL=$(curl -s https://api.github.com/repos/Peltoche/lsd/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep $(uname -m) | grep -v musl)
curl -o /temp/lsd.deb "$URL"
sudo dpkg -i /temp/lsd.deb
else
# Unknown distro
echo 'ERROR: Unknown distro'
echo 'Exiting...'
exit 1
elif [[ "$OSNAME" == "macOS" ]]; then
# macOS
brew install lsd
else
# Unknown
echo 'ERROR: Unknown OS'
echo 'Exiting...'
exit 1
fi

11
.zshrc
View File

@@ -31,6 +31,17 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
DISTRO=$(uname -s)
VER=$(uname -r)
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
# macOS
OSNAME=macOS