mirror of https://github.com/mitchell/dotfiles.git
Add arch linux install scripts and update debian install scripts
This commit is contained in:
parent
029020324a
commit
015eafa945
|
@ -219,10 +219,10 @@ d-i clock-setup/ntp boolean true
|
||||||
|
|
||||||
# This makes partman automatically partition without confirmation, provided
|
# This makes partman automatically partition without confirmation, provided
|
||||||
# that you told it what to do using one of the methods above.
|
# that you told it what to do using one of the methods above.
|
||||||
d-i partman-partitioning/confirm_write_new_label boolean true
|
#d-i partman-partitioning/confirm_write_new_label boolean true
|
||||||
d-i partman/choose_partition select finish
|
#d-i partman/choose_partition select finish
|
||||||
d-i partman/confirm boolean true
|
#d-i partman/confirm boolean true
|
||||||
d-i partman/confirm_nooverwrite boolean true
|
#d-i partman/confirm_nooverwrite boolean true
|
||||||
|
|
||||||
# When disk encryption is enabled, skip wiping the partitions beforehand.
|
# When disk encryption is enabled, skip wiping the partitions beforehand.
|
||||||
#d-i partman-auto-crypto/erase_disks boolean false
|
#d-i partman-auto-crypto/erase_disks boolean false
|
||||||
|
@ -271,11 +271,11 @@ d-i partman/confirm_nooverwrite boolean true
|
||||||
# repository.
|
# repository.
|
||||||
|
|
||||||
# This makes partman automatically partition without confirmation.
|
# This makes partman automatically partition without confirmation.
|
||||||
d-i partman-md/confirm boolean true
|
#d-i partman-md/confirm boolean true
|
||||||
d-i partman-partitioning/confirm_write_new_label boolean true
|
#d-i partman-partitioning/confirm_write_new_label boolean true
|
||||||
d-i partman/choose_partition select finish
|
#d-i partman/choose_partition select finish
|
||||||
d-i partman/confirm boolean true
|
#d-i partman/confirm boolean true
|
||||||
d-i partman/confirm_nooverwrite boolean true
|
#d-i partman/confirm_nooverwrite boolean true
|
||||||
|
|
||||||
## Controlling how partitions are mounted
|
## Controlling how partitions are mounted
|
||||||
# The default is to mount by UUID, but you can also choose "traditional" to
|
# The default is to mount by UUID, but you can also choose "traditional" to
|
||||||
|
|
|
@ -0,0 +1,143 @@
|
||||||
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
|
function main
|
||||||
|
log 'Choose timezone'
|
||||||
|
read -P 'Timezone: ' -l timezone
|
||||||
|
set_timezone $timezone
|
||||||
|
|
||||||
|
set_locale
|
||||||
|
|
||||||
|
log 'Choose hostname'
|
||||||
|
read -P 'Hostname: ' -l new_host_name
|
||||||
|
set_hostname $new_host_name
|
||||||
|
|
||||||
|
configure_wired_network 'enp1s0'
|
||||||
|
|
||||||
|
log 'Disc encryption'
|
||||||
|
read -P 'Is your disk encrypted? (y/N)' -l is_encrypt
|
||||||
|
if test "$is_encrypt" = 'y'; or test "$is_encrypt" = 'Y'
|
||||||
|
add_lvm2_mkinitcpio_hook true
|
||||||
|
else
|
||||||
|
add_lvm2_mkinitcpio_hook
|
||||||
|
end
|
||||||
|
|
||||||
|
configure_sudo
|
||||||
|
|
||||||
|
log 'Choose username'
|
||||||
|
read -P 'Username: ' -l username
|
||||||
|
create_admin_user $username
|
||||||
|
|
||||||
|
log 'Configure grub'
|
||||||
|
read -P 'Boot mode (bios/uefi): ' -l boot_mode
|
||||||
|
read -P 'Grub target: ' -l device
|
||||||
|
install_grub $boot_mode $device
|
||||||
|
|
||||||
|
install_openssh
|
||||||
|
end
|
||||||
|
|
||||||
|
function install
|
||||||
|
pacman --sync --noconfirm $argv
|
||||||
|
end
|
||||||
|
|
||||||
|
function log -a message level
|
||||||
|
set message "---------------- $message ----------------"
|
||||||
|
echo \n$message\n
|
||||||
|
end
|
||||||
|
|
||||||
|
function set_timezone -a timezone
|
||||||
|
log "Setting timezone to $timezone"
|
||||||
|
ln -sf /usr/share/zoneinfo/$timezone /etc/localtime
|
||||||
|
|
||||||
|
log "Syncronising to hardware clock"
|
||||||
|
hwclock --systohc
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function set_locale
|
||||||
|
log 'Setting locale to en_US.UTF-8 and generating it'
|
||||||
|
sed -i 's/#en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen
|
||||||
|
locale-gen
|
||||||
|
echo 'LANG=en_US.UTF-8' >/etc/locale.conf
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function set_hostname -a new_hostname
|
||||||
|
log "Setting hostname to $new_hostname"
|
||||||
|
echo $new_hostname >/etc/hostname
|
||||||
|
echo "
|
||||||
|
127.0.0.1 localhost
|
||||||
|
::1 localhost
|
||||||
|
127.0.1.1 $new_hostname.local $new_hostname" >>/etc/hosts
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function configure_wired_network -a interface
|
||||||
|
log "Configuring DHCP managed wired interface $interface"
|
||||||
|
echo "
|
||||||
|
[Match]
|
||||||
|
Name=$interface
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
DHCP=yes" >/etc/systemd/network/20-wired.network
|
||||||
|
|
||||||
|
ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
|
||||||
|
|
||||||
|
log 'Enabling systemd networkd and resolved services'
|
||||||
|
systemctl enable systemd-networkd.service
|
||||||
|
systemctl enable systemd-resolved.service
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function add_lvm2_mkinitcpio_hook -a is_encrypt
|
||||||
|
log 'Adding lvm2 mkinitcpio hook'
|
||||||
|
install lvm2
|
||||||
|
|
||||||
|
set -l hooks 'lvm2'
|
||||||
|
if test -n "$is_encrypt"
|
||||||
|
set hooks 'encrypt' $hooks
|
||||||
|
end
|
||||||
|
|
||||||
|
sed -i "s/modconf block filesystems/modconf block $hooks filesystems/" /etc/mkinitcpio.conf
|
||||||
|
mkinitcpio -P
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function configure_sudo
|
||||||
|
log 'Adding and configuring sudo group'
|
||||||
|
install sudo
|
||||||
|
groupadd sudo
|
||||||
|
set -lx EDITOR sed -i 's/#\s%sudo/%sudo/'
|
||||||
|
visudo
|
||||||
|
end
|
||||||
|
|
||||||
|
function create_admin_user -a username
|
||||||
|
log "Creating user $username and adding to sudo group"
|
||||||
|
useradd -m $username
|
||||||
|
passwd $username
|
||||||
|
gpasswd -a $username sudo
|
||||||
|
end
|
||||||
|
|
||||||
|
function install_grub -a boot_mode target
|
||||||
|
log "Installing grub to target $target"
|
||||||
|
|
||||||
|
switch $boot_mode
|
||||||
|
case bios
|
||||||
|
install grub
|
||||||
|
grub-install --target=i386-pc $target
|
||||||
|
case uefi
|
||||||
|
install grub efibootmgr
|
||||||
|
grub-install --target=x86_64-efi --efi-directory=$target --bootloader-id=GRUB
|
||||||
|
end
|
||||||
|
|
||||||
|
grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
|
end
|
||||||
|
|
||||||
|
function install_openssh
|
||||||
|
log 'Installing openssh'
|
||||||
|
install openssh
|
||||||
|
|
||||||
|
log 'Enabling sshd service'
|
||||||
|
systemctl enable sshd.service
|
||||||
|
end
|
||||||
|
|
||||||
|
main
|
|
@ -0,0 +1,210 @@
|
||||||
|
#!/usr/bin/env fish
|
||||||
|
# Source: https://github.com/mitchell/swim.fish
|
||||||
|
|
||||||
|
### Config ###
|
||||||
|
|
||||||
|
set -g cmd_func_prefix 'provision'
|
||||||
|
|
||||||
|
if test -z "$distro"
|
||||||
|
set -g distro 'arch'
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
### 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'
|
||||||
|
set -l base_pkgs \
|
||||||
|
fish \
|
||||||
|
git \
|
||||||
|
neovim \
|
||||||
|
tmux \
|
||||||
|
rsync \
|
||||||
|
curl \
|
||||||
|
kitty-terminfo \
|
||||||
|
fzf \
|
||||||
|
bat
|
||||||
|
|
||||||
|
set -l arch_pkgs \
|
||||||
|
$base_pkgs \
|
||||||
|
python-neovim \
|
||||||
|
the_silver_searcher
|
||||||
|
|
||||||
|
set -l debian_pkgs \
|
||||||
|
$base_pkgs \
|
||||||
|
silversearcher-ag
|
||||||
|
|
||||||
|
log 'Installing base terminal utilities'
|
||||||
|
install_pkgs
|
||||||
|
|
||||||
|
log 'Setting m\'s default shell to fish'
|
||||||
|
sudo chsh -s /usr/bin/fish m
|
||||||
|
|
||||||
|
log 'Running sync script'
|
||||||
|
./sync
|
||||||
|
|
||||||
|
log 'Installing asdf-vm'
|
||||||
|
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
|
||||||
|
cd ~/.asdf
|
||||||
|
git checkout (git describe --abbrev=0 --tags)
|
||||||
|
end
|
||||||
|
|
||||||
|
function provision_desktop_env -d 'Install base desktop utilities and configure theme'
|
||||||
|
set -l base_pkgs \
|
||||||
|
xclip \
|
||||||
|
bspwm \
|
||||||
|
sxhkd \
|
||||||
|
picom \
|
||||||
|
feh \
|
||||||
|
xfce4-screensaver \
|
||||||
|
rofi \
|
||||||
|
kitty \
|
||||||
|
qutebrowser \
|
||||||
|
wget \
|
||||||
|
unzip
|
||||||
|
|
||||||
|
set -l arch_pkgs \
|
||||||
|
$base_pkgs \
|
||||||
|
xorg-server \
|
||||||
|
xorg-xinit \
|
||||||
|
ttf-ibm-plex \
|
||||||
|
ttf-jetbrains-mono \
|
||||||
|
pavucontrol \
|
||||||
|
pulseaudio \
|
||||||
|
wmname
|
||||||
|
|
||||||
|
set -l debian_pkgs \
|
||||||
|
$base_pkgs \
|
||||||
|
xinit \
|
||||||
|
fonts-ibm-plex \
|
||||||
|
suckless-tools \
|
||||||
|
polybar
|
||||||
|
|
||||||
|
log 'Installing base desktop environment utilities'
|
||||||
|
install_pkgs
|
||||||
|
|
||||||
|
log 'Setting xinitrc'
|
||||||
|
echo 'exec bspwm' >~/.xinitrc
|
||||||
|
|
||||||
|
log 'Installing Nordic theme'
|
||||||
|
mkdir _tmp_nordic; and cd ./_tmp_nordic
|
||||||
|
wget -q -O nordic.tar.xz https://github.com/EliverLara/Nordic/releases/download/v1.9.0/Nordic.tar.xz
|
||||||
|
tar -xf ./nordic.tar.xz
|
||||||
|
mkdir ~/.themes
|
||||||
|
mv ./Nordic/ ~/.themes/
|
||||||
|
cd ..; and rm -r ./_tmp_nordic
|
||||||
|
|
||||||
|
if test $distro = debian
|
||||||
|
log 'Installing JetBrains Mono font manually'
|
||||||
|
mkdir _tmp_fonts; and cd ./_tmp_fonts
|
||||||
|
wget -q https://github.com/JetBrains/JetBrainsMono/releases/download/v2.002/JetBrainsMono-2.002.zip
|
||||||
|
unzip JetBrainsMono-2.002.zip >/dev/null
|
||||||
|
mkdir -p ~/.local/share/fonts/truetype/JetBrainsMono
|
||||||
|
cp ./ttf/*.ttf ~/.local/share/fonts/truetype/JetBrainsMono/
|
||||||
|
cd ..; and rm -r ./_tmp_fonts
|
||||||
|
end
|
||||||
|
|
||||||
|
if test $distro = arch
|
||||||
|
log 'Installing polybar from AUR'
|
||||||
|
install_pkgs --needed base-devel
|
||||||
|
|
||||||
|
git clone https://aur.archlinux.org/polybar.git _tmp_polybar
|
||||||
|
and ./_tmp_polybar
|
||||||
|
makepkg --syncdeps --install --clean --noconfirm
|
||||||
|
cd ..
|
||||||
|
rm -rf ./_tmp_polybar
|
||||||
|
end
|
||||||
|
|
||||||
|
log 'Setting gtk theme'
|
||||||
|
mkdir ~/.config/gtk-3.0
|
||||||
|
echo "
|
||||||
|
[Settings]
|
||||||
|
gtk-icon-theme-name = Adwaita
|
||||||
|
gtk-theme-name = Nordic
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
log 'Installing vagrant and libvirt plugin'
|
||||||
|
set -l arch_pkgs vagrant
|
||||||
|
set -l debian_pkgs vagrant-libvirt
|
||||||
|
|
||||||
|
install_pkgs
|
||||||
|
|
||||||
|
vagrant plugin install vagrant-libvirt
|
||||||
|
end
|
||||||
|
|
||||||
|
function install_libvirt
|
||||||
|
set -l base_pkgs \
|
||||||
|
virt-manager
|
||||||
|
|
||||||
|
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
|
||||||
|
sudo pacman --sync --refresh --noconfirm $arch_pkgs $argv
|
||||||
|
case debian
|
||||||
|
sudo apt-get update >/dev/null 2>&1
|
||||||
|
sudo apt-get install --yes $debian_pkgs $argv
|
||||||
|
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
|
|
@ -1,35 +1,21 @@
|
||||||
#!/usr/bin/env fish
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
function main
|
function main
|
||||||
log 'Upgrading debian to unstable.' head
|
log 'Update apt sources list'
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
deb http://ftp.us.debian.org/debian unstable main contrib non-free
|
deb http://ftp.us.debian.org/debian unstable main contrib non-free
|
||||||
deb-src http://ftp.us.debian.org/debian unstable main contrib non-free' | sudo tee /etc/apt/sources.list
|
deb-src http://ftp.us.debian.org/debian unstable main contrib non-free' | sudo tee /etc/apt/sources.list
|
||||||
|
|
||||||
|
log 'Upgrading debian to unstable'
|
||||||
sudo apt-get update >/dev/null 2>&1
|
sudo apt-get update >/dev/null 2>&1
|
||||||
sudo apt-get dist-upgrade --yes
|
sudo apt-get dist-upgrade --yes
|
||||||
|
|
||||||
log 'Done upgrading debian to unstable and rebooting.' tail
|
log 'Rebooting'
|
||||||
|
|
||||||
sudo reboot
|
sudo reboot
|
||||||
end
|
end
|
||||||
|
|
||||||
function log -a message level
|
function log -a message
|
||||||
if test "$level" = head
|
echo \n"---------------- $message ----------------"\n
|
||||||
echo "
|
|
||||||
###########################################################################################
|
|
||||||
#
|
|
||||||
#--> $message"
|
|
||||||
else if test "$level" = tail
|
|
||||||
echo "#
|
|
||||||
#--> $message
|
|
||||||
#
|
|
||||||
###########################################################################################
|
|
||||||
"
|
|
||||||
else
|
|
||||||
echo -e "#\n#--> $message"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|
Loading…
Reference in New Issue