mirror of
https://github.com/mitchell/dotfiles.git
synced 2026-08-10 08:09:35 +00:00
feat(install_utils): automate OS detection
This commit is contained in:
parent
f5e55a09d6
commit
b5f5237356
1 changed files with 20 additions and 4 deletions
|
|
@ -4,7 +4,17 @@ function log -a message
|
||||||
echo \n"--- $message ---"\n
|
echo \n"--- $message ---"\n
|
||||||
end
|
end
|
||||||
|
|
||||||
read -P "OS? (arch/debian/fedora/mac) " -l distro
|
set -l distro
|
||||||
|
set -l uname (uname)
|
||||||
|
|
||||||
|
if test $uname = Darwin
|
||||||
|
set distro mac
|
||||||
|
else if test -f /etc/os-release
|
||||||
|
set distro (grep '^ID=' /etc/os-release | string replace 'ID=' '' | string trim -c '"')
|
||||||
|
else
|
||||||
|
echo 'Your OS is unsupported. Supported: Arch, Debian, Fedora, Mac (Brew)'
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
set -l base_pkgs \
|
set -l base_pkgs \
|
||||||
fish \
|
fish \
|
||||||
|
|
@ -54,15 +64,18 @@ switch $distro
|
||||||
log 'Installing yay'
|
log 'Installing yay'
|
||||||
|
|
||||||
sudo pacman --sync --refresh --sysupgrade --noconfirm
|
sudo pacman --sync --refresh --sysupgrade --noconfirm
|
||||||
and sudo pacman --sync --needed --noconfirm base-devel go
|
and sudo pacman --sync --needed --noconfirm base-devel go bat
|
||||||
or return $status
|
or return
|
||||||
|
|
||||||
test -d yay
|
test -d yay
|
||||||
or git clone https://aur.archlinux.org/yay.git
|
or git clone https://aur.archlinux.org/yay.git
|
||||||
and cd yay
|
and cd yay
|
||||||
|
and bat PKGBUILD
|
||||||
|
and read -P 'Continue? (y/N): ' -l ready
|
||||||
|
and test "$ready" = y; or test "$ready" = Y
|
||||||
and makepkg --syncdeps --install --noconfirm
|
and makepkg --syncdeps --install --noconfirm
|
||||||
and cd ..
|
and cd ..
|
||||||
or return $status
|
or return
|
||||||
|
|
||||||
log 'Installing packages with yay'
|
log 'Installing packages with yay'
|
||||||
|
|
||||||
|
|
@ -76,4 +89,7 @@ switch $distro
|
||||||
log 'Installing packages with DNF'
|
log 'Installing packages with DNF'
|
||||||
sudo dnf upgrade --assumeyes
|
sudo dnf upgrade --assumeyes
|
||||||
and sudo dnf --assumeyes install $fedora_pkgs
|
and sudo dnf --assumeyes install $fedora_pkgs
|
||||||
|
case '*'
|
||||||
|
echo 'Your OS is unsupported. Supported: Arch, Debian, Fedora, Mac (Brew)'
|
||||||
|
return 1
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue