archcraft-xfce/profile/airootfs/root/customize_airootfs.sh

142 lines
4.1 KiB
Bash
Executable File

#!/usr/bin/env bash
## Script to perform several important tasks before `mkarchcraftiso` create filesystem image.
set -e -u
## -------------------------------------------------------------- ##
## Fix Initrd Generation in Installed System
cat > "/etc/mkinitcpio.d/linux.preset" <<- _EOF_
# mkinitcpio preset file for the 'linux' package
ALL_kver="/boot/vmlinuz-linux"
ALL_config="/etc/mkinitcpio.conf"
PRESETS=('default' 'fallback')
#default_config="/etc/mkinitcpio.conf"
default_image="/boot/initramfs-linux.img"
#default_options=""
#fallback_config="/etc/mkinitcpio.conf"
fallback_image="/boot/initramfs-linux-fallback.img"
fallback_options="-S autodetect"
_EOF_
## -------------------------------------------------------------- ##
## Enable Parallel Downloads
sed -i -e 's|#ParallelDownloads.*|ParallelDownloads = 5|g' /etc/pacman.conf
sed -i -e '/#\[testing\]/Q' /etc/pacman.conf
## Append archcraft repository to pacman.conf
cat >> "/etc/pacman.conf" <<- EOL
[archcraft]
SigLevel = Optional TrustAll
Include = /etc/pacman.d/archcraft-mirrorlist
#[testing]
#Include = /etc/pacman.d/mirrorlist
[core]
Include = /etc/pacman.d/mirrorlist
[extra]
Include = /etc/pacman.d/mirrorlist
#[community-testing]
#Include = /etc/pacman.d/mirrorlist
[community]
Include = /etc/pacman.d/mirrorlist
# If you want to run 32 bit applications on your x86_64 system,
# enable the multilib repositories as required here.
#[multilib-testing]
#Include = /etc/pacman.d/mirrorlist
#[multilib]
#Include = /etc/pacman.d/mirrorlist
# An example of a custom package repository. See the pacman manpage for
# tips on creating your own repositories.
#[custom]
#SigLevel = Optional TrustAll
#Server = file:///home/custompkgs
EOL
## -------------------------------------------------------------- ##
## Copy Few Configs Into Root Dir
rdir="/root/.config"
sdir="/etc/skel"
if [[ ! -d "$rdir" ]]; then
mkdir "$rdir"
fi
rconfig=(geany gtk-3.0 Kvantum neofetch qt5ct ranger Thunar xfce4)
for cfg in "${rconfig[@]}"; do
if [[ -e "$sdir/.config/$cfg" ]]; then
cp -rf "$sdir"/.config/"$cfg" "$rdir"
fi
done
rcfg=('.oh-my-zsh' '.vim_runtime' '.vimrc' '.zshrc')
for cfile in "${rcfg[@]}"; do
if [[ -e "$sdir/$cfile" ]]; then
cp -rf "$sdir"/"$cfile" /root
fi
done
## -------------------------------------------------------------- ##
## Fix wallpaper in xfce
mv /usr/share/backgrounds/xfce/xfce-verticals.png /usr/share/backgrounds/xfce/xfce_verticals.png
cp -rf /usr/share/backgrounds/default.jpg /usr/share/backgrounds/xfce/xfce-verticals.png
## -------------------------------------------------------------- ##
## Copy Calamares to Desktop
_desktop="/home/liveuser/Desktop"
if [[ ! -d "${_desktop}" ]]; then
mkdir -p "${_desktop}"
fi
cp /usr/share/applications/calamares.desktop "${_desktop}"
chown -R liveuser:users "${_desktop}"
chmod +x "${_desktop}"/calamares.desktop
## -------------------------------------------------------------- ##
## Set `Qogirr` as default cursor theme
sed -i -e 's|Inherits=.*|Inherits=Qogirr|g' /usr/share/icons/default/index.theme
## Update xdg-user-dirs for bookmarks in thunar and pcmanfm
runuser -l liveuser -c 'xdg-user-dirs-update'
runuser -l liveuser -c 'xdg-user-dirs-gtk-update'
xdg-user-dirs-update
xdg-user-dirs-gtk-update
## -------------------------------------------------------------- ##
## Hide Unnecessary Apps
adir="/usr/share/applications"
apps=(avahi-discover.desktop bssh.desktop bvnc.desktop echomixer.desktop \
envy24control.desktop exo-preferred-applications.desktop feh.desktop \
hdajackretask.desktop hdspconf.desktop hdspmixer.desktop hwmixvolume.desktop lftp.desktop \
libfm-pref-apps.desktop lxshortcut.desktop lstopo.desktop \
networkmanager_dmenu.desktop nm-connection-editor.desktop pcmanfm-desktop-pref.desktop \
qv4l2.desktop qvidcap.desktop stoken-gui.desktop stoken-gui-small.desktop thunar-bulk-rename.desktop \
thunar-settings.desktop thunar-volman-settings.desktop yad-icon-browser.desktop)
for app in "${apps[@]}"; do
if [[ -e "$adir/$app" ]]; then
sed -i '$s/$/\nNoDisplay=true/' "$adir/$app"
fi
done
## -------------------------------------------------------------- ##