dotfiles/.local/arch/init.sh

208 lines
5.8 KiB
Bash
Raw Permalink Normal View History

2019-05-28 17:44:30 +02:00
#!/bin/bash -e
# Enable multilib & add extra repos {{{
2019-05-28 17:44:30 +02:00
sudo cp /etc/pacman.conf{,.bak}
sudo sed -i /etc/pacman.conf \
-e 's/^#\(Color\)/\1\nILoveCandy/' \
-e '/\[multilib\]/,/Include/s/^#//' \
2021-02-07 18:28:14 +01:00
-e '$ a \n[chaotic-aur]\nInclude = /etc/pacman.d/chaotic-mirrorlist'
2019-05-28 17:44:30 +02:00
# }}}
# Update system and install basic packages {{{
2021-11-20 09:25:12 +01:00
CHAOTIC='https://cdn-mirror.chaotic.cx/chaotic-aur'
2019-05-28 17:44:30 +02:00
sudo pacman-key --init
sudo pacman-key --populate archlinux
2020-03-23 12:23:14 +01:00
sudo pacman-key --refresh-keys
2021-11-20 09:25:12 +01:00
sudo pacman -U "$CHAOTIC"/chaotic-{keyring,mirrorlist}.pkg.tar.zst
sudo pacman -Syyu --noconfirm
2021-02-07 18:28:14 +01:00
sudo pacman -S git aria2 yay --noconfirm
2021-11-20 09:25:12 +01:00
unset CHAOTIC
2019-10-30 10:01:14 +01:00
# }}}
# Clone dotfiles {{{
2022-01-19 12:47:45 +01:00
git clone https://git.disroot.org/PKGBUILDS/dotfiles-alfunx-git \
/tmp/dotfiles-alfunx-git --depth=1
(cd /tmp/dotfiles-alfunx-git; makepkg -sic)
rm -rf /tmp/dotfiles-alfunx-git
2019-10-30 10:01:14 +01:00
dotfiles clone https://github.com/ObserverOfTime/home.files \
2021-02-07 18:28:14 +01:00
"${XDG_DATA_HOME:=$HOME/.local/share}/dotfiles"
dotfiles checkout --force
2022-01-19 12:47:45 +01:00
dotfiles submodule update --init
2019-05-28 17:44:30 +02:00
# }}}
# Use aria2 for makepkg & set packager {{{
NAME="$(getent passwd "$USER" | awk -F'[:,]' '{print $5}')"
2021-02-07 18:28:14 +01:00
PACKAGER="${NAME:=ObserverOfTime} <chronobserver@disroot.org>"
2021-11-20 09:25:12 +01:00
ARIA='/usr/bin/aria2c --conf-path=/etc/aria2.conf -o %o %u'
2019-05-28 17:44:30 +02:00
sudo tee /etc/aria2.conf >/dev/null <<EOF
summary-interval=0
file-allocation=none
split=4
2020-03-23 12:23:14 +01:00
continue=true
follow-metalink=mem
2021-02-07 18:28:14 +01:00
metalink-location=gr,de,us,fr,it
2020-03-23 12:23:14 +01:00
metalink-preferred-protocol=https
2019-05-28 17:44:30 +02:00
EOF
sudo cp /etc/makepkg.conf{,.bak}
sudo sed -i /etc/makepkg.conf \
2021-11-20 09:25:12 +01:00
-e "s#'ftp::.*'#'ftp::$ARIA'#" \
-e "s#'http::.*'#'http::$ARIA'#" \
-e "s#'https::.*'#'https::$ARIA'#" \
2019-10-30 10:01:14 +01:00
-e "s/^#PACKAGER.*/PACKAGER='$PACKAGER'/"
2021-02-07 18:28:14 +01:00
unset NAME PACKAGER ARIA
2019-05-28 17:44:30 +02:00
# }}}
2021-02-07 18:28:14 +01:00
# Disable wine file associations {{{
sudo tee /etc/pacman.d/hooks/wine.hook >/dev/null <<EOF
[Trigger]
Operation = Install
Operation = Upgrade
Type = File
Target = usr/share/wine/wine.inf
[Action]
Description = Disabling wine menu builder...
When = PostTransaction
Exec = /bin/sed -i /usr/share/wine/wine.inf \
-e 's/winemenubuilder.exe -a -r/winemenubuilder.exe -r/'
EOF
# }}}
# Install packages via yay {{{
xargs <~/.local/arch/packages.repo.txt \
yay -S --repo --needed --noconfirm
xargs <~/.local/arch/packages.aur.txt \
yay -S --aur --needed --noconfirm
2019-05-28 17:44:30 +02:00
# }}}
# Install bash completions {{{
2020-03-23 12:23:14 +01:00
DIRECTORY="${XDG_DATA_HOME:=$HOME/.local/share}/bash/completions"
2019-11-11 18:44:44 +01:00
declare -A ALIASES=(
[adb]=android
[emulator]=android
[fastboot]=android
[clang++]=clang
[ffprobe]=ffmpeg
[goapp]=go
[godoc]=go
[gradlew]=gradle
)
aria2c -d "$DIRECTORY" -i - <<EOF
https://raw.githubusercontent.com/mbrubeck/android-completion/master/android
https://raw.githubusercontent.com/clerk67/ffmpeg-completion/master/ffmpeg
https://raw.githubusercontent.com/gradle/gradle-completion/master/gradle-completion.bash
2019-11-11 18:44:44 +01:00
out=gradle
https://raw.githubusercontent.com/omakoto/go-completion.bash/master/go-completion.bash
2019-11-11 18:44:44 +01:00
out=go
https://raw.githubusercontent.com/llvm-mirror/clang/master/utils/bash-autocomplete.sh
2019-11-11 18:44:44 +01:00
out=clang
EOF
2021-11-20 09:25:12 +01:00
printf '\ncomplete -o default -F _ffmpeg ffprobe\n' >> "$DIRECTORY/ffmpeg"
printf '\ncomplete -o default -F _clang clang++\n' >> "$DIRECTORY/clang"
2019-11-11 18:44:44 +01:00
for key in "${!ALIASES[@]}"; do
ln -fvs "$DIRECTORY/${ALIASES[$key]}" "$DIRECTORY/$key"
done
pandoc --bash-completion > "$DIRECTORY/pandoc"
poetry completions bash > "$DIRECTORY/poetry"
2019-11-24 15:50:07 +01:00
ln -fvs /usr/share/fzf/completion.bash "$DIRECTORY/fzf"
unset DIRECTORY ALIASES
2019-05-28 17:44:30 +02:00
# }}}
# Configure grub {{{
THEME=/boot/grub/themes/Lain
git clone https://git.disroot.org/chronobserver/grub2-theme-lain \
/tmp/grub2-theme-lain --depth=1
rm -rf /tmp/grub2-theme-lain/{.git*,README.md}
sudo cp -r /tmp/grub2-theme-lain "$THEME"
2019-05-28 17:44:30 +02:00
sudo cp /etc/default/grub{,.bak}
sudo tee /etc/default/grub >/dev/null <<EOF
GRUB_DEFAULT=0
2020-07-15 17:51:59 +02:00
GRUB_TIMEOUT=5
2019-05-28 17:44:30 +02:00
GRUB_DISTRIBUTOR="Arch"
2020-03-23 12:23:14 +01:00
GRUB_CMDLINE_LINUX_DEFAULT="profile ipv6.disable=1"
2019-05-28 17:44:30 +02:00
GRUB_CMDLINE_LINUX=""
GRUB_TERMINAL_INPUT=console
GRUB_GFXMODE=1600x1200x24
GRUB_GFXPAYLOAD_LINUX=keep
GRUB_DISABLE_SUBMENU=true
GRUB_THEME=$THEME/theme.txt
# vim:ft=cfg:
2019-05-28 17:44:30 +02:00
EOF
sudo cp /boot/grub/grub.cfg{,.bak}
sudo grub-mkconfig -o /boot/grub/grub.cfg
unset URL THEME SWAP
# }}}
# Configure SDDM {{{
git clone https://git.disroot.org/chronobserver/sddm-patema \
/tmp/sddm-patema --depth=1
rm -rf /tmp/sddm-patema/{.git*,README.md}
sudo cp -r /tmp/sddm-patema /usr/share/sddm/themes/patema
2020-03-23 12:23:14 +01:00
sudo mkdir -p /etc/sddm.conf.d
sudo tee "$_/theme.conf" >/dev/null <<< $'[Theme]\nCurrent=patema'
2019-05-28 17:44:30 +02:00
# }}}
2019-11-24 15:50:07 +01:00
# Make maven use XDG_CACHE_HOME {{{
sudo sed -i /opt/maven/conf/settings.xml \
-e "\%xsi:schema%a \\
<localRepository>\\
\${env.XDG_CACHE_HOME}/maven/repository\\
</localRepository>"
# }}}
2019-05-28 17:44:30 +02:00
# Setup neovim {{{
2022-10-29 00:27:38 +02:00
nvim --headless -c \
'autocmd User PackerComplete qa' \
-c 'PackerSync' >/dev/null
2021-02-07 18:28:14 +01:00
sudo ln -s /usr/bin/nvim /usr/local/bin/vi
sudo ln -s /usr/bin/nvim /usr/local/bin/vim
2019-05-28 17:44:30 +02:00
# }}}
2021-02-07 18:28:14 +01:00
# Create wrapper scripts {{{
sudo tee /usr/local/bin/jarwrapper >/dev/null <<'EOF'
#!/bin/sh
2019-05-28 17:44:30 +02:00
2021-02-07 18:28:14 +01:00
exec "${JAVA_HOME:-/usr/lib/jvm/default}/bin/java" -jar "$@"
2020-07-15 17:51:59 +02:00
EOF
2021-02-07 18:28:14 +01:00
sudo tee /usr/local/bin/sqlite3 >/dev/null <<'EOF'
#!/bin/sh
2020-07-15 17:51:59 +02:00
2021-02-07 18:28:14 +01:00
exec env \
SQLITE_HISTORY="${XDG_CACHE_HOME:-$HOME}/.sqlite_history" \
/usr/bin/sqlite3 "$@"
EOF
sudo tee /usr/local/bin/wget >/dev/null <<'EOF'
#!/bin/sh
2020-07-15 17:51:59 +02:00
2021-02-07 18:28:14 +01:00
exec /usr/bin/wget "$@" \
--hsts-file="${XDG_CACHE_HOME:-$HOME}/.wget-hsts"
2019-05-28 17:44:30 +02:00
EOF
2021-02-22 17:41:12 +01:00
sudo chmod +x /usr/local/bin/{jarwrapper,sqlite3,wget}
2019-05-28 17:44:30 +02:00
# }}}
2021-02-07 18:28:14 +01:00
# Configure binfmt {{{
sudo tee /etc/binfmt.d/jar.conf >/dev/null \
<<< ':JAR:E::jar::/usr/local/bin/jarwrapper:'
sudo ln -s /etc/binfmt.d/wine.conf /dev/null
# }}}
# Set user dirs {{{
2021-02-07 18:28:14 +01:00
mkdir -p "$HOME"/.local/{templates,public}
2020-03-23 12:23:14 +01:00
xdg-user-dirs-update --set TEMPLATES "$HOME/.local/templates"
xdg-user-dirs-update --set PUBLICSHARE "$HOME/.local/public"
# }}}
2019-05-28 17:44:30 +02:00
# Set tty font {{{
sudo tee /etc/vconsole.conf >/dev/null <<'EOF'
KEYMAP=us
2020-07-15 17:51:59 +02:00
FONT=ter-v22n
2019-05-28 17:44:30 +02:00
FONT_MAP=8859-2
EOF
sudo sed -i /etc/mkinitcpio.conf \
-re 's/(^HOOKS="[^"]*)"/\1 consolefont"/'
2021-11-20 09:25:12 +01:00
sudo mkinitcpio -p linux-tkg-pds
2019-05-28 17:44:30 +02:00
# }}}
# vim:fdm=marker:fdl=0: