dotfiles/setup.sh

69 lines
1.9 KiB
Bash

#!/bin/sh -e
if [ ! -x "$(command -v git)" ]; then
echo "Please install git first."
exit 1
fi
if [ ! -f /etc/doas.conf ]; then
echo "Please configure doas, then re-run this script as a normal user."
exit 1
fi
chmod 700 ~
# Remove stuff OpenBSD adds by default that I don't need
rm -f ~/.cshrc ~/.cvsrc ~/.login ~/.mailrc ~/.Xdefaults ~/.profile
# Create directory structure
mkdir -p \
~/Documents/Projects \
~/Music \
~/Pictures \
~/Downloads \
~/.ssh
# Grab latest dotfiles and apply them to the system
git clone https://git.jaderune.net/jbauer/dotfiles ~/Documents/Projects/dotfiles
cd ~/Documents/Projects/dotfiles
for file in .????*; do
cp -r "$file" ~
done
echo "Copying etc/ files"
doas cp -r etc/* /etc/
doas chmod 774 /etc/apm/*
echo "Writing xenodm config"
doas cp xenodm.Xresources /etc/X11/xenodm/Xresources
doas cp xenodm.Xsetup_0 /etc/X11/xenodm/Xsetup_0
echo "pkill xmessage" | cat - /etc/X11/xenodm/GiveConsole > /etc/X11/xenodm/GiveConsole
groups="staff,_shutdown"
echo "Adding user $USER to groups: $groups"
doas usermod -G $groups jbauer
echo "Setting shell for $USER to $(which fish)"
doas chsh -s /usr/local/bin/fish jbauer
echo "Enabling power management services"
doas rcctl enable obsdfreqd apmd
doas rcctl set apmd flags -L -z5
doas rcctl start obsdfreqd apmd
echo "Configuring syncthing to run on startup"
echo "@reboot tmux new-session -d '/usr/local/bin/syncthing'" | crontab -
echo "Linking /usr/bin/openrsync -> /usr/bin/rsync"
doas ln -s /usr/bin/openrsync /usr/bin/rsync
echo "Installing packages, you might want to grab a cup of tea..."
doas pkg_add -l ~/Documents/Projects/dotfiles/pkg_base
echo "========="
echo "All done!"
echo "========="
echo "Install additional packages related to programming from dotfiles/pkg_programming."
echo "Don't forget to increase openfiles-max and openfiles-cur in /etc/login.conf for the staff group."