Skip to content

Instantly share code, notes, and snippets.

@themaxhero
Last active May 10, 2021 02:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themaxhero/60ffe9bf185ebac8e88003197317f817 to your computer and use it in GitHub Desktop.
Save themaxhero/60ffe9bf185ebac8e88003197317f817 to your computer and use it in GitHub Desktop.
Archlinux Install Script with Customizations
#!/bin/bash
aur_packages=(
aic94xx-firmware
wd719x-firmware
peazip-qt-bin
nordic-theme-git
nordic-theme-kde-git
)
system_base_packages=(
base-devel
linux{-headers,-lts,-lts-headers,-firmware,-tkg-pds-skylake,-tkg-pds-skylake-headers}
multilib-devel
arch-install-scripts
git
man{,-pages}
sudo
yay
ibus-mozc
intel-ucode
htop
xdg-utils
)
network_and_ssh_packages=(
libpam-google-authenticator
rsync
aria2
tmux
networkmanager{,-openvpn}
openssh
bridge-utils
traceroute
nmap
tor
inetutils
hostapd
sshfs
wget
aria2
bluez{,-plugins,-utils}
qbittorrent
easy-rsa
)
boot_and_fs_packages=(
efibootmgr
refind
os-prober
ntfs-3g
{m,dosfs}tools
{exfat-,usb}utils
gvfs-mtp
android-udev-git
)
sound_packages=(
pulseaudio-{alsa,bluetooth,jack}
alsa-utils
android-sdk-platform-tools
ddclient
dnsmasq
ca-certificates-icp_br
pavucontrol
paprefs
jack2
jack_capture
cadence
)
shells_and_text_editors_packages=(
dash
fish
emacs
neovim{,-drop-in,-plug}
alacritty
)
graphics_packages=(
{,lib32-}mesa
{,lib32-}libva
intel-media-driver
{,lib32-}vulkan-icd-loader
{,lib32-}vulkan-radeon
)
games_related_packages=(
dxvk-mingw-git
libretro
retroarch-assets-xmb
{,lib32-}faudio
steam
steam-native-runtime
wine{_gecko,-mono,-tkg-staging-fsync-git}
xf86-input-libinput
proton-tkg-git
)
comunication_packages=(
discord
telegram-desktop
keybase
kbfs
)
window_manager_packages=(
i3{-gaps,lock,status}
rofi
sddm
)
theming_packages=(
breeze{,-gtk,-icons}
sddm-theme-aerial-git
yeecli
qt5ct
qtcurve-qt5
ocs-url
)
office_packages=(
wps-office{,-mui-pt-br,-extension-portuguese-brazilian-dictionary}
hunspell-{en_US,pt-br}
)
multimedia_packages=(
mpv
audacious{,-plugins}
gst-libav
kodi
spotify
youtube-dl
nomacs
)
remote_access_packages=(
vinagre
)
virtual_machine_packages=(
qemu
)
development_tools_packages=(
dbeaver
gdb
editorconfig-core-c
scrcpy-git
python-{pip,pynvim}
)
fonts_packages=(
gnu-free-fonts
otf{-font-awesome,-ipafont}
gnome-icon-theme
ttf-{liberation,ms-fonts,ubuntu-font-family,wps-fonts,hanazono,sazanami,baekmuk,dejavu,droid,fira-{code,mono,sans}}
adobe-source-han-sans-{jp,kr}-fonts
)
browser_packages=(
brave
firefox
firefox-ublock-origin
)
other_packages=(
un{rar,zip}
p7zip
xdg-desktop-portal
unityhub
lxappearance
thunar
)
export locales=('en_US' 'ja_JP' 'pt_BR')
export keyboard_layout='br-abnt2'
export timezone='America/Sao_Paulo'
#export kernel_params=(
# 'initrd=intel-ucode.img'
# 'intel_iommu=on'
# 'noibrs'
# 'noibpb'
# 'nopti'
# 'nospectre_v2'
# 'nospectre_v1'
# 'l1tf=off'
# 'nospec_store_bypass_disable'
# 'no_stf_barrier'
# 'mds=off'
# 'mitigations=off'
# 'radeon.cik_support=0'
# 'radeon.si_support=0'
# 'amdgpu.si_support=1'
# 'amdgpu.cik_support=1'
# 'amdgpu.dpm=1'
# 'amdgpu.dc=1'
# 'modprobe.blacklist=radeon'
# 'module_blacklist=radeon'
# 'rw'
#)
export kernel_params=()
export hooks=(
base
udev
autodetect
keyboard
keymap
modconf
block
encrypt
lvm2
filesystems
fsck
)
export services=(
NetworkManager
sddm
sshd
)
export SSH_PORT=49970
export SDDM_THEME=aerial
export KDE_THEME=Nordic
export GTK_THEME=Nordic
export default_kernel=linux-tkg-pds-skylake
export boot_timeout=4
export BOOT_SIZE=512M
export SWAP=0
export SWAP_SIZE=4G
export rootmnt=/mnt
export username=maxhero
export hostname=maxhero-lnx
export packages=(
"${system_base_packages[@]}"
"${network_and_ssh_packages[@]}"
"${boot_and_fs_packages[@]}"
"${sound_packages[@]}"
"${shells_and_text_editors_packages[@]}"
"${graphics_packages[@]}"
"${games_related_packages[@]}"
"${comunication_packages[@]}"
"${window_manager_packages[@]}"
"${theming_packages[@]}"
"${office_packages[@]}"
"${multimedia_packages[@]}"
"${remote_access_packages[@]}"
"${virtual_machine_packages[@]}"
"${development_tools_packages[@]}"
"${fonts_packages[@]}"
"${browser_packages[@]}"
"${other_packages[@]}"
)
export hooks_line="HOOKS=(${hooks[@]})"
#!bin/bash
set -o errexit
DISK_SIZES=($(df --total | awk 'NR>1 { print $1 $4/1024 }'))
VOLUMES=($(lsblk -npo KNAME | grep -v 'loop\|sr'))
SIZES=($(lsblk -npo KNAME,SIZE | grep -v 'loop\|sr' | awk 'BEGIN {FS=" "}; {print $2}'))
COUNT=$(lsblk -n | grep -v 'loop\|sr' | wc -l)
MENULIST=()
for i in $(seq 0 $(expr $COUNT - 1)); do
MENULIST+=(${VOLUMES[i]} ${SIZES[i]})
done
allright=1
root_password=0
root_password_confirmation=1
password=0
password_confirmation=1
boot_disk_dialog(){
boot_disk=$(whiptail \
--nocancel \
--title "Disk Setup" \
--menu \
"Select boot disk" 22 88 \
${#VOLUMES[@]} \
${MENULIST[@]} \
3>&1 1>&2 2>&3)
clear
}
root_disk_dialog(){
root_disk=$(whiptail \
--nocancel \
--title "Disk Setup" \
--menu \
"Select root disk" 22 88 \
${#VOLUMES[@]} \
${MENULIST[@]}\
3>&1 1>&2 2>&3)
clear
}
separated_partition_for_home_dialog(){
separated_partition_for_home=$(whiptail \
--title "Disk Setup" \
--yesno \
"Do you want to mount /home in a separated partition?" 22 88\
3>&1 1>&2 2>&3)
}
home_disk_dialog(){
home_disk=$(whiptail \
--nocancel \
--title "Disk Setup" \
--menu \
"Select home disk" 22 88 \
${#VOLUMES[@]} \
${MENULIST[@]}\
3>&1 1>&2 2>&3)
clear
}
root_password_and_password_confirmation_dialogs(){
root_password=$(whiptail \
--title "Security Setting" \
--passwordbox \
"Please, enter the root password: " 22 88 \
3>&1 1>&2 2>&3)
clear
root_password_confirmation=$(whiptail \
--title "Security Setting" \
--passwordbox \
"Please, confirm the root password: " 22 88 \
3>&1 1>&2 2>&3)
clear
}
user_password_and_password_confirmation_dialogs(){
password=$(whiptail \
--title "User Settings" \
--passwordbox \
"Please, enter the password for ${username}: " 22 88 \
3>&1 1>&2 2>&3)
clear
password_confirmation=$(whiptail \
--title "User Settings" \
--passwordbox \
"Please, confirm the password for ${username}: " 22 88 \
3>&1 1>&2 2>&3)
clear
}
define_partition_settings(){
swap_part=`[ $boot_disk = $root_disk ] && echo -e 2 || echo -e 1`
root_part=`[ $boot_disk = $root_disk ] && echo -e 3 || echo -e 2`
tgt_boot_partition="${boot_disk}1"
tgt_root_partition="${root_disk}${root_part}"
swap_partition="${root_disk}${swap_part}"
}
allright_dialog(){
if (whiptail --title "Confirm Setup" --yesno "Boot will be on ${tgt_boot_partition}\nRoot will be on ${tgt_root_partition}\nSwap will be on ${swap_partition}\n\nIs that correct?" 22 88); then
allright=0
else
allright=1
fi
}
passwords_not_match_dialog(){
whiptail \
--title "Passwords does not match" \
--msgbox "Password and Password Confirmation does not match." 8 78
}
user_passwords_does_not_match_dialog(){
if [ $password -ne $password_confirmation ]; then
passwords_not_match_dialog
fi
}
root_passwords_does_not_match_dialog(){
if [ $root_password -ne $root_password_confirmation ]; then
passwords_not_match_dialog
fi
}
ask_for_root_password(){
while [ $root_password -ne $root_password_confirmation ]; do
root_password_and_password_confirmation_dialogs
root_passwords_does_not_match_dialog
done
}
ask_for_user_password(){
while [ $password -ne $password_confirmation ]; do
user_password_and_password_confirmation_dialogs
user_passwords_does_not_match_dialog
done
}
get_user_settings(){
while [ $allright -ne 0 ]; do
boot_disk_dialog
root_disk_dialog
ask_for_root_password
ask_for_user_password
define_partition_settings
allright_dialog
done
}
get_user_settings
export tgt_boot_partition
export tgt_root_partition
export swap_partition
export root_password
export root_password_confirmation
export password
export password_confirmation
export root_disk
#!bin/bash
set -o errexit
DISK_SIZES=($(df --total | awk 'NR>1 { print $1 $4/1024 }'))
VOLUMES=($(lsblk -npo KNAME | grep -v 'loop\|sr'))
SIZES=($(lsblk -npo KNAME,SIZE | grep -v 'loop\|sr' | awk 'BEGIN {FS=" "}; {print $2}'))
COUNT=$(lsblk -n | grep -v 'loop\|sr' | wc -l)
MENULIST=()
for i in $(seq 0 $(expr $COUNT - 1)); do
MENULIST+=(${VOLUMES[i]} ${SIZES[i]})
done
allright=1
root_password=0
root_password_confirmation=1
password=0
password_confirmation=1
boot_disk_dialog(){
boot_disk=$(whiptail \
--nocancel \
--title "Disk Setup" \
--menu \
"Select boot disk" 22 88 \
${#VOLUMES[@]} \
${MENULIST[@]} \
3>&1 1>&2 2>&3)
clear
}
root_disk_dialog(){
root_disk=$(whiptail \
--nocancel \
--title "Disk Setup" \
--menu \
"Select root disk" 22 88 \
${#VOLUMES[@]} \
${MENULIST[@]}\
3>&1 1>&2 2>&3)
clear
}
separated_partition_for_home_dialog(){
separated_partition_for_home=$(whiptail \
--title "Disk Setup" \
--yesno \
"Do you want to mount /home in a separated partition?" 22 88\
3>&1 1>&2 2>&3)
}
home_disk_dialog(){
home_disk=$(whiptail \
--nocancel \
--title "Disk Setup" \
--menu \
"Select home disk" 22 88 \
${#VOLUMES[@]} \
${MENULIST[@]}\
3>&1 1>&2 2>&3)
clear
}
root_password_and_password_confirmation_dialogs(){
root_password=$(whiptail \
--title "Security Setting" \
--passwordbox \
"Please, enter the root password: " 22 88 \
3>&1 1>&2 2>&3)
clear
root_password_confirmation=$(whiptail \
--title "Security Setting" \
--passwordbox \
"Please, confirm the root password: " 22 88 \
3>&1 1>&2 2>&3)
clear
}
user_password_and_password_confirmation_dialogs(){
password=$(whiptail \
--title "User Settings" \
--passwordbox \
"Please, enter the password for ${username}: " 22 88 \
3>&1 1>&2 2>&3)
clear
password_confirmation=$(whiptail \
--title "User Settings" \
--passwordbox \
"Please, confirm the password for ${username}: " 22 88 \
3>&1 1>&2 2>&3)
clear
}
define_partition_settings(){
swap_part=`[ $boot_disk = $root_disk ] && echo -e 2 || echo -e 1`
root_part=`[ $boot_disk = $root_disk ] && echo -e 3 || echo -e 2`
tgt_boot_partition="${boot_disk}1"
tgt_root_partition="${root_disk}${root_part}"
swap_partition="${root_disk}${swap_part}"
}
allright_dialog(){
if (whiptail --title "Confirm Setup" --yesno "Boot will be on ${tgt_boot_partition}\nRoot will be on ${tgt_root_partition}\nSwap will be on ${swap_partition}\n\nIs that correct?" 22 88); then
allright=0
else
allright=1
fi
}
passwords_not_match_dialog(){
whiptail \
--title "Passwords does not match" \
--msgbox "Password and Password Confirmation does not match." 8 78
}
user_passwords_does_not_match_dialog(){
if [ $password -ne $password_confirmation ]; then
passwords_not_match_dialog
fi
}
root_passwords_does_not_match_dialog(){
if [ $root_password -ne $root_password_confirmation ]; then
passwords_not_match_dialog
fi
}
ask_for_root_password(){
while [ $root_password -ne $root_password_confirmation ]; do
root_password_and_password_confirmation_dialogs
root_passwords_does_not_match_dialog
done
}
ask_for_user_password(){
while [ $password -ne $password_confirmation ]; do
user_password_and_password_confirmation_dialogs
user_passwords_does_not_match_dialog
done
}
get_user_settings(){
while [ $allright -ne 0 ]; do
boot_disk_dialog
root_disk_dialog
ask_for_root_password
ask_for_user_password
define_partition_settings
allright_dialog
done
}
get_user_settings
export tgt_boot_partition
export tgt_root_partition
export swap_partition
export root_password
export root_password_confirmation
export password
export password_confirmation
#!/bin/bash
set -o errexit
echo "Enabling Services..."
for i in $(seq 0 $(expr ${#services[@]} - 1)); do
arch-chroot . /usr/bin/bash <<EOF
#!/usr/bin/env bash
systemctl enable ${services[i]}
EOF
done
echo "DONE"
#!/bin/bash
set -o errexit
refind_location="./boot/EFI/BOOT"
refind_size_big="128"
refind_size_small="48"
refind_theme_name="dark"
refind_theme_path="_dark"
echo "Clonning Refind Theme..."
git clone https://github.com/bobafetthotmail/refind-theme-regular.git
echo "DONE"
echo "Setting up Refind Theme..."
pushd refind-theme-regular
cp src/theme.conf theme.conf
sed -i "s/#icons_dir refind-theme-regular\/icons\/$refind_size_big-$refind_size_small/icons_dir refind-theme-regular\/icons\/$refind_size_big-$refind_size_small/" theme.conf
sed -i "s/#big_icon_refind_size $refind_size_big/big_icon_refind_size $refind_size_big/" theme.conf
sed -i "s/#small_icon_refind_size $refind_size_small/small_icon_refind_size $refind_size_small/" theme.conf
sed -i "s/#banner refind-theme-regular\/icons\/$refind_size_big-$refind_size_small\/bg$refind_theme_path.png/banner refind-theme-regular\/icons\/$refind_size_big-$refind_size_small\/bg$refind_theme_path.png/" theme.conf
sed -i "s/#selection_big refind-theme-regular\/icons\/$refind_size_big-$refind_size_small\/selection$refind_theme_path-big.png/selection_big refind-theme-regular\/icons\/$refind_size_big-$refind_size_small\/selection$refind_theme_path-big.png/" theme.conf
sed -i "s/#selection_small refind-theme-regular\/icons\/$refind_size_big-$refind_size_small\/selection$refind_theme_path-small.png/selection_small refind-theme-regular\/icons\/$refind_size_big-$refind_size_small\/selection$refind_theme_path-small.png/" theme.conf
popd
echo "DONE"
echo "Cleaning up Refind Theme Installation Files..."
rm -rf refind-theme-regular/{src,.git}
rm -rf refind-theme-regular/install.sh
cp -r refind-theme-regular "${refind_location}"
echo "DONE"
echo "Creating refind theme Configuration file"
cat <<REFINDCONFIGAPPEND | tee -a "${refind_location}/refind.conf" > /dev/null
# Load rEFInd theme Regular
include refind-theme-regular/theme.conf
REFINDCONFIGAPPEND
rm -r refind-theme-regular
echo "DONE"
#!/bin/bash
set -o errexit
curl -sL gist.github.com/themaxhero/60ffe9bf185ebac8e88003197317f817/raw/config.sh > ./config.sh
chmod +x ./config.sh
curl -sL gist.github.com/themaxhero/60ffe9bf185ebac8e88003197317f817/raw/dialogs.sh > ./dialogs.sh
chmod +x ./dialogs.sh
curl -sL gist.github.com/themaxhero/60ffe9bf185ebac8e88003197317f817/raw/run-disk.sh > ./run-disk.sh
chmod +x ./run-disk.sh
curl -sL gist.github.com/themaxhero/60ffe9bf185ebac8e88003197317f817/raw/setup-pacman.sh > ./setup-pacman.sh
chmod +x ./setup-pacman.sh
curl -sL gist.github.com/themaxhero/60ffe9bf185ebac8e88003197317f817/raw/setup-locale.sh > ./setup-locale.sh
chmod +x ./setup-locale.sh
curl -sL gist.github.com/themaxhero/60ffe9bf185ebac8e88003197317f817/raw/enable-services.sh > ./enable-services.sh
chmod +x ./enable-services.sh
curl -sL gist.github.com/themaxhero/60ffe9bf185ebac8e88003197317f817/raw/setup-refind.sh > ./setup-refind.sh
chmod +x ./setup-refind.sh
curl -sL gist.github.com/themaxhero/60ffe9bf185ebac8e88003197317f817/raw/setup-sddm-theme.sh > ./setup-sddm-theme.sh
chmod +x ./setup-sddm-theme.sh
curl -sL gist.githubusercontent.com/themaxhero/60ffe9bf185ebac8e88003197317f817/raw/install-refind-theme.sh > ./install-refind-theme.sh
chmod +x ./install-refind-theme.sh
# Load config.sh from gist
source ./config.sh
# User Interactive (user password, root's password and disk setup)
source ./dialogs.sh
# Execute Disk Formating and Partitioning
SWAP_END=$(cat <<EOF | numfmt --from=iec | awk 'BEGIN { sum=0 } { sum+=$1 } END { printf "%.0f\n", sum }' | numfmt --to=iec
${BOOT_SIZE}
${SWAP_SIZE}
EOF
)
echo "---- Disk Setup ----"
echo "Configuring Partitions..."
parted --script "${root_disk}" -- \
mklabel gpt \
mkpart ESP fat32 1Mib ${BOOT_SIZE} \
mkpart primary linux-swap ${BOOT_SIZE} ${SWAP_END} \
mkpart primary ext4 ${SWAP_END} 100% \
set 1 boot on
echo "DONE"
echo "Configuring SWAP..."
mkswap -f ${swap_partition}
swapon ${swap_partition}
echo "DONE"
echo "Configuring Root"
mkfs.ext4 ${tgt_root_partition}
mount ${tgt_root_partition} ${rootmnt}
mkdir ${rootmnt}/boot
mount ${tgt_boot_partition} ${rootmnt}/boot
export ROOT_UUID=$(blkid -s UUID -o value $tgt_root_partition)
echo "DONE"
cleanup(){
umount -r ${tgt_root_partition}
}
trap cleanup EXIT
echo "---- System Install ----"
echo "Doing Pacstrap..."
pacstrap -GM ${rootmnt} base
echo "DONE"
# Removing refind config for preventing unexpected behaviour
if [ -f "${rootmnt}/boot/EFI/BOOT/refind.conf" ]; then
rm $rootmnt/boot/EFI/BOOT/refind.conf
fi
if [ -f "${rootmnt}/boot/refind_linux.conf" ]; then
rm $rootmnt/boot/refind_linux.conf
fi
pushd ${rootmnt}
echo "Generating FSTAB..."
genfstab -U . > ./etc/fstab
echo "DONE"
# Setup pacman's mirrors and repos
~/setup-pacman.sh
echo "Configuring Network..."
echo -e $hostname | cp /dev/stdin ./etc/hostname > /dev/null
cat <<EOF | tee -a ./etc/hosts > /dev/null
127.0.0.1 localhost
::1 localhost
127.0.1.1 $hostname.localdomain $hostname
EOF
echo "DONE"
# Setup locale
echo "Configuring Region..."
join_by(){
local d=$1;
shift;
local f=$1;
shift;
printf %s "$f" "${@/#/$d}";
}
for i in $(seq 0 $(expr ${#locales[@]} - 1)); do
echo -e "${locales[i]}.UTF-8 UTF-8" | tee -a ./etc/locale.gen > /dev/null
done
echo -e "KEYMAP=${keyboard_layout}" | cp /dev/stdin ./etc/vconsole.conf
cat <<EOF | cp /dev/stdin ./etc/locale.conf
LANG=${locales[0]}.UTF-8
LANGUAGE=$(join_by : $locales[@])
EOF
chmod 644 ./etc/locale.conf
ln -sf "/usr/share/zoneinfo/${timezone}" /etc/localtime
echo "DONE"
echo "Installing Packages..."
arch-chroot . /usr/bin/bash <<EOF
#!/usr/bin/env bash
locale-gen
hwclock --systohc
timedatectl set-ntp true
pacman-key --init
pacman-key --populate archlinux
pacman-key --keyserver hkp://p80.pool.sks-keyservers.net:80 -r 3056513887B78AEB 8A9E14A07010F7E3
pacman-key --lsign-key 3056513887B78AEB
pacman-key --lsign-key 8A9E14A07010F7E3
curl -O https://download.sublimetext.com/sublimehq-pub.gpg && pacman-key --add sublimehq-pub.gpg && pacman-key --lsign-key 8A8F901A && rm sublimehq-pub.gpg
# User setup
groupmod -g 10 wheel
groupmod -g 100 users
useradd -u 1000 -m -g users -G wheel $username
echo -e "$root_password\n$root_password" | passwd root
echo -e "$password\n$password" | passwd $username
chsh root -s /bin/bash
chsh $username -s /bin/bash
usermod \
-aG audio \
-aG video \
-aG input \
-aG kvm \
$username
cat <<SUDOERSAPPEND | tee -a ./etc/sudoers > /dev/null
%wheel ALL=(ALL) NOPASSWD: ALL
Defaults env_reset,pwfeedback
SUDOERSAPPEND
pacman -Syu --noconfirm --needed --overwrite /boot/\\* ${packages[@]}
sudo -H -u $username yay -S ${aur_packages[@]}
yes | arch-chroot . pacman -Scc
sed -i -e 's/^HOOKS=.+$/${hooks_line}/' ./etc/mkinicpio.conf
sed -i -e 's/^#Port.+$/Port ${SSH_PORT}/' ./etc/ssh/sshd_config
mkinitcpio -Pv
refind-install --usedefault ${tgt_boot_partition}
EOF
echo "DONE"
# Enable Services
echo "Enabling Services..."
for i in $(seq 0 $(expr ${#services[@]} - 1)); do
arch-chroot . /usr/bin/bash <<EOF
#!/usr/bin/env bash
systemctl enable ${services[i]}
EOF
done
echo "DONE"
# Setup Refind
echo "Configuring Refind..."
cat <<EOF | tee -a ./boot/EFI/BOOT/refind.conf > /dev/null
timeout 4
extra_kernel_version_strings $default_kernel,linux-lts,linux
enable_mouse true
scan_all_linux_kernels true
default_selection Archlinux SkyLake
EOF
cat <<EOF | tee -a ./boot/refind_linux.conf > /dev/null
"Boot using default options" "root=UUID=$ROOT_UUID ${kernel_params[@]} initrd=initramfs-%v.img"
"Boot using fallback initramfs" "root=UUID=$ROOT_UUID ${kernel_params[@]} initrd=initramfs-%v-fallback.img"
"Boot to terminal" "root=UUID=$ROOT_UUID ${kernel_params[@]} initrd=initramfs-%v.img systemd.unit=multi-user.target"
EOF
echo "DONE"
# Setup SDDM THEME
echo "Setting up SDDM Theme..."
mkdir -p ./etc/sddm.conf.d
echo -e "[Theme]\nCurrent=${SDDM_THEME}" > ./etc/sddm.conf.d/theme.conf
echo "DONE"
chmod 755 "./usr/share/sddm/themes/aerial/"
# Installs refind-theme
arch-chroot . /usr/bin/bash <<EOF
refind_location="./boot/EFI/BOOT"
refind_size_big="128"
refind_size_small="48"
refind_theme_name="dark"
refind_theme_path="_dark"
echo "Clonning Refind Theme..."
git clone https://github.com/bobafetthotmail/refind-theme-regular.git
echo "DONE"
echo "Setting up Refind Theme..."
pushd refind-theme-regular
cp src/theme.conf theme.conf
sed -i "s/#icons_dir refind-theme-regular\/icons\/$refind_size_big-$refind_size_small/icons_dir refind-theme-regular\/icons\/$refind_size_big-$refind_size_small/" theme.conf
sed -i "s/#big_icon_refind_size $refind_size_big/big_icon_refind_size $refind_size_big/" theme.conf
sed -i "s/#small_icon_refind_size $refind_size_small/small_icon_refind_size $refind_size_small/" theme.conf
sed -i "s/#banner refind-theme-regular\/icons\/$refind_size_big-$refind_size_small\/bg$refind_theme_path.png/banner refind-theme-regular\/icons\/$refind_size_big-$refind_size_small\/bg$refind_theme_path.png/" theme.conf
sed -i "s/#selection_big refind-theme-regular\/icons\/$refind_size_big-$refind_size_small\/selection$refind_theme_path-big.png/selection_big refind-theme-regular\/icons\/$refind_size_big-$refind_size_small\/selection$refind_theme_path-big.png/" theme.conf
sed -i "s/#selection_small refind-theme-regular\/icons\/$refind_size_big-$refind_size_small\/selection$refind_theme_path-small.png/selection_small refind-theme-regular\/icons\/$refind_size_big-$refind_size_small\/selection$refind_theme_path-small.png/" theme.conf
popd
echo "DONE"
echo "Cleaning up Refind Theme Installation Files..."
rm -rf refind-theme-regular/{src,.git}
rm -rf refind-theme-regular/install.sh
cp -r refind-theme-regular "${refind_location}"
echo "DONE"
echo "Creating refind theme Configuration file"
cat <<REFINDCONFIGAPPEND | tee -a "${refind_location}/refind.conf" > /dev/null
# Load rEFInd theme Regular
include refind-theme-regular/theme.conf
REFINDCONFIGAPPEND
rm -r refind-theme-regular
echo "DONE"
EOF
# Runs User's custom script for setup stuff as the user
# curl "https://gist.githubusercontent.com/themaxhero/60ffe9bf185ebac8e88003197317f817/raw/user-script.sh" -o ./home/$username/userscript.sh
# arch-chroot . /usr/bin/bash <<EOF
# chmod +x /home/$username/userscript.sh
# chown $username /home/$username/userscript.sh
# echo "Running User Custom Script"
# su -l $username -c "~/userscript.sh"
# rm "/home/${username}/userscript.sh"
# EOF
reboot
#!/bin/bash
set -o errexit
SWAP_END=$(cat <<EOF | numfmt --from=iec | awk 'BEGIN { sum=0 } { sum+=$1 } END { printf "%.0f\n", sum }' | numfmt --to=iec
${BOOT_SIZE}
${SWAP_SIZE}
EOF
)
echo "---- Disk Setup ----"
echo "Configuring Partitions..."
parted --script "${root_disk}" -- \
mklabel gpt \
mkpart ESP fat32 1Mib ${BOOT_SIZE} \
mkpart primary linux-swap ${BOOT_SIZE} ${SWAP_END} \
mkpart primary ext4 ${SWAP_END} 100% \
set 1 boot on
echo "DONE"
echo "Configuring SWAP..."
mkswap -f ${swap_partition}
swapon ${swap_partition}
echo "DONE"
echo "Configuring Root"
mkfs.ext4 ${tgt_root_partition}
mount ${tgt_root_partition} ${rootmnt}
mkdir ${rootmnt}/boot
mount ${tgt_boot_partition} ${rootmnt}/boot
export ROOT_UUID=$(blkid -s UUID -o value $tgt_root_partition)
echo "DONE"
#!/bin/bash
set -o errexit
#!/bin/bash
set -o errexit
echo "Configuring Pacman..."
pacman -Sy pacman-contrib --noconfirm --needed
curl -sL "https://www.archlinux.org/mirrorlist/?country=BR&protocol=https&protocol=http&use_mirror_status=on" | sed -e 's/^#Server/Server/' | grep -v '^#' | grep -v -e '^$' > ../mirrors
rm ./etc/pacman.d/mirrorlist
rankmirrors -n 10 ../mirrors > ./etc/pacman.d/mirrorlist
echo "Downloading Chaotic-AUR Mirrorlist..."
curl -sL "https://lonewolf.pedrohlc.com/chaotic-aur/mirrorlist" | sed -e 's/^#Server/Server/' | grep -v '^#' | grep -v -e '^$' > ./etc/pacman.d/chaotic-aur.mirrorlist
echo "DONE"
echo "Downloading Sublime-Text..."
touch ./etc/pacman.d/sublime-text.mirrorlist
cat <<EOF | tee -a ./etc/pacman.d/sublime-text.mirrorlist > /dev/null
Server = https://download.sublimetext.com/arch/stable/\$arch
EOF
echo "DONE"
echo "Adding Repositories to Pacman configuration file..."
cat <<EOF | tee -a ./etc/pacman.conf > /dev/null
[multilib]
Include = /etc/pacman.d/mirrorlist
[chaotic-aur]
Include = /etc/pacman.d/chaotic-aur.mirrorlist
[sublime-text]
Include = /etc/pacman.d/sublime-text.mirrorlist
EOF
sed -i -e "s/#Color/Color\nILoveCandy/" ./etc/pacman.conf
echo "DONE"
#!/bin/bash
set -o errexit
echo "Configuring Refind..."
cat <<EOF | tee -a ./boot/EFI/BOOT/refind.conf > /dev/null
timeout 4
extra_kernel_version_strings $default_kernel,linux-lts,linux
enable_mouse true
scan_all_linux_kernels true
default_selection Archlinux SkyLake
EOF
cat <<EOF | tee -a ./boot/refind_linux.conf > /dev/null
"Boot using default options" "root=UUID=$ROOT_UUID ${kernel_params[@]} initrd=initramfs-%v.img"
"Boot using fallback initramfs" "root=UUID=$ROOT_UUID ${kernel_params[@]} initrd=initramfs-%v-fallback.img"
"Boot to terminal" "root=UUID=$ROOT_UUID ${kernel_params[@]} initrd=initramfs-%v.img systemd.unit=multi-user.target"
EOF
echo "DONE"
#!/bin/bash
set -o errexit
echo "Setting up SDDM Theme..."
mkdir -p ./etc/sddm.conf.d
echo -e "[Theme]\nCurrent=${SDDM_THEME}" > ./etc/sddm.conf.d/theme.conf
echo "DONE"
chmod 755 "./usr/share/sddm/themes/aerial/"
#!/bin/bash
set -o errexit
cd ~
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
pushd .asdf
git checkout $(git describe --abbrev=0 --tags)
cat <<HEREDOC | tee -a ~/.bashrc > /dev/null
export XDG_DATA_HOME=\$HOME/.local/share
export XDG_CONFIG_HOME=\$HOME/.config
export XDG_DATA_DIRS=/usr/local/share/:/usr/share/
export XDG_CONFIG_DIRS=/etc/xdg
export XDG_CACHE_HOME=\$HOME/.cache
. \$HOME/.asdf/asdf.sh
. \$HOME/.asdf/completions/asdf.bash
export QT_QPA_PLATFORMTHEME=qt5ct
HEREDOC
cat <<HEREDOC | tee -a ~/.zshrc > /dev/null
export XDG_DATA_HOME=\$HOME/.local/share
export XDG_CONFIG_HOME=\$HOME/.config
export XDG_DATA_DIRS=/usr/local/share/:/usr/share/
export XDG_CONFIG_DIRS=/etc/xdg
export XDG_CACHE_HOME=\$HOME/.cache
export QT_QPA_PLATFORMTHEME=qt5ct
. \$HOME/.asdf/asdf.sh
fpath=(\${ASDF_DIR}/completions \$fpath)
autoload -Uz compinit
compinit
HEREDOC
mkdir -p ~/.config/fish && echo -e 'source ~/.asdf/asdf.fish' >> ~/.config/fish/config.fish
mkdir -p ~/.config/fish/completions && cp ~/.asdf/completions/asdf.fish ~/.config/fish/completions
popd
source $HOME/.asdf/asdf.sh
# Install Erlang
sudo pacman -Syu ncurses glu wxgtk2 libpng libssh unixodbc openssl-1.0 --noconfirm
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang
mkdir ~/.openssl-1.0
pushd .openssl-1.0
ln -s /usr/include/openssl-1.0 include
ln -s /usr/lib/openssl-1.0 lib
popd
export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac"
export ERLANG_OPENSSL_PATH=$HOME/.openssl-1.0
asdf install erlang latest
asdf global erlang $(asdf list erlang)
# Install Elixir (that depends on erlang)
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir
asdf install elixir latest
asdf global elixir $(asdf list elixir)
# Install NodeJS
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs
~/.asdf/plugins/nodejs/bin/import-release-team-keyring
~/.asdf/plugins/nodejs/bin/import-previous-release-team-keyring
asdf install nodejs latest
asdf global nodejs $(asdf list nodejs)
# Install Go lang
asdf plugin-add golang https://github.com/kennyp/asdf-golang.git
asdf install golang latest
asdf global golang $(asdf list golang)
# Install Crystal
asdf plugin-add crystal https://github.com/asdf-community/asdf-crystal
asdf install crystal latest
asdf global crystal $(asdf list crystal)
# Install Rust
asdf plugin-add rust https://github.com/code-lever/asdf-rust.git
asdf install rust latest
asdf global rust $(asdf list rust)
# Install Haskell
asdf plugin-add haskell https://github.com/asdf-community/asdf-haskell
asdf install haskell latest
asdf global haskell $(asdf list haskell)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment