dotfiles/dot_scripts/executable_install_base.sh

90 lines
2.6 KiB
Bash
Raw Normal View History

2022-11-24 16:04:55 +00:00
#!/bin/sh
2022-11-24 16:11:50 +00:00
# Never ever curl some remote shit straight to shell, like:
2022-11-25 16:58:51 +00:00
# curl --proto '=https' --tlsv1.2 -sSf https://inex.dev/v/dotfiles/raw/branch/main/dot_scripts/executable_install_base.sh | sh
2022-11-25 22:16:04 +00:00
# seriously, don't do this, it's insecure!
2022-11-24 16:04:55 +00:00
2022-12-01 13:22:28 +00:00
## Pacman
2022-12-09 23:50:27 +00:00
echo "* enable multilib"
2022-12-01 19:32:02 +00:00
sudo sed -z -i -e 's/#\[multilib\]\n#Include = \/etc\/pacman.d\/mirrorlist/\[multilib\]\nInclude = \/etc\/pacman.d\/mirrorlist/' /etc/pacman.conf
2022-12-09 23:50:27 +00:00
2022-12-01 13:22:28 +00:00
# Workaround for keyring nonsense, see https://bugs.archlinux.org/task/75574
2022-12-09 23:50:27 +00:00
echo "* refresh pkg db, update keyring"
2022-12-01 13:25:29 +00:00
sudo pacman -Sy --needed --noconfirm archlinux-keyring
2022-12-09 23:50:27 +00:00
echo "* upgrade installed pkgs"
2022-12-01 13:25:29 +00:00
sudo pacman -Su --needed --noconfirm
2022-12-09 23:50:27 +00:00
echo "* install pkgs"
2023-03-01 16:37:10 +00:00
sudo pacman --needed --noconfirm -S - < .scripts/pacman_packages.txt
2022-11-24 16:04:55 +00:00
2022-12-09 23:04:07 +00:00
# Fire reflector (should probably call it there directly with custom config)
2022-12-09 23:50:27 +00:00
echo "* run reflector"
2022-12-09 23:04:07 +00:00
sudo systemctl start reflector
2022-12-09 22:49:47 +00:00
# Sync pkgfile db
2022-12-09 23:50:27 +00:00
echo "* sync pkgfile"
2022-12-09 22:50:44 +00:00
sudo pkgfile -u
2022-12-09 22:49:47 +00:00
2022-12-01 13:22:28 +00:00
## Paru (AUR helper)
# Install Paru from AUR if not installed
2022-11-24 16:04:55 +00:00
if pacman -Qs paru > /dev/null ; then
2022-12-09 23:50:27 +00:00
echo "* paru already installed."
2022-11-24 16:04:55 +00:00
else
2022-12-09 23:50:27 +00:00
echo "* install paru"
2022-11-24 16:04:55 +00:00
git clone https://aur.archlinux.org/paru-bin.git
cd paru-bin/
makepkg --needed --noconfirm -si
cd ..
rm -rf paru-bin/
fi
2022-12-01 13:22:28 +00:00
## AUR Packages
2022-12-09 23:50:27 +00:00
echo "* install AUR pkgs"
2023-03-01 17:04:34 +00:00
paru --needed --noconfirm -Syua - < .scripts/aur_packages.txt
2022-12-03 20:24:30 +00:00
if ! pacman -Qi nvim-packer-git > /dev/null; then
2022-12-03 20:25:49 +00:00
paru -S --needed --noconfirm nvim-packer-git
2022-12-03 20:24:30 +00:00
fi
2022-11-24 16:51:15 +00:00
2022-12-09 23:50:27 +00:00
echo "* remove orphans"
2022-12-09 23:40:01 +00:00
paru -Qtdq | paru --noconfirm -Rns -
2022-12-09 23:39:26 +00:00
2023-03-01 17:15:40 +00:00
echo "* unlisted packages:"
echo $(comm -23 <(paru -Qqe | sort) <(sort .scripts/pacman_packages.txt .scripts/aur_packages.txt))
2022-12-01 13:22:28 +00:00
## Chezmoi
2022-12-09 23:50:27 +00:00
echo "* init chezmoi"
2022-11-24 16:51:15 +00:00
chezmoi init --apply https://inex.dev/v/dotfiles.git
2022-12-01 19:33:03 +00:00
cd ~/.local/share/chezmoi/
2022-11-25 16:49:34 +00:00
git remote set-url origin git@inex.dev:v/dotfiles.git
2022-12-01 19:33:03 +00:00
cd ~
2022-11-24 16:51:15 +00:00
2022-12-01 13:22:28 +00:00
## SSH
# Generate key if not exist
2022-11-24 17:17:39 +00:00
if [ -f "$HOME/.ssh/id_ed25519.pub" ]; then
2022-12-09 23:50:27 +00:00
echo "* ssh key already exist"
2022-11-24 17:17:39 +00:00
else
2022-12-09 23:50:27 +00:00
echo "* create ssh key"
2022-11-24 17:20:28 +00:00
ssh-keygen -t ed25519 -f "$HOME/.ssh/id_ed25519" -N ""
2022-11-24 17:17:39 +00:00
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
fi
2022-12-03 17:47:56 +00:00
## Neovim
2022-12-09 23:50:27 +00:00
echo "* install/upgrade nvim pkgs"
2022-12-03 20:41:07 +00:00
nvim -c 'autocmd User PackerComplete quitall' -c 'PackerSync'
2022-12-03 17:47:56 +00:00
2022-12-01 13:22:28 +00:00
## Add user to useful groups
2022-12-09 23:50:27 +00:00
echo "* add user to groups"
sudo usermod -aG wheel,input,audio,video,lp v
2022-12-01 13:22:28 +00:00
2022-12-01 19:31:21 +00:00
## Apply Firefox policies, see https://github.com/mozilla/policy-templates/blob/master/README.md
2022-12-09 23:50:27 +00:00
echo "* set firefox policies"
2022-11-25 21:16:08 +00:00
sudo mkdir -p /etc/firefox/policies
2022-12-01 19:33:03 +00:00
sudo cp ~/.scripts/firefox_policies.json /etc/firefox/policies/policies.json
2022-12-01 19:31:21 +00:00
## Fix NTFS Mount, see https://wiki.archlinux.org/title/NTFS#udisks_support
2022-12-09 23:50:27 +00:00
echo "* set mount options"
2022-12-01 19:33:03 +00:00
sudo cp ~/.scripts/mount_options.conf /etc/udisks2/mount_options.conf
2022-12-01 13:22:28 +00:00
2023-05-04 09:45:51 +00:00