2020-10-31 22:23:35 +00:00
|
|
|
#!/usr/bin/env fish
|
|
|
|
|
|
|
|
### Config ###
|
|
|
|
|
|
|
|
set -g cmd_func_prefix 'provision'
|
2021-01-19 05:43:37 +00:00
|
|
|
set -g distro
|
2020-10-31 22:23:35 +00:00
|
|
|
|
2021-01-19 05:43:37 +00:00
|
|
|
for line in (cat /etc/os-release)
|
|
|
|
set -l items (string split --max 1 '=' $line)
|
2020-10-31 22:23:35 +00:00
|
|
|
|
2021-01-19 05:43:37 +00:00
|
|
|
if test $items[1] = 'ID'
|
|
|
|
set distro $items[2]
|
|
|
|
end
|
|
|
|
end
|
2020-10-31 22:23:35 +00:00
|
|
|
|
|
|
|
### Commands ###
|
|
|
|
# Add, edit, and remove commands freely below.
|
|
|
|
# To add a command simply create a function with this naming scheme: {run_func_prefix}_{name}.
|
|
|
|
|
|
|
|
function provision_default -d 'Provisioning terminal, desktop, and m-net'
|
|
|
|
provision_terminal_env
|
|
|
|
and provision_desktop_env
|
|
|
|
and provision_m_net
|
|
|
|
end
|
|
|
|
|
|
|
|
function provision_terminal_env -d 'Install base terminal utilities and sync configurations'
|
2020-11-12 00:00:36 +00:00
|
|
|
if test $distro = arch
|
|
|
|
log 'Installing pikaur from AUR'
|
|
|
|
|
|
|
|
install_pkgs --needed base-devel
|
|
|
|
|
|
|
|
set -l cwd (pwd)
|
|
|
|
set -l tmp_dir (mktemp --directory)
|
|
|
|
|
|
|
|
git clone https://aur.archlinux.org/pikaur.git $tmp_dir
|
|
|
|
and cd $tmp_dir
|
|
|
|
and makepkg --clean --install --rmdeps --syncdeps --noconfirm
|
|
|
|
|
|
|
|
cd $cwd
|
|
|
|
rm -rf $tmp_dir
|
|
|
|
end
|
|
|
|
|
2021-01-18 04:55:22 +00:00
|
|
|
if test $distro = debian
|
|
|
|
log 'Adding fish apt repo'
|
|
|
|
|
|
|
|
install_pkgs gpg
|
|
|
|
|
|
|
|
echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_10/ /' |
|
|
|
|
sudo tee /etc/apt/sources.list.d/shells:fish:release:3.list
|
|
|
|
|
|
|
|
curl -fsSL https://download.opensuse.org/repositories/shells:fish:release:3/Debian_10/Release.key |
|
|
|
|
gpg --dearmor |
|
|
|
|
sudo tee /etc/apt/trusted.gpg.d/shells_fish_release_3.gpg >/dev/null
|
|
|
|
end
|
|
|
|
|
2020-10-31 22:23:35 +00:00
|
|
|
set -l base_pkgs \
|
|
|
|
fish \
|
|
|
|
git \
|
|
|
|
neovim \
|
|
|
|
tmux \
|
|
|
|
rsync \
|
|
|
|
curl \
|
|
|
|
kitty-terminfo \
|
|
|
|
fzf \
|
|
|
|
|
|
|
|
set -l arch_pkgs \
|
|
|
|
$base_pkgs \
|
|
|
|
python-neovim \
|
2021-01-18 04:55:22 +00:00
|
|
|
the_silver_searcher \
|
|
|
|
bat
|
2020-10-31 22:23:35 +00:00
|
|
|
|
|
|
|
set -l debian_pkgs \
|
|
|
|
$base_pkgs \
|
|
|
|
silversearcher-ag
|
|
|
|
|
|
|
|
log 'Installing base terminal utilities'
|
|
|
|
install_pkgs
|
2020-11-06 00:49:16 +00:00
|
|
|
or return $status
|
2020-10-31 22:23:35 +00:00
|
|
|
|
|
|
|
log 'Setting m\'s default shell to fish'
|
|
|
|
sudo chsh -s /usr/bin/fish m
|
|
|
|
|
|
|
|
log 'Running sync script'
|
2020-11-02 05:11:42 +00:00
|
|
|
./sync --desktop
|
2020-10-31 22:23:35 +00:00
|
|
|
|
|
|
|
log 'Installing asdf-vm'
|
|
|
|
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
|
2020-11-06 00:49:16 +00:00
|
|
|
and cd ~/.asdf
|
|
|
|
and git checkout (git describe --abbrev=0 --tags)
|
2020-10-31 22:23:35 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function provision_desktop_env -d 'Install base desktop utilities and configure theme'
|
|
|
|
set -l base_pkgs \
|
|
|
|
xclip \
|
|
|
|
bspwm \
|
|
|
|
sxhkd \
|
|
|
|
picom \
|
|
|
|
feh \
|
|
|
|
rofi \
|
|
|
|
kitty \
|
|
|
|
qutebrowser \
|
|
|
|
wget \
|
2021-02-02 04:41:26 +00:00
|
|
|
unzip \
|
|
|
|
physlock \
|
|
|
|
pulseaudio \
|
|
|
|
playerctl
|
|
|
|
|
2020-10-31 22:23:35 +00:00
|
|
|
|
|
|
|
set -l arch_pkgs \
|
|
|
|
$base_pkgs \
|
|
|
|
xorg-server \
|
|
|
|
xorg-xinit \
|
|
|
|
ttf-ibm-plex \
|
|
|
|
ttf-jetbrains-mono \
|
|
|
|
pavucontrol \
|
2021-02-02 04:41:26 +00:00
|
|
|
pulseaudio-alsa \
|
2020-11-12 00:00:36 +00:00
|
|
|
wmname \
|
2021-02-02 04:41:26 +00:00
|
|
|
polybar \
|
2021-05-16 19:53:59 +00:00
|
|
|
light \
|
|
|
|
slock
|
2020-10-31 22:23:35 +00:00
|
|
|
|
|
|
|
set -l debian_pkgs \
|
|
|
|
$base_pkgs \
|
|
|
|
xinit \
|
|
|
|
fonts-ibm-plex \
|
|
|
|
suckless-tools \
|
|
|
|
polybar
|
|
|
|
|
|
|
|
log 'Installing base desktop environment utilities'
|
|
|
|
install_pkgs
|
2020-11-06 00:49:16 +00:00
|
|
|
or return $status
|
2020-10-31 22:23:35 +00:00
|
|
|
|
|
|
|
log 'Setting xinitrc'
|
2021-06-08 19:36:14 +00:00
|
|
|
echo '#!/bin/sh
|
|
|
|
|
|
|
|
userresources=$HOME/.Xresources
|
|
|
|
usermodmap=$HOME/.Xmodmap
|
|
|
|
sysresources=/etc/X11/xinit/.Xresources
|
|
|
|
sysmodmap=/etc/X11/xinit/.Xmodmap
|
|
|
|
|
|
|
|
# merge in defaults and keymaps
|
|
|
|
|
|
|
|
if [ -f $sysresources ]; then
|
|
|
|
xrdb -merge $sysresources
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f $sysmodmap ]; then
|
|
|
|
xmodmap $sysmodmap
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f "$userresources" ]; then
|
|
|
|
xrdb -merge "$userresources"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f "$usermodmap" ]; then
|
|
|
|
xmodmap "$usermodmap"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# start some nice programs
|
|
|
|
|
|
|
|
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
|
|
|
|
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
|
|
|
|
[ -x "$f" ] && . "$f"
|
|
|
|
done
|
|
|
|
unset f
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec bspwm' >~/.xinitrc
|
2020-10-31 22:23:35 +00:00
|
|
|
|
2020-11-06 00:49:16 +00:00
|
|
|
log 'Installing arc-gruvbox theme'
|
|
|
|
mkdir -p ~/.themes
|
|
|
|
xzcat ./oomox-arc-gruvbox.tar.xz | tar --extract --directory=$HOME/.themes
|
2020-10-31 22:23:35 +00:00
|
|
|
|
|
|
|
if test $distro = debian
|
|
|
|
log 'Installing JetBrains Mono font manually'
|
2020-11-06 00:49:16 +00:00
|
|
|
|
|
|
|
set -l cwd (pwd)
|
|
|
|
set -l tmp_dir (mktemp --directory)
|
|
|
|
|
|
|
|
cd $tmp_dir
|
|
|
|
|
2020-10-31 22:23:35 +00:00
|
|
|
wget -q https://github.com/JetBrains/JetBrainsMono/releases/download/v2.002/JetBrainsMono-2.002.zip
|
2020-11-06 00:49:16 +00:00
|
|
|
and unzip -q JetBrainsMono-2.002.zip
|
|
|
|
and mkdir -p ~/.local/share/fonts/truetype/JetBrainsMono
|
|
|
|
and cp ./ttf/*.ttf ~/.local/share/fonts/truetype/JetBrainsMono/
|
|
|
|
|
|
|
|
cd $cwd
|
|
|
|
rm -r $tmp_dir
|
2020-10-31 22:23:35 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
log 'Setting gtk theme'
|
|
|
|
mkdir ~/.config/gtk-3.0
|
|
|
|
echo "
|
|
|
|
[Settings]
|
|
|
|
gtk-icon-theme-name = Adwaita
|
2020-11-06 00:49:16 +00:00
|
|
|
gtk-theme-name = oomox-arc-gruvbox
|
2020-10-31 22:23:35 +00:00
|
|
|
gtk-font-name = IBM Plex Sans 11" >~/.config/gtk-3.0/settings.ini
|
|
|
|
end
|
|
|
|
|
|
|
|
function provision_m_net -d 'Install syncthing and keepassxc'
|
|
|
|
log 'Installing m-net utilities'
|
|
|
|
install_pkgs \
|
|
|
|
keepassxc \
|
|
|
|
syncthing
|
2020-11-06 00:49:16 +00:00
|
|
|
or return $status
|
2020-10-31 22:23:35 +00:00
|
|
|
|
|
|
|
log 'Enabling syncthing service'
|
|
|
|
sudo systemctl enable syncthing@m.service
|
|
|
|
end
|
|
|
|
|
|
|
|
function provision_libvirt -d 'Provision libvirt and virt-manager'
|
|
|
|
log 'Installing libvirt, qemu, and virt-manager'
|
|
|
|
install_libvirt
|
|
|
|
end
|
|
|
|
|
|
|
|
function provision_vagrant -d 'Provision vagrant with libvirt'
|
|
|
|
install_libvirt
|
2020-11-06 00:49:16 +00:00
|
|
|
or return $status
|
2020-10-31 22:23:35 +00:00
|
|
|
|
|
|
|
log 'Installing vagrant and libvirt plugin'
|
|
|
|
set -l arch_pkgs vagrant
|
|
|
|
set -l debian_pkgs vagrant-libvirt
|
|
|
|
|
|
|
|
install_pkgs
|
2020-11-06 00:49:16 +00:00
|
|
|
or return $status
|
2020-10-31 22:23:35 +00:00
|
|
|
|
|
|
|
vagrant plugin install vagrant-libvirt
|
|
|
|
end
|
|
|
|
|
|
|
|
function install_libvirt
|
|
|
|
set -l base_pkgs \
|
2021-02-01 00:34:35 +00:00
|
|
|
virt-manager \
|
|
|
|
virt-install \
|
|
|
|
virt-viewer
|
2020-10-31 22:23:35 +00:00
|
|
|
|
|
|
|
set -l arch_pkgs \
|
|
|
|
$base_pkgs \
|
|
|
|
libvirt \
|
|
|
|
qemu \
|
|
|
|
dnsmasq \
|
|
|
|
ebtables
|
|
|
|
|
|
|
|
set -l debian_pkgs \
|
|
|
|
$base_pkgs \
|
|
|
|
qemu-system \
|
|
|
|
libvirt-clients \
|
|
|
|
libvirt-daemon-system
|
|
|
|
|
|
|
|
install_pkgs
|
|
|
|
|
|
|
|
log 'Adding m to libvirt group and enabling libvirtd service'
|
|
|
|
switch $distro
|
|
|
|
case debian
|
|
|
|
sudo adduser m libvirt
|
|
|
|
case arch
|
|
|
|
sudo gpasswd -a m libvirt
|
|
|
|
end
|
|
|
|
|
|
|
|
sudo systemctl enable libvirtd.service
|
|
|
|
end
|
|
|
|
|
|
|
|
function install_pkgs -S
|
|
|
|
switch $distro
|
|
|
|
case arch
|
2020-11-12 00:00:36 +00:00
|
|
|
set -l cmd pacman
|
|
|
|
|
|
|
|
if command -q pikaur
|
|
|
|
set cmd pikaur
|
|
|
|
end
|
|
|
|
|
|
|
|
sudo $cmd --sync --refresh --sysupgrade --noconfirm
|
|
|
|
sudo $cmd --sync --noconfirm $arch_pkgs $argv
|
2020-10-31 22:23:35 +00:00
|
|
|
case debian
|
2020-11-15 05:23:44 +00:00
|
|
|
sudo apt-get --quiet --yes update
|
|
|
|
sudo apt-get --quiet --yes upgrade
|
|
|
|
sudo apt-get --quiet --yes install $debian_pkgs $argv
|
2020-10-31 22:23:35 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function log -a message
|
|
|
|
echo \n"---------------- $message ----------------"\n
|
|
|
|
end
|
|
|
|
|
|
|
|
function main
|
|
|
|
curl -fsS https://git.mjfs.us/mitchell/swim.fish/raw/branch/master/functions/sw.fish | source
|
|
|
|
run_swim_command $cmd_func_prefix $argv
|
|
|
|
end
|
|
|
|
|
|
|
|
main $argv
|