Compare commits

...

3 Commits

Author SHA1 Message Date
Anton Volnuhin
709100460d checks for atuin 2023-05-30 08:12:19 +03:00
Anton Volnuhin
cf9f51cb6e Add support for arch linux, checks for already installed fish 2023-05-30 08:09:20 +03:00
Anton Volnuhin
40d3dc2b73 Switch once to onchange 2023-05-30 07:57:24 +03:00
2 changed files with 88 additions and 70 deletions

0
run_onchange_before_authorized_keys.sh Normal file → Executable file
View File

View File

@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
BASE_PACKAGES="kitty-terminfo gpg git curl wget ripgrep fd-find unzip python3-pip htop fzf bat gawk" BASE_PACKAGES="gpg curl wget git"
ACT_PACKAGES="ripgrep fd-find unzip htop fzf bat gawk"
USER=$(whoami) USER=$(whoami)
Green='\033[0;32m' # Green Green='\033[0;32m' # Green
NC='\033[0m' # No Color NC='\033[0m' # No Color
@ -12,17 +13,22 @@ $Green##########################################################################
## Update caches and upgrade packages ## ## Update caches and upgrade packages ##
## ## ## ##
###############################################################################$NC" ###############################################################################$NC"
sleep 3
{{ if eq .chezmoi.os "linux" -}} {{ if eq .chezmoi.osRelease.id "fedora" -}}
{{ if eq .chezmoi.osRelease.id "fedora" -}}
sudo dnf update -y sudo dnf update -y
{{ else if eq .chezmoi.osRelease.id "debian" "ubuntu" -}} {{ else if eq .chezmoi.osRelease.id "debian" "ubuntu" -}}
sudo apt update sudo apt update
sudo apt upgrade -y sudo apt upgrade -y
{{ end -}} {{ else if eq .chezmoi.osRelease "arch" -}}
sudo pacman -Syu --noconfirm
{{ else if .chezmoi.os "darwin" -}}
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew update
brew upgrade -y
{{ end -}} {{ end -}}
@ -36,32 +42,56 @@ $Green##########################################################################
###############################################################################$NC" ###############################################################################$NC"
sleep 3 sleep 3
{{ if eq .chezmoi.os "linux" -}} {{ if eq .chezmoi.osRelease.id "fedora" -}}
{{ if eq .chezmoi.osRelease.id "fedora" -}} sudo dnf install $BASE_PACKAGES kitty-terminfo util-linux-user -y
sudo dnf install $BASE_PACKAGES util-linux-user -y
{{ else if eq .chezmoi.osRelease.id "debian" "ubuntu" -}} {{ else if eq .chezmoi.osRelease.id "debian" "ubuntu" -}}
sudo apt install $BASE_PACKAGES -y sudo apt install $BASE_PACKAGES kitty-terminfo -y
{{ else if eq .chezmoi.osRelease "arch" -}}
sudo pacman -Sy --noconfirm $BASE_PACKAGES kitty-terminfo
{{ else if eq .chezmoi.os "darwin" -}}
brew install $BASE_PACKAGES
{{ end -}}
{{ end -}} {{ end -}}
################################################################################
################################################################################
{{ if eq .chezmoi.os "linux" -}}
if ! type nix &> /dev/null
then
echo -e "
$Green###############################################################################
## ##
## Install nix packet manager (single user) ##
## ##
###############################################################################$NC"
sleep 3
bash <(curl -L https://nixos.org/nix/install) --no-daemon
fi
{{ end -}}
################################################################################
################################################################################
{{ if eq .chezmoi.osRelease.id "debian" "ubuntu" -}}
if ! type fish &> /dev/null
then
echo -e " echo -e "
$Green################################################################################ $Green################################################################################
## ## ## ##
## Install fish and set it as the default shell ## ## Subscribe to Fish shell repositories in ubuntu/debian ##
## ## ## ##
################################################################################$NC" ################################################################################$NC"
sleep 3 sleep 3
{{ if eq .chezmoi.os "linux" -}}
{{ if eq .chezmoi.osRelease.id "fedora" -}}
sudo dnf install fish -y
{{ else if eq .chezmoi.osRelease.id "debian" "ubuntu" -}}
{{ if eq .chezmoi.osRelease.id "debian" -}} {{ if eq .chezmoi.osRelease.id "debian" -}}
## Setup fish repo in debian ## Setup fish repo in debian
@ -73,67 +103,55 @@ sleep 3
## Setup fish repo in ubuntu ## Setup fish repo in ubuntu
sudo apt-add-repository ppa:fish-shell/release-3 -y sudo apt-add-repository ppa:fish-shell/release-3 -y
{{ end -}} {{ end -}}
fi
## Update repos with fish repo included and install fish
sudo apt update
sudo apt install fish -y
{{ end -}}
{{ end -}} {{ end -}}
echo -e "
$Green###############################################################################
## ##
## Install neovim, fish, fisher, atuin, jump, and the rest of packages ##
## ##
###############################################################################$NC"
sleep 3
{{ if eq .chezmoi.osRelease.id "fedora" -}}
sudo dnf install neovim fish $ACT_PACKAGES -y
nix-env -iA nixpkgs.atuin nixpkgs.jump
{{ else if eq .chezmoi.osRelease "arch" -}}
sudo pacman -Sy --noconfirm neovim fish atuin $ACT_PACKAGES
nix-env -iA nixpkgs.jump
{{ else if eq .chezmoi.osRelease.id "debian" "ubuntu" -}}
sudo apt install fish $ACT_PACKAGES -y
nix-env -iA nixpkgs.neovim nixpkgs.jump
if ! fish -c atuin &>/dev/null
then
bash <(curl https://raw.githubusercontent.com/ellie/atuin/main/install.sh)
fi
{{ else if eq .chezmoi.os "darwin" -}}
brew install fish neovim $ACT_PACKAGES atuin jump -y
{{ end -}}
## Install fisher plugin manager for fish, so that we may update in after plugin list sync by chezmoi ## Install fisher plugin manager for fish, so that we may update in after plugin list sync by chezmoi
fish -c "curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher" if ! fish -c fisher &>/dev/null
then
fish -c "curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher"
fi
## Change default shell to fish ## Change default shell to fish
echo if [ "$(basename $SHELL)" != "fish" ]
echo then
echo "Changing shell to fish for user $USER" echo
sudo chsh -s $(which fish) $USER echo
echo "Changing shell to fish for user $USER"
echo -e " sudo chsh -s $(which fish) $USER
fi
$Green###############################################################################
## ##
## Install nix packet manager (single user) ##
## ##
###############################################################################$NC"
sleep 3
bash <(curl -L https://nixos.org/nix/install) --no-daemon
echo -e "
$Green###############################################################################
## ##
## Install neovim ##
## ##
###############################################################################$NC"
sleep 3
{{ if eq .chezmoi.os "linux" -}}
{{ if eq .chezmoi.osRelease.id "fedora" -}}
sudo dnf install neovim -y
{{ else if eq .chezmoi.osRelease.id "debian" "ubuntu" -}}
fish -c "nix-env -iA nixpkgs.neovim"
{{ end -}}
{{ end -}}
echo -e "
$Green###############################################################################
## ##
## Install atuin and jump ##
## ##
###############################################################################$NC"
sleep 3
{{ if eq .chezmoi.os "linux" -}}
fish -c "nix-env -iA nixpkgs.atuin"
fish -c "nix-env -iA nixpkgs.jump"
{{ end -}}