57 lines
1.5 KiB
Bash
Executable file
57 lines
1.5 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Run this as root to install system-level config from dotfiles.
|
|
# Usage: sudo ./install-system.sh
|
|
|
|
set -e
|
|
|
|
DOTFILES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
if [ "$EUID" -ne 0 ]; then
|
|
echo "please run as root"
|
|
exit 1
|
|
fi
|
|
|
|
backup_and_link() {
|
|
local src="$1"
|
|
local dst="$2"
|
|
|
|
mkdir -p "$(dirname "$dst")"
|
|
|
|
if [ -L "$dst" ]; then
|
|
echo "already a symlink, skipping: $dst"
|
|
return
|
|
fi
|
|
|
|
if [ -e "$dst" ]; then
|
|
echo "backing up: $dst -> $dst.bak"
|
|
mv "$dst" "$dst.bak"
|
|
fi
|
|
|
|
echo "linking: $dst -> $src"
|
|
ln -s "$src" "$dst"
|
|
}
|
|
|
|
# Touchpad palm detection
|
|
backup_and_link "$DOTFILES/config/xorg.conf.d/70-touchpad.conf" "/etc/X11/xorg.conf.d/70-touchpad.conf"
|
|
|
|
# Kanata key remapper
|
|
backup_and_link "$DOTFILES/config/kanata/rc.kanata" "/etc/rc.d/rc.kanata"
|
|
chmod +x /etc/rc.d/rc.kanata
|
|
|
|
# NetworkManager wifi power saving fix
|
|
backup_and_link "$DOTFILES/config/NetworkManager/wifi-powersave-off.conf" "/etc/NetworkManager/conf.d/wifi-powersave-off.conf"
|
|
|
|
if ! grep -q "rc.kanata" /etc/rc.d/rc.local; then
|
|
echo "" >> /etc/rc.d/rc.local
|
|
echo "# Start kanata key remapper" >> /etc/rc.d/rc.local
|
|
echo "if [ -x /etc/rc.d/rc.kanata ]; then" >> /etc/rc.d/rc.local
|
|
echo " /etc/rc.d/rc.kanata start" >> /etc/rc.d/rc.local
|
|
echo "fi" >> /etc/rc.d/rc.local
|
|
echo "added kanata to rc.local"
|
|
else
|
|
echo "rc.local already has kanata entry, skipping"
|
|
fi
|
|
|
|
echo ""
|
|
echo "done. reboot or restart X for xorg changes to take effect."
|