2021-12-11 01:02:01 +00:00
SECTION() { printf "\n [1m [4m$1 [0m\n"; }
2020-10-23 20:15:25 +00:00
highlight() { printf " [1m [3m$1 [0m\n"; }
2021-12-11 01:02:01 +00:00
subhighlight() { printf " [3m$1 [0m\n"; }
2020-10-23 20:15:25 +00:00
2022-01-07 17:31:47 +00:00
source "$HOME/.zshenv"
2021-12-11 01:02:01 +00:00
SECTION "System"
2020-10-23 20:15:25 +00:00
2021-12-11 01:02:01 +00:00
highlight "Sudoers defaults"
2021-09-21 20:32:35 +00:00
echo 'Defaults editor=/usr/bin/nvim
2021-10-13 18:02:37 +00:00
Defaults env_keep="EDITOR"' |
2021-12-02 22:25:53 +00:00
sudo tee /etc/sudoers.d/editor
2021-10-13 18:02:37 +00:00
echo 'Defaults timestamp_timeout=120
Defaults passwd_timeout=30' |
2021-12-02 22:25:53 +00:00
sudo tee /etc/sudoers.d/timeout
2021-12-11 01:02:01 +00:00
subhighlight "password-free reboot"
2021-11-04 11:14:50 +00:00
echo "$USER ALL = NOPASSWD: /usr/bin/halt, /usr/bin/shutdown, /usr/bin/reboot, /usr/bin/poweroff, /bin/reboot, /bin/shutdown. /usr/bin/umount" |
2021-12-02 22:25:53 +00:00
sudo tee /etc/sudoers.d/shutdown
2020-10-23 20:15:25 +00:00
2021-12-10 23:59:42 +00:00
highlight "Set default user in tty1,2,3"
2022-03-23 12:49:11 +00:00
agetty="$(sudo which agetty)" &&
sudo mkdir -p /etc/systemd/system/getty@tty{1,2,3}.service.d &&
echo "[Service]
Restart=Never
2020-10-16 10:26:56 +00:00
ExecStart=
2022-03-23 12:49:11 +00:00
ExecStart=-$agetty --skip-login --login-options $USER %I" |
2021-12-02 22:25:53 +00:00
sudo tee /etc/systemd/system/getty@tty1.service.d/override.conf /etc/systemd/system/getty@tty2.service.d/override.conf /etc/systemd/system/getty@tty3.service.d/override.conf
2021-01-07 10:17:25 +00:00
2021-11-04 11:14:50 +00:00
highlight "Sysyadm setup"
test -d "/etc/yadm" || sy clone
2020-09-04 10:19:41 +00:00
2021-12-11 01:02:01 +00:00
SECTION "Software"
2022-08-08 20:35:16 +00:00
doomuser="$XDG_CONFIG_HOME/doom/user.el"
test -d "$(dirname "$doomuser")" &&
! test -f "$doomuser" &&
cp -v "$(dirname "$doomuser")/user.template.el" "$doomuser"
2021-11-26 20:32:06 +00:00
link() {
2021-12-14 13:31:05 +00:00
test -e "$2" -o -h "$2" || $($HOME/.local/bin/scripts/checkaccess -w "$2" || echo sudo) ln -sv "$@"
2021-11-26 20:32:06 +00:00
}
2021-11-04 11:14:50 +00:00
2021-11-07 04:56:01 +00:00
mkdir -p .config/audacity
find $HOME -maxdepth 1 -type l -exec file {} + |
2021-12-02 22:25:53 +00:00
grep '.local/share' | grep broken |
sed 's/.* //' | xargs -r mkdir -p
2021-11-07 04:56:01 +00:00
2021-11-26 20:24:24 +00:00
link python /usr/bin/python3
link fdfind /usr/bin/fd
link batcat /usr/bin/bat
2020-06-03 10:39:13 +00:00
2021-11-04 11:14:50 +00:00
highlight "SSH Permissions"
2022-04-11 06:31:13 +00:00
chmod og= $HOME/.ssh -R
2022-08-08 20:35:16 +00:00
test -d "$HOME/.ssh/keys" && chmod a+r $HOME/.ssh/keys/*.pub
2022-04-11 06:31:13 +00:00
_ovpn="$XDG_DATA_HOME/openvpn"
test -d "$_ovpn" &&
sudo rm -vdf /etc/openvpn/client &&
sudo ln -vsf "$_ovpn" /etc/openvpn/client &&
sudo chmod -vR ugo-rwx,ug+rX,u+w "$_ovpn" &&
sudo chown -vR janek:openvpn "$_ovpn"
2021-07-12 08:42:55 +00:00
2021-11-04 11:14:50 +00:00
highlight "Cron"
2021-10-08 10:28:22 +00:00
echo 'cron.* /var/log/cron.log' | sudo tee /etc/rsyslog.d/60-cron.conf
hasService=$(which service 2>/dev/null)
test "$hasService" && sudo service rsyslog restart || sudo systemctl restart rsyslog
test "$hasService" && sudo service cron reload || sudo systemctl reload cronie
2021-11-04 11:14:50 +00:00
highlight "Zsh"
2021-12-02 20:46:38 +00:00
test -n "$ZSH" || export ZSH="${XDG_DATA_HOME:-$HOME/.local/share}/zsh/oh-my-zsh"
2021-12-11 01:02:01 +00:00
mkdir -p "$(dirname $ZSH)"
oldzsh="$XDG_STATE_HOME/zsh/oh-my-zsh" && test ! -d "$ZSH" -a -d "$oldzsh" && mv -vn $oldzsh $ZSH
2021-11-04 11:14:50 +00:00
cloneshallow() {
2021-12-02 22:25:53 +00:00
url=https://github.com/$2/$1.git
dir="${3:-$ZSH/plugins/$1}"
mkdir -p "$(dirname $dir)"
if test -d "$dir"
then git -C "$dir" remote set-url origin $url
else git clone --depth=1 $url "$dir"
fi
2021-11-04 11:14:50 +00:00
}
cloneshallow oh-my-zsh robbyrussell "$ZSH"
cloneshallow powerlevel10k romkatv "$ZSH/themes/powerlevel10k"
cloneshallow fast-syntax-highlighting zdharma-continuum
cloneshallow zsh-autosuggestions zsh-users
cloneshallow zsh-vim-mode softmoth
case "$(grep "^$USER" /etc/passwd | sed 's/.*://')" in (*zsh);; (*) chsh -s $(which zsh);; esac
2021-10-08 10:28:22 +00:00
2021-12-11 01:02:01 +00:00
highlight "Arch"
2020-12-15 20:46:35 +00:00
if test -f /etc/pacman.conf; then
2021-12-11 01:02:01 +00:00
subhighlight "Pacman"
2021-12-02 22:25:53 +00:00
sudo sed -i 's/#Color/Color/' /etc/pacman.conf
sudo sed -i "$(grep -n "\[multilib\]" /etc/pacman.conf | cut -d':' -f1),+1 s/# *//" /etc/pacman.conf
2022-08-08 20:35:16 +00:00
if which reflector 2>/dev/null
then subhighlight "Reflector"
2021-12-02 22:25:53 +00:00
echo "--save /etc/pacman.d/mirrorlist
2022-08-08 20:35:16 +00:00
--protocol https
--country Germany
--latest 50
--score 10
--sort rate" | sudo tee /etc/xdg/reflector/reflector.conf
sudo systemctl start reflector &
sudo systemctl enable reflector.timer
fi
2020-12-15 20:46:35 +00:00
fi
2021-01-07 11:01:57 +00:00
2021-10-08 11:17:27 +00:00
test "$DISPLAY" || exit 0
2021-12-11 01:02:01 +00:00
highlight "Desktop Applications"
2021-10-08 11:17:27 +00:00
2021-12-11 01:02:01 +00:00
subhighlight "Application symlinks"
2021-12-14 13:31:05 +00:00
link .bash_aliases "$HOME/.bashrc"
2022-01-07 17:31:47 +00:00
link "$HOME/.ssh/config" "$XDG_CONFIG_HOME/ssh"
2021-12-14 13:31:05 +00:00
2021-11-04 11:14:50 +00:00
link "$XDG_STATE_HOME/gradle/gradle.properties" "$XDG_CONFIG_HOME/gradle.properties"
link "$XDG_DATA_HOME/applications/signal-tray.desktop" "$XDG_CONFIG_HOME/autostart/"
link "/usr/share/applications/stretchly.desktop" "$XDG_CONFIG_HOME/autostart/"
mx="$HOME/.mixxx"
if ! test -d "$mx"
then mkdir "$mx" && ln -sv -t "$mx" ${XDG_DATA_HOME:-$HOME/.local/share}/mixxx/* ${XDG_CONFIG_HOME:-$HOME/.config}/mixxx/*
fi
2022-08-08 20:35:16 +00:00
#subhighlight "Block internet at night & on weekdays in the morning to force focus"
2022-04-11 06:31:13 +00:00
#walli 22 --save
# TODO netkeeper
2020-09-04 10:19:41 +00:00
2021-12-11 01:02:01 +00:00
subhighlight "Setup kakoune plugin loader"
2021-11-04 11:14:50 +00:00
cloneshallow plug.kak robertmeta "${XDG_CONFIG_HOME:-$HOME/.config}/kak/plugins/plug.kak"