fixes/after.sh
2026-10-03 08:25:22 +03:00

197 lines
No EOL
5.9 KiB
Bash

#!/bin/bash
set -e
read -rp "Enter your username: " USERNAME
if ! id "$USERNAME" &>/dev/null; then
echo "Error: user '$USERNAME' does not exist."
exit 1
fi
USER_HOME="/home/$USERNAME"
# ─────────────────────────────────────
# Misc
# ─────────────────────────────────────
# PACMAN LOVES CANDY
grep -qxF 'ILoveCandy' /etc/pacman.conf || \
sed -i '/^# Misc options/a ILoveCandy' /etc/pacman.conf
# DISABLE KWALLETD
mkdir -p "$USER_HOME/.config"
cat > "$USER_HOME/.config/kwalletrc" <<'EOF'
[Wallet]
Enabled=false
EOF
# ENABLE DOLPHIN STORAGE INFO
kwriteconfig6 \
--file "$USER_HOME/.config/dolphinrc" \
--group General \
--key ShowStatusBar \
FullWidth
# CONFIGURE KEYBOARD LAYOUTS
cat > "$USER_HOME/.config/kxkbrc" <<'EOF'
[Layout]
DisplayNames=,
LayoutList=us,lt
Use=true
VariantList=,
EOF
# ─────────────────────────────────────
# Install yay
# ─────────────────────────────────────
pacman -S --needed --noconfirm git base-devel
su - "$USERNAME" <<'EOF'
git clone https://aur.archlinux.org/yay-bin.git
cd yay-bin
makepkg -si --noconfirm
yay -S --needed --noconfirm --removemake zsh-theme-powerlevel10k ttf-meslo-nerd-font-powerlevel10k coolercontrol-bin \
mangojuice-bin heroic-games-launcher-bin polymc-qt5-bin open-video-downloader-bin brave-bin onlyoffice-bin \
zenpower5-dkms-git zenergy-dkms-git
EOF
# ─────────────────────────────────────
# Configure Konsole
# ─────────────────────────────────────
mkdir -p "$USER_HOME/.local/share/konsole"
cat > "$USER_HOME/.local/share/konsole/ZSH_Profile.profile" <<'EOF'
[Appearance]
Font=MesloLGS NF,10,-1,5,400,0,0,0,0,0,0,0,0,0,0,1,,0,0
[Cursor Options]
CursorShape=1
[General]
Name=ZSH Profile
Parent=FALLBACK/
[Terminal Features]
AnimatingCursorEnabled=true
BlinkingCursorEnabled=true
EOF
# Set the profile as default
kwriteconfig6 \
--file "$USER_HOME/.config/konsolerc" \
--group "Desktop Entry" \
--key "DefaultProfile" \
"ZSH_Profile.profile"
# ─────────────────────────────────────
# ZSH
# ─────────────────────────────────────
chsh -s /bin/zsh "$USERNAME"
cat > "$USER_HOME/.zshrc" <<'EOF'
# ─────────────────────────────────────
# Powerlevel10k
# ─────────────────────────────────────
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
# ─────────────────────────────────────
# Plugins
# ─────────────────────────────────────
# Autosuggestions
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
# Syntax highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# ─────────────────────────────────────
# Powerlevel10k configuration
# ─────────────────────────────────────
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# ─────────────────────────────────────
# Completion
# ─────────────────────────────────────
autoload -Uz compinit
compinit
setopt CORRECT
setopt AUTO_CD
zstyle ':completion:*' completer _complete _approximate
zstyle ':completion:*' menu select
# ─────────────────────────────────────
# History
# ─────────────────────────────────────
HISTFILE="$HOME/.zsh_history"
SAVEHIST=10000
setopt APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
# ─────────────────────────────────────
# Manual to pdf
# ─────────────────────────────────────
manual() {
local pdf
pdf=$(mktemp --suffix=.pdf) || return 1
if ! man -Tpdf "$1" > "$pdf" 2>/dev/null; then
rm -f "$pdf"
echo "No manual entry for $1"
return 1
fi
okular "$pdf"
rm -f "$pdf"
}
EOF
# Make everything we created belong to the user
chown -R "$USERNAME:$USERNAME" "$USER_HOME"
# ─────────────────────────────────────
# Grub
# ─────────────────────────────────────
# Enable windblows / other OS detection
sed -i 's/^#\?GRUB_DISABLE_OS_PROBER=.*/GRUB_DISABLE_OS_PROBER=false/' /etc/default/grub
#grub-mkconfig -o /boot/grub/grub.cfg
# ─────────────────────────────────────
# Install grub theme
# ─────────────────────────────────────
su - "$USERNAME" <<'EOF'
curl -O https://git.baltrust.eu.org/Baltrust/fixes/raw/branch/main/Graphite-grub2-theme.tar.xz
tar -xf Graphite-grub2-theme.tar.xz && rm Graphite-grub2-theme.tar.xz
cd grub2
./install.sh
cd "$OLDPWD"
EOF
rm after.sh
exit 0