1
0
mirror of https://github.com/elisspace/ArchMatic.git synced 2026-08-29 15:33:47 +00:00
Files
ArchMatic/9-setup.sh
2018-03-23 23:05:52 -06:00

158 lines
4.6 KiB
Bash
Executable File

#!/usr/bin/env bash
#-------------------------------------------------------------------------
# _ _ __ __ _ _
# /_\ _ _ __| |_ | \/ |__ _| |_(_)__
# / _ \| '_/ _| ' \| |\/| / _` | _| / _|
# /_/ \_\_| \__|_||_|_| |_\__,_|\__|_\__|
# Arch Linux Post Install Setup and Config
#-------------------------------------------------------------------------
echo
echo "FINAL SETUP AND CONFIGURATION"
# ------------------------------------------------------------------------
echo
echo "Genaerating .xinitrc file"
# Generate the .xinitrc file so we can launch XFCE from the
# terminal using the "startx" command
cat <<EOF > ${HOME}/.xinitrc
#!/bin/bash
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
source /etc/xdg/xfce4/xinitrc
exit 0
EOF
# ------------------------------------------------------------------------
echo
echo "Updating /bin/startx to use the correct path"
# By default, startx incorrectly looks for the .serverauth file in our HOME folder.
sudo sed -i 's|xserverauthfile=\$HOME/.serverauth.\$\$|xserverauthfile=\$XAUTHORITY|g' /bin/startx
# ------------------------------------------------------------------------
echo
echo "Configuring LTS Kernel as a secondary boot option"
sudo cp /boot/loader/entries/arch.conf /boot/loader/entries/arch-lts.conf
sudo sed -i 's|Arch Linux|Arch Linux LTS Kernel|g' /boot/loader/entries/arch-lts.conf
sudo sed -i 's|vmlinuz-linux|vmlinuz-linux-lts|g' /boot/loader/entries/arch-lts.conf
sudo sed -i 's|initramfs-linux.img|initramfs-linux-lts.img|g' /boot/loader/entries/arch-lts.conf
# ------------------------------------------------------------------------
echo
echo "Configuring MAKEPKG to use all 8 cores"
sudo sed -i -e 's|[#]*MAKEFLAGS=.*|MAKEFLAGS="-j$(nproc)"|g' makepkg.conf
sudo sed -i -e 's|[#]*COMPRESSXZ=.*|COMPRESSXZ=(xz -c -T 8 -z -)|g' makepkg.conf
# ------------------------------------------------------------------------
echo
echo "Configuring vconsole.conf to set a larger font for login shell"
sudo cat <<EOF > /etc/vconsole.conf
KEYMAP=us
FONT=ter-v32b
EOF
# ------------------------------------------------------------------------
echo
echo "Setting laptop lid close to suspend"
sudo sed -i -e 's|[# ]*HandleLidSwitch[ ]*=[ ]*.*|HandleLidSwitch=suspend|g' /etc/systemd/logind.conf
# ------------------------------------------------------------------------
echo
echo "Disabling buggy cursor inheritance"
# When you boot with multiple monitors the cursor can look huge. This fixes it.
sudo cat <<EOF > /usr/share/icons/default/index.theme
[Icon Theme]
#Inherits=Theme
EOF
# ------------------------------------------------------------------------
echo
echo "Increasing file watcher count"
# This prevents a "too many files" error in Visual Studio Code
echo fs.inotify.max_user_watches=524288 | sudo tee /etc/sysctl.d/40-max-user-watches.conf && sudo sysctl --system
# ------------------------------------------------------------------------
echo
echo "Disabling Pulse .esd_auth module"
# Pulse audio loads the `esound-protocol` module, which best I can tell is rarely needed.
# That module creates a file called `.esd_auth` in the home directory which I'd prefer to not be there. So...
sudo sed -i 's|load-module module-esound-protocol-unix|#load-module module-esound-protocol-unix|g' /etc/pulse/default.pa
# ------------------------------------------------------------------------
echo
echo "Enabling bluetooth daemon and setting it to auto-start"
sudo sed -i 's|#AutoEnable=false|AutoEnable=true|g' /etc/bluetooth/main.conf
sudo systemctl enable bluetooth.service
sudo systemctl start bluetooth.service
# ------------------------------------------------------------------------
echo
echo "Enabling the cups service daemon so we can print"
systemctl enable org.cups.cupsd.service
systemctl start org.cups.cupsd.service
# ------------------------------------------------------------------------
echo
echo "Enabling Network Time Protocol so clock will be set via the network"
sudo ntpd -qg
sudo systemctl enable ntpd.service
sudo systemctl start ntpd.service
# ------------------------------------------------------------------------
echo
echo "NETWORK SETUP"
echo
echo "Find your IP Link name:"
echo
ip link
echo
read -p "ENTER YOUR IP LINK: " LINK
echo
echo "Disabling DHCP and enabling Network Manager daemon"
echo
sudo systemctl disable dhcpcd.service
sudo systemctl stop dhcpcd.service
sudo ip link set dev ${LINK} down
sudo systemctl enable NetworkManager.service
sudo systemctl start NetworkManager.service
sudo ip link set dev ${LINK} up
echo "Done!"
echo
echo "Reboot now..."
echo