updates reg. DE FS PL etc

This commit is contained in:
mfgbhatti 2022-02-12 14:15:53 +00:00
parent dde58e77b8
commit 10baa963dd
6 changed files with 304 additions and 300 deletions

View File

@ -16,11 +16,6 @@ make_boot() {
fi fi
} }
something_failed() {
echo "Something is not right. Exiting."
exit 1
}
do_btrfs() { do_btrfs() {
mkfs.btrfs -L "$1" "$2" -f mkfs.btrfs -L "$1" "$2" -f
mount -t btrfs "$2" "$MOUNTPOINT" mount -t btrfs "$2" "$MOUNTPOINT"
@ -41,10 +36,47 @@ do_btrfs() {
} }
do_format() { do_format() {
mkfs."$FS" "$1" \ case "$FS" in
"$([[ $FS == xfs || $FS == btrfs || $FS == reiserfs ]] && echo "-f")" \ "xfs")
"$([[ $FS == vfat ]] && echo "-F32")" \ install_pkg xfsprogs
"$([[ $FS == ext4 ]] && echo "-E discard -F")" mkfs.xfs -f -L "$ROOT" "$1"
;;
"btrfs")
install_pkg btrfs-progs
mkfs.btrfs -L "$ROOT" "$1" -f
;;
"ext4")
mkfs.ext4 -E discard -F -L "$ROOT" "$1"
;;
"vfat")
mkfs.vfat -F32 "$1"
;;
"f2fs")
install_pkg f2fs-tools
mkfs.f2fs -l "$ROOT" -O extra_attr,inode_checksum,sb_checksum "$1"
;;
"ext2")
mkfs.ext2 -L "$ROOT" "$1"
;;
"ext3")
mkfs.ext3 -L "$ROOT" "$1"
;;
"jfs")
install_pkg jfsutils
mkfs.jfs -L "$ROOT" "$1"
;;
"nilfs2")
install_pkg nilfs-utils
mkfs.nilfs2 -L "$ROOT" "$1"
;;
"ntfs")
install_pkg ntfs-3g
mkfs.ntfs -Q -L "$ROOT" "$1"
;;
*)
something_failed
;;
esac
} }
@ -69,10 +101,10 @@ lvm_mount() {
i=$((i + 1)) i=$((i + 1))
done done
mount /dev/"$LVM_VG"/"${LVM_NAMES[0]}" "$MOUNTPOINT" mount -t "$FS" /dev/"$LVM_VG"/"${LVM_NAMES[0]}" "$MOUNTPOINT"
for x in "${LVM_NAMES[@]:1}"; do for x in "${LVM_NAMES[@]:1}"; do
mkdir "$MOUNTPOINT"/"$x" mkdir "$MOUNTPOINT"/"$x"
mount /dev/"$LVM_VG"/"$x" "$MOUNTPOINT"/"$x" mount -t "$FS" /dev/"$LVM_VG"/"$x" "$MOUNTPOINT"/"$x"
done done
} }
@ -103,7 +135,7 @@ mount_boot() {
logo logo
title "Setting up mirrors for faster downloads" title "Setting up mirrors for faster downloads"
install_pkg pacman-contrib reflector rsync gptfdisk btrfs-progs install_pkg pacman-contrib reflector rsync gptfdisk
sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
@ -115,7 +147,7 @@ fi
reflector --age 48 --country "$ISO" -f 5 --latest 20 --protocol https --sort rate --save /etc/pacman.d/mirrorlist reflector --age 48 --country "$ISO" -f 5 --latest 20 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
mkdir "$MOUNTPOINT" &>/dev/null # Hiding error message if any mkdir "$MOUNTPOINT" &>/dev/null # Hiding error message if any
title "Partitioning disk" title "File system setup"
if [[ "$SDD" -eq 1 ]]; then if [[ "$SDD" -eq 1 ]]; then
PART1=${DISK}p1 PART1=${DISK}p1
PART2=${DISK}p2 PART2=${DISK}p2
@ -123,6 +155,7 @@ else
PART1=${DISK}1 PART1=${DISK}1
PART2=${DISK}2 PART2=${DISK}2
fi fi
_PART_UUID=$(blkid -s UUID -o value "$PART2")
if [[ "$LAYOUT" -eq 1 ]]; then if [[ "$LAYOUT" -eq 1 ]]; then
do_partition do_partition
@ -140,6 +173,7 @@ elif [[ "$LVM" -eq 1 ]]; then
do_lvm do_lvm
lvm_mount lvm_mount
mount_boot mount_boot
set_option "HOOKS" "(lvm2 filesystems)"
elif [[ "$LUKS" -eq 1 ]]; then elif [[ "$LUKS" -eq 1 ]]; then
do_partition do_partition
@ -147,12 +181,16 @@ elif [[ "$LUKS" -eq 1 ]]; then
# enter luks password to cryptsetup and format root partition # enter luks password to cryptsetup and format root partition
echo -n "$LUKS_PASSWORD" | cryptsetup -y -v luksFormat "$PART2" - echo -n "$LUKS_PASSWORD" | cryptsetup -y -v luksFormat "$PART2" -
# open luks container and ROOT will be place holder # open luks container and ROOT will be place holder
# $LUKS_PATH "/dev/mapper/luks"
echo -n "$LUKS_PASSWORD" | cryptsetup open "$PART2" luks - echo -n "$LUKS_PASSWORD" | cryptsetup open "$PART2" luks -
pvcreate "$LUKS_PATH" pvcreate "$LUKS_PATH"
vgcreate "$LVM_VG" "$LUKS_PATH" vgcreate "$LVM_VG" "$LUKS_PATH"
do_lvm do_lvm
lvm_mount lvm_mount
mount_boot mount_boot
set_option "ENCRYP_PART" "$_PART_UUID"
# HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
set_option "HOOKS" "(base udev autodetect keyboard keymap consolefont modconf block encrypt filesystems fsck)"
elif [[ "$LAYOUT" -eq 0 ]]; then elif [[ "$LAYOUT" -eq 0 ]]; then
modprobe dm-mod modprobe dm-mod
@ -166,22 +204,22 @@ elif [[ "$LAYOUT" -eq 0 ]]; then
fi fi
else else
something_failed something_failed
fi fi
if ! grep -qs '/mnt' /proc/mounts; then if [[ "$(grep -E "$MOUNTPOINT" /proc/mounts -c)" -eq "0" ]]; then
echo "Drive is not mounted can not continue" echo "Drive is not mounted can not continue"
echo "Rebooting in 3 Seconds ..." && sleep 1 echo "Rebooting in 3 Seconds ..." && sleep 1
echo "Rebooting in 2 Seconds ..." && sleep 1 echo "Rebooting in 2 Seconds ..." && sleep 1
echo "Rebooting in 1 Second ..." && sleep 1 echo "Rebooting in 1 Second ..." && sleep 1
reboot now # reboot now
exit 1
fi fi
title "Arch Install on Main Drive" title "Arch Install on Main Drive"
# for test purposes # for test purposes
pacstrap "$MOUNTPOINT" base linux linux-firmware vim --needed --noconfirm pacstrap "$MOUNTPOINT" base linux linux-firmware vim --needed --noconfirm
#pacstrap /mnt base base-devel linux linux-firmware vim nano sudo archlinux-keyring wget libnewt --noconfirm --needed #pacstrap "$MOUNTPOINT" base base-devel linux linux-firmware vim nano sudo archlinux-keyring wget libnewt --noconfirm --needed
echo "keyserver hkp://keyserver.ubuntu.com" >>"$MOUNTPOINT"/etc/pacman.d/gnupg/gpg.conf echo "keyserver hkp://keyserver.ubuntu.com" >>"$MOUNTPOINT"/etc/pacman.d/gnupg/gpg.conf
genfstab -U "$MOUNTPOINT" >>"$MOUNTPOINT"/etc/fstab genfstab -U "$MOUNTPOINT" >>"$MOUNTPOINT"/etc/fstab
@ -189,11 +227,11 @@ genfstab -U "$MOUNTPOINT" >>"$MOUNTPOINT"/etc/fstab
cp -R "${SCRIPT_DIR}" "$MOUNTPOINT"/root/ArchTitus cp -R "${SCRIPT_DIR}" "$MOUNTPOINT"/root/ArchTitus
cp /etc/pacman.d/mirrorlist "$MOUNTPOINT"/etc/pacman.d/mirrorlist cp /etc/pacman.d/mirrorlist "$MOUNTPOINT"/etc/pacman.d/mirrorlist
title "Checking for low memory systems <8G "
# TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') # TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')
TOTALMEM=$(grep -i "memtotal" "/proc/meminfo" | grep -o '[[:digit:]]*') TOTALMEM="$(grep -i "memtotal" "/proc/meminfo" | grep -o '[[:digit:]]*')"
if [[ $TOTALMEM -lt 8000000 ]]; then if [[ $TOTALMEM -lt 8000000 ]]; then
title "Checking for low memory systems <8G "
# Put swap into the actual system, not into RAM disk, otherwise there is no point in it, it'll cache RAM into RAM. So, /mnt/ everything. # Put swap into the actual system, not into RAM disk, otherwise there is no point in it, it'll cache RAM into RAM. So, /mnt/ everything.
mkdir -p "$MOUNTPOINT"/opt/swap # make a dir that we can apply NOCOW to to make it btrfs-friendly. mkdir -p "$MOUNTPOINT"/opt/swap # make a dir that we can apply NOCOW to to make it btrfs-friendly.
chattr +C "$MOUNTPOINT"/opt/swap # apply NOCOW, btrfs needs that. chattr +C "$MOUNTPOINT"/opt/swap # apply NOCOW, btrfs needs that.

View File

@ -1,60 +1,54 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo -ne " # shellcheck disable=SC1091
------------------------------------------------------------------------- # shellcheck source=./setup.conf
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
-------------------------------------------------------------------------
Automated Arch Linux Installer
SCRIPTHOME: ArchTitus
-------------------------------------------------------------------------
"
source /root/ArchTitus/setup.conf
echo -ne "
-------------------------------------------------------------------------
Network Setup
-------------------------------------------------------------------------
"
pacman -S networkmanager dhclient --noconfirm --needed
systemctl enable --now NetworkManager
echo -ne "
-------------------------------------------------------------------------
Setting up mirrors for optimal download
-------------------------------------------------------------------------
"
pacman -S --noconfirm pacman-contrib curl
pacman -S --noconfirm reflector rsync grub btrfs-progs arch-install-scripts git
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
nc=$(grep -c ^processor /proc/cpuinfo) CONFIG_FILE=$(pwd)/setup.conf
if [[ -f "$CONFIG_FILE" ]]; then
source "$CONFIG_FILE"
else
echo "Missing file: setup.conf"
exit 1
fi
title basic installations
install_pkg networkmanager dhclient reflector \
rsync grub btrfs-progs arch-install-scripts \
git pacman-contrib curl
title Network Setup
systemctl enable --now NetworkManager
install_xorg() {
install_pkg "xorg xorg-server"
}
CPU="$(grep -c ^processor /proc/cpuinfo)"
echo -ne " echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
You have " $nc" cores. And You have \"$CPU\" cores. And
changing the makeflags for "$nc" cores. Aswell as changing the makeflags for \"$CPU\" cores. As well as
changing the compression settings. changing the compression settings.
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')
if [[ $TOTALMEM -gt 8000000 ]]; then TOTALMEM="$(grep -i "memtotal" "/proc/meminfo" | grep -o '[[:digit:]]*')"
sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$nc\"/g" /etc/makepkg.conf if [[ $TOTALMEM -gt 8000000 ]]; then
sed -i "s/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $nc -z -)/g" /etc/makepkg.conf sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$CPU\"/g" /etc/makepkg.conf
sed -i "s/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $CPU -z -)/g" /etc/makepkg.conf
fi fi
echo -ne "
------------------------------------------------------------------------- title Setup Language and set locale
Setup Language to US and set locale # sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
------------------------------------------------------------------------- echo "$LOCALE" | sed -i "s/\"//g" >>/etc/locale.gen
"
sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
locale-gen locale-gen
timedatectl --no-ask-password set-timezone ${TIMEZONE} timedatectl --no-ask-password set-timezone "$TIMEZONE"
timedatectl --no-ask-password set-ntp 1 timedatectl --no-ask-password set-ntp 1
localectl --no-ask-password set-locale LANG="en_US.UTF-8" LC_TIME="en_US.UTF-8" localectl --no-ask-password set-locale LANG="$LOCALE" LC_TIME="$LOCALE"
# Set keymaps # Set keymaps
localectl --no-ask-password set-keymap ${KEYMAP} # echo "KEYMAP=$KEYMAP" >>/etc/vconsole.conf
localectl --no-ask-password set-keymap --no-convert "$KEYMAP"
# Add sudo no password rights # Add sudo no password rights
sed -i 's/^# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers sed -i 's/^# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/' /etc/sudoers
@ -64,119 +58,136 @@ sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
#Enable multilib #Enable multilib
sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf
pacman -Sy --noconfirm
echo -ne " # pacman -Sy --noconfirm
------------------------------------------------------------------------- refresh_pacman
Installing Base System
------------------------------------------------------------------------- title Installing desktop
" case "$DESKTOP" in
cat /root/ArchTitus/pkg-files/pacman-pkgs.txt | while read line "default")
do # cat /root/ArchTitus/pkg-files/pacman-pkgs.txt | while read line
echo "INSTALLING: ${line}" while IFS= read -r LINE; do
sudo pacman -S --noconfirm --needed ${line} echo "INSTALLING: $LINE"
done install_pkg "$LINE"
echo -ne " done </root/ArchTitus/pkg-files/pacman-pkgs.txt
------------------------------------------------------------------------- ;;
Installing Microcode "gnome")
------------------------------------------------------------------------- install_xorg
" install_pkg "gnome gnome-extra gnome-software gnome-initial-setup gnome-tweak-tool gnome-power-manager"
systemctl enable gdm.service
;;
"xfce")
install_xorg
install_pkg "xfce4 xfce4-goodies lightdm lightdm-gtk-greeter pavucontrol pulseaudio"
systemctl enable lightdm.service
;;
"mate")
install_xorg
install_pkg "mate mate-extra lightdm lightdm-gtk-greeter"
systemctl enable lightdm.service
;;
"lxqt")
install_xorg
install_pkg "lxqt breeze-icons sddm"
systemctl enable sddm.service
;;
"openbox")
install_xorg
install_pkg "openbox obconf xterm lightdm lightdm-gtk-greeter"
systemctl enable lightdm.service
;;
"awesome")
install_xorg
install_pkg "awesome vicious xterm lightdm lightdm-gtk-greeter"
systemctl enable lightdm.service
;;
"minimal")
install_xorg
;;
"i3")
install_xorg
install_pkg "i3-wm i3blocks i3lock i3status dmenu rxvt-unicode lightdm lightdm-gtk-greeter"
systemctl enable lightdm.service
;;
"i3-gaps")
install_xorg
install_pkg "i3-gaps i3blocks i3lock i3status dmenu rxvt-unicode lightdm lightdm-gtk-greeter"
systemctl enable lightdm.service
;;
"deepin")
install_xorg
install_pkg "deepin deepin-extra deepin-kwin"
sed -i 's/^#greeter-session=.*/greeter-session=lightdm-deepin-greeter/' /etc/lightdm/lightdm.conf
systemctl enable lightdm.service
;;
"budgie")
install_xorg
install_pkg "budgie-desktop budgie-desktop-view budgie-screensaver gnome-control-center network-manager-applet gnome"
systemctl enable gdm.service
;;
*)
something_failed
;;
esac
title Installing Microcode
# determine processor type and install microcode # determine processor type and install microcode
proc_type=$(lscpu) PROC_TYPE="$(lscpu | grep "Vendor ID:" | awk '{print $3}')"
if grep -E "GenuineIntel" <<< ${proc_type}; then
case "$PROC_TYPE" in
"GenuineIntel")
echo "Installing Intel microcode" echo "Installing Intel microcode"
pacman -S --noconfirm intel-ucode install_pkg intel-ucode
proc_ucode=intel-ucode.img ;;
elif grep -E "AuthenticAMD" <<< ${proc_type}; then "AuthenticAMD")
echo "Installing AMD microcode" echo "Installing AMD microcode"
pacman -S --noconfirm amd-ucode install_pkg amd-ucode
proc_ucode=amd-ucode.img ;;
fi *)
something_failed
;;
esac
echo -ne " title Installing Graphics Drivers
-------------------------------------------------------------------------
Installing Graphics Drivers
-------------------------------------------------------------------------
"
# Graphics Drivers find and install # Graphics Drivers find and install
gpu_type=$(lspci) if [[ "$(lspci | grep -E '(NVIDIA|GeForce)' -c)" -gt "0" ]]; then
if grep -E "NVIDIA|GeForce" <<< ${gpu_type}; then install_pkg "nvidia nvidia-utils libglvnd"
pacman -S nvidia --noconfirm --needed elif [[ "$(lspci | grep -E '(Radeon|AMD)' -c)" -gt "0" ]]; then
nvidia-xconfig install_pkg "xf86-video-amdgpu mesa-libgl mesa-vdpau libvdpau-va-gl"
elif lspci | grep 'VGA' | grep -E "Radeon|AMD"; then elif [[ "$(lspci | grep -E '(Integrated Graphics Controller|Intel Corporation UHD)' -c)" -gt "0" ]]; then
pacman -S xf86-video-amdgpu --noconfirm --needed # install_pkg "libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel libva-intel-driver libva-utils lib32-mesa"
elif grep -E "Integrated Graphics Controller" <<< ${gpu_type}; then install_pkg "xf86-video-intel vulkan-radeon mesa-libgl mesa-vdpau libvdpau-va-gl"
pacman -S libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel libva-intel-driver libva-utils lib32-mesa --needed --noconfirm else
elif grep -E "Intel Corporation UHD" <<< ${gpu_type}; then echo "No graphics card found!"
pacman -S libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel libva-intel-driver libva-utils lib32-mesa --needed --noconfirm
fi fi
#SETUP IS WRONG THIS IS RUN
if ! source /root/ArchTitus/setup.conf; then
# Loop through user input until the user gives a valid username
while true
do
read -p "Please enter username:" username
# username regex per response here https://unix.stackexchange.com/questions/157426/what-is-the-regex-to-validate-linux-users
# lowercase the username to test regex
if [[ "${username,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]
then
break
fi
echo "Incorrect username."
done
# convert name to lowercase before saving to setup.conf
echo "username=${username,,}" >> ${HOME}/ArchTitus/setup.conf
#Set Password title Adding User
read -p "Please enter password:" password if [ "$(whoami)" = "root" ]; then
echo "password=${password,,}" >> ${HOME}/ArchTitus/setup.conf useradd -m -G wheel -s /bin/bash "$USERNAME"
# Loop through user input until the user gives a valid hostname, but allow the user to force save # use chpasswd to enter $USERNAME:$password
while true
do
read -p "Please name your machine:" nameofmachine
# hostname regex (!!couldn't find spec for computer name!!)
if [[ "${nameofmachine,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]
then
break
fi
# if validation fails allow the user to force saving of the hostname
read -p "Hostname doesn't seem correct. Do you still want to save it? (y/n)" force
if [[ "${force,,}" = "y" ]]
then
break
fi
done
echo "nameofmachine=${nameofmachine,,}" >> ${HOME}/ArchTitus/setup.conf
fi
echo -ne "
-------------------------------------------------------------------------
Adding User
-------------------------------------------------------------------------
"
if [ $(whoami) = "root" ]; then
groupadd libvirt
useradd -m -G wheel,libvirt -s /bin/bash $USERNAME
# use chpasswd to enter $USERNAME:$password
echo "$USERNAME:$PASSWORD" | chpasswd echo "$USERNAME:$PASSWORD" | chpasswd
cp -R /root/ArchTitus /home/$USERNAME/ cp -R /root/ArchTitus /home/"$USERNAME"/
chown -R $USERNAME: /home/$USERNAME/ArchTitus chown -R "$USERNAME": /home/"$USERNAME"/ArchTitus
# enter $nameofmachine to /etc/hostname # enter $nameofmachine to /etc/hostname
echo $nameofmachine > /etc/hostname echo "$HOSTNAME" >>/etc/hostname
else else
echo "You are already a user proceed with aur installs" echo "You are already a user proceed with aur installs"
fi fi
if [[ ${FS} == "luks" ]]; then
# Making sure to edit mkinitcpio conf if luks is selected # Making sure to edit mkinitcpio conf if luks is selected
# add encrypt in mkinitcpio.conf before filesystems in hooks # add encrypt in mkinitcpio.conf before filesystems in hooks
sed -i 's/filesystems/encrypt filesystems/g' /etc/mkinitcpio.conf if [[ "$LVM" -eq 1 ]]; then
# making mkinitcpio with linux kernel sed -i "/^HOOK/s/filesystems/${HOOKS[*]}/" /etc/mkinitcpio.conf
elif [[ "$LUKS" -eq 1 ]]; then
sed -i "s/^HOOK.*/HOOKS=(${HOOKS[*]})/" /etc/mkinitcpio.conf
fi
if [[ -f "/etc/mkinitcpio.conf" ]];then
# making mkinitcpio with linux kernel
echo "Building initramfs"
mkinitcpio -p linux mkinitcpio -p linux
fi fi
echo -ne "
------------------------------------------------------------------------- title SYSTEM READY FOR 2-user.sh
SYSTEM READY FOR 2-user.sh
-------------------------------------------------------------------------
"

View File

@ -1,33 +1,31 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo -ne "
-------------------------------------------------------------------------
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
-------------------------------------------------------------------------
Automated Arch Linux Installer
SCRIPTHOME: ArchTitus
-------------------------------------------------------------------------
Installing AUR Softwares # You can solve users running this script as root
" # with this and then doing the same for the next for statement.
# You can solve users running this script as root with this and then doing the same for the next for statement. However I will leave this up to you. # However I will leave this up to you.
source $HOME/ArchTitus/setup.conf # shellcheck disable=SC1091
# shellcheck source=./setup.conf
cd ~ CONFIG_FILE=$(pwd)/setup.conf
if [[ -f "$CONFIG_FILE" ]]; then
source "$CONFIG_FILE"
else
echo "Missing file: setup.conf"
exit 1
fi
cd ~ || exit 1
git clone "https://aur.archlinux.org/yay.git" git clone "https://aur.archlinux.org/yay.git"
cd ~/yay cd ~/yay || exit 1
makepkg -si --noconfirm makepkg -si --noconfirm
cd ~ cd ~ || exit 1
touch "~/.cache/zshhistory"
touch "$HOME/.cache/zshhistory"
git clone "https://github.com/ChrisTitusTech/zsh" git clone "https://github.com/ChrisTitusTech/zsh"
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
ln -s "~/zsh/.zshrc" ~/.zshrc ln -s "$HOME/zsh/.zshrc" ~/.zshrc
yay -S --noconfirm --needed - < ~/ArchTitus/pkg-files/aur-pkgs.txt yay -S --noconfirm --needed - <~/ArchTitus/pkg-files/aur-pkgs.txt
export PATH=$PATH:~/.local/bin export PATH=$PATH:~/.local/bin
cp -r ~/ArchTitus/dotfiles/* ~/.config/ cp -r ~/ArchTitus/dotfiles/* ~/.config/
@ -36,9 +34,4 @@ konsave -i ~/ArchTitus/kde.knsv
sleep 1 sleep 1
konsave -a kde konsave -a kde
echo -ne " title SYSTEM READY FOR 3-post-setup.sh
-------------------------------------------------------------------------
SYSTEM READY FOR 3-post-setup.sh
-------------------------------------------------------------------------
"
exit

View File

@ -1,29 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo -ne " # shellcheck disable=SC1091
------------------------------------------------------------------------- # shellcheck source=./setup.conf
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
-------------------------------------------------------------------------
Automated Arch Linux Installer
SCRIPTHOME: ArchTitus
-------------------------------------------------------------------------
Final Setup and Configurations CONFIG_FILE=$(pwd)/setup.conf
GRUB EFI Bootloader Install & Check if [[ -f "$CONFIG_FILE" ]]; then
" source "$CONFIG_FILE"
source /root/ArchTitus/setup.conf else
genfstab -U / >> /etc/fstab echo "Missing file: setup.conf"
if [[ -d "/sys/firmware/efi" ]]; then exit 1
grub-install --efi-directory=/boot ${DISK}
fi fi
# set kernel parameter for decrypting the drive # set kernel parameter for decrypting the drive
if [[ "${FS}" == "luks" ]]; then # if [[ "${FS}" == "luks" ]]; then
sed -i "s%GRUB_CMDLINE_LINUX_DEFAULT=\"%GRUB_CMDLINE_LINUX_DEFAULT=\"cryptdevice=UUID=${encryped_partition_uuid}:ROOT root=/dev/mapper/ROOT %g" /etc/default/grub # sed -i "s%GRUB_CMDLINE_LINUX_DEFAULT=\"%GRUB_CMDLINE_LINUX_DEFAULT=\"cryptdevice=UUID=$encryped_partition_uuid:ROOT root=/dev/mapper/ROOT %g" /etc/default/grub
fi # fi
echo -e "Installing CyberRe Grub theme..." echo -e "Installing CyberRe Grub theme..."
THEME_DIR="/boot/grub/themes" THEME_DIR="/boot/grub/themes"
@ -31,13 +21,13 @@ THEME_NAME=CyberRe
echo -e "Creating the theme directory..." echo -e "Creating the theme directory..."
mkdir -p "${THEME_DIR}/${THEME_NAME}" mkdir -p "${THEME_DIR}/${THEME_NAME}"
echo -e "Copying the theme..." echo -e "Copying the theme..."
cd ${HOME}/ArchTitus cd "$HOME"/ArchTitus || exit 1
cp -a ${THEME_NAME}/* ${THEME_DIR}/${THEME_NAME} cp -a ${THEME_NAME}/* ${THEME_DIR}/${THEME_NAME}
echo -e "Backing up Grub config..." echo -e "Backing up Grub config..."
cp -an /etc/default/grub /etc/default/grub.bak cp -an /etc/default/grub /etc/default/grub.bak
echo -e "Setting the theme as the default..." echo -e "Setting the theme as the default..."
grep "GRUB_THEME=" /etc/default/grub 2>&1 >/dev/null && sed -i '/GRUB_THEME=/d' /etc/default/grub grep "GRUB_THEME=" /etc/default/grub >/dev/null 2>&1 && sed -i '/GRUB_THEME=/d' /etc/default/grub
echo "GRUB_THEME=\"${THEME_DIR}/${THEME_NAME}/theme.txt\"" >> /etc/default/grub echo "GRUB_THEME=\"${THEME_DIR}/${THEME_NAME}/theme.txt\"" >>/etc/default/grub
echo -e "Updating grub..." echo -e "Updating grub..."
grub-mkconfig -o /boot/grub/grub.cfg grub-mkconfig -o /boot/grub/grub.cfg
echo -e "All set!" echo -e "All set!"
@ -53,7 +43,7 @@ echo -ne "
Setting up SDDM Theme Setting up SDDM Theme
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
cat <<EOF > /etc/sddm.conf cat <<EOF >/etc/sddm.conf
[Theme] [Theme]
Current=Nordic Current=Nordic
EOF EOF
@ -81,7 +71,7 @@ sed -i 's/^%wheel ALL=(ALL) NOPASSWD: ALL/# %wheel ALL=(ALL) NOPASSWD: ALL/' /et
sed -i 's/^# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers sed -i 's/^# %wheel ALL=(ALL) ALL/%wheel ALL=(ALL) ALL/' /etc/sudoers
rm -r /root/ArchTitus rm -r /root/ArchTitus
rm -r /home/$USERNAME/ArchTitus rm -r /home/"$USERNAME"/ArchTitus
# Replace in the same state # Replace in the same state
cd $pwd cd "$(pwd)" || exit 1

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1091
# Find the name of the folder the scripts are in # Find the name of the folder the scripts are in
setfont ter-v22b setfont ter-v22b
@ -17,10 +18,10 @@ echo -ne "
Scripts are in directory named ArchTitus Scripts are in directory named ArchTitus
" "
bash startup.sh bash startup.sh
source $SCRIPT_DIR/setup.conf source "$SCRIPT_DIR"/setup.conf
bash 0-preinstall.sh bash 0-preinstall.sh
arch-chroot /mnt /root/ArchTitus/1-setup.sh arch-chroot /mnt /root/ArchTitus/1-setup.sh
arch-chroot /mnt /usr/bin/runuser -u $USERNAME -- /home/$USERNAME/ArchTitus/2-user.sh arch-chroot /mnt /usr/bin/runuser -u "$USERNAME" -- /home/"$USERNAME"/ArchTitus/2-user.sh
arch-chroot /mnt /root/ArchTitus/3-post-setup.sh arch-chroot /mnt /root/ArchTitus/3-post-setup.sh
echo -ne " echo -ne "

View File

@ -42,12 +42,12 @@ check_arch() {
} }
check_pacman() { check_pacman() {
if [[ -f /var/lib/pacman/db.lck ]]; then if [[ -f /var/lib/pacman/db.lck ]]; then
echo "ERROR! Pacman is blocked." echo "ERROR! Pacman is blocked."
echo "If not running remove /var/lib/pacman/db.lck." echo "If not running remove /var/lib/pacman/db.lck."
exit 1 exit 1
fi fi
} }
# Check for internet connection # Check for internet connection
connection_test() { connection_test() {
@ -155,7 +155,7 @@ elements_present() {
# Invalid option message # Invalid option message
invalid_option() { invalid_option() {
echo -ne "Please select a valid option: \n" echo -ne "Your selected option is invalid, retry \n"
} }
# Password helper function # Password helper function
@ -208,12 +208,17 @@ install_pkg () {
} }
refresh_pacman() { refresh_pacman() {
pacman -Syy pacman -Sy --noconfirm
}
something_failed() {
echo "Something is not right. Exiting."
exit 1
} }
# Setup for logging # Setup for logging
LOG="${SCRIPT_DIR}/main.log" # LOG="${SCRIPT_DIR}/main.log"
[[ -f \$LOG ]] && rm -f "\$LOG" # [[ -f \$LOG ]] && rm -f "\$LOG"
logo () { logo () {
echo -ne " echo -ne "
@ -263,7 +268,7 @@ background_check() {
check_arch check_arch
check_pacman check_pacman
efi_check efi_check
# check_root check_root
set_ntp set_ntp
do_curl do_curl
install_font install_font
@ -273,7 +278,7 @@ background_check() {
# This function will handle file systems. # This function will handle file systems.
set_filesystem() { set_filesystem() {
title "Setup File System" title "Setup File System"
FILESYS=("btrfs" "ext2" "ext3" "ext4" "f2fs" "jfs" "nilfs2" "ntfs" "reiserfs" "vfat" "xfs") FILESYS=("btrfs" "ext2" "ext3" "ext4" "f2fs" "jfs" "nilfs2" "ntfs" "vfat" "xfs")
PS3="$PROMPT" PS3="$PROMPT"
select OPT in "${FILESYS[@]}"; do select OPT in "${FILESYS[@]}"; do
if elements_present "$OPT" "${FILESYS[@]}"; then if elements_present "$OPT" "${FILESYS[@]}"; then
@ -455,17 +460,31 @@ disk_selection() {
user_info() { user_info() {
title "Add Your Information" title "Add Your Information"
read -r -p "Please enter your username [default is archtitus]: " USERNAME while true; do
if [[ -z "$USERNAME" ]]; then read -r -p "Please enter your username [default is archtitus]: " USERNAME
USERNAME="archtitus" if [[ -z "$USERNAME" ]]; then
fi set_option "USERNAME" "archtitus"
set_option "USERNAME" "${USERNAME,,}" # convert to lower case as in issue #109 elif [[ "${USERNAME,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]; then
set_option "USERNAME" "${USERNAME,,}" # convert to lower case as in issue #109
break
else
invalid_option
continue
fi
done
set_password "PASSWORD" set_password "PASSWORD"
read -r -p "Please enter your hostname [default is ArchLinux]: " HOSTNAME while true; do
if [[ -z "$HOSTNAME" ]]; then read -r -p "Please enter your hostname [default is archlinux]: " HOSTNAME
HOSTNAME="ArchLinux" if [[ -z "$HOSTNAME" ]]; then
fi set_option "HOSTNAME" "archlinux"
set_option "HOSTNAME" "$HOSTNAME" elif [[ "${HOSTNAME,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]; then
set_option "HOSTNAME" "${HOSTNAME,,}"
break
else
invalid_option
continue
fi
done
} }
# Set locale # Set locale
@ -488,67 +507,19 @@ set_locale() {
# Desktop selection # Desktop selection
set_desktop() { set_desktop() {
title "Select either desktop Environment or Window Manager" title "Select either desktop Environment or Window Manager"
SELECTION=("KDE" "Gnome" "XFCE" "Mate" "LXQT" "Minimal" "Awesome" "OpenBox" "i3" "i3-Gaps") SELECTION=("Default (KDE)" "Gnome" "XFCE" "Mate" "LXQT" "Minimal" "Awesome" "OpenBox" "i3" "i3-Gaps" "Deepin" "Budgie")
PS3="$PROMPT" PS3="$PROMPT"
select OPT in "${SELECTION[@]}"; do select OPT in "${SELECTION[@]}"; do
if elements_present "$OPT" "${SELECTION[@]}"; then if elements_present "$OPT" "${SELECTION[@]}"; then
case "$REPLY" in echo "${SELECTION[0]}"
1) if [[ "$OPT" == "Default (KDE)" ]]; then
# More packages can be added here set_option "DESKTOP" "default"
set_option "DE" "plasma"
set_option "DM" "sddm"
break break
;; else
2) set_option "DESKTOP" "${OPT,,}"
set_option "DE" "gnome"
set_option "DM" "gdm"
break break
;;
3) fi
set_option "DE" "xfce4"
set_option "DM" "lightdm"
break
;;
4)
set_option "DE" "mate"
set_option "DM" "lightdm"
break
;;
5)
set_option "DE" "lxqt"
set_option "DM" "lightdm"
break
;;
6)
set_option "DE" 0
set_option "DM" 0
break
;;
7)
set_option "DE" 0
set_option "WM" "awesome"
break
;;
8) # openbox
set_option "DE" 0
set_option "WM" "openbox"
break
;;
9) # i3
set_option "DE" 0
set_option "WM" "i3"
break
;;
10) # i3-gaps
set_option "DE" 0
set_option "WM" "i3-gaps"
break
;;
*)
echo "Wrong option. Try again"
break
;;
esac
else else
invalid_option invalid_option
set_desktop set_desktop
@ -588,8 +559,7 @@ make_choice() {
ssd_drive ssd_drive
set_btrfs set_btrfs
set_option "FS" "btrfs" set_option "FS" "btrfs"
set_option "DE" "plasma" set_option "DE" "default"
set_option "DM" "sddm"
set_option "LAYOUT" 1 set_option "LAYOUT" 1
break break
@ -629,4 +599,5 @@ background_check
clear clear
logo logo
make_choice make_choice
# user_info
# set_partion_layout # set_partion_layout