updates reg. DE FS PL etc
This commit is contained in:
parent
dde58e77b8
commit
10baa963dd
|
|
@ -16,11 +16,6 @@ make_boot() {
|
|||
fi
|
||||
}
|
||||
|
||||
something_failed() {
|
||||
echo "Something is not right. Exiting."
|
||||
exit 1
|
||||
}
|
||||
|
||||
do_btrfs() {
|
||||
mkfs.btrfs -L "$1" "$2" -f
|
||||
mount -t btrfs "$2" "$MOUNTPOINT"
|
||||
|
|
@ -41,10 +36,47 @@ do_btrfs() {
|
|||
}
|
||||
|
||||
do_format() {
|
||||
mkfs."$FS" "$1" \
|
||||
"$([[ $FS == xfs || $FS == btrfs || $FS == reiserfs ]] && echo "-f")" \
|
||||
"$([[ $FS == vfat ]] && echo "-F32")" \
|
||||
"$([[ $FS == ext4 ]] && echo "-E discard -F")"
|
||||
case "$FS" in
|
||||
"xfs")
|
||||
install_pkg xfsprogs
|
||||
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))
|
||||
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
|
||||
mkdir "$MOUNTPOINT"/"$x"
|
||||
mount /dev/"$LVM_VG"/"$x" "$MOUNTPOINT"/"$x"
|
||||
mount -t "$FS" /dev/"$LVM_VG"/"$x" "$MOUNTPOINT"/"$x"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +135,7 @@ mount_boot() {
|
|||
|
||||
logo
|
||||
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
|
||||
|
||||
|
|
@ -115,7 +147,7 @@ fi
|
|||
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
|
||||
|
||||
title "Partitioning disk"
|
||||
title "File system setup"
|
||||
if [[ "$SDD" -eq 1 ]]; then
|
||||
PART1=${DISK}p1
|
||||
PART2=${DISK}p2
|
||||
|
|
@ -123,6 +155,7 @@ else
|
|||
PART1=${DISK}1
|
||||
PART2=${DISK}2
|
||||
fi
|
||||
_PART_UUID=$(blkid -s UUID -o value "$PART2")
|
||||
|
||||
if [[ "$LAYOUT" -eq 1 ]]; then
|
||||
do_partition
|
||||
|
|
@ -140,6 +173,7 @@ elif [[ "$LVM" -eq 1 ]]; then
|
|||
do_lvm
|
||||
lvm_mount
|
||||
mount_boot
|
||||
set_option "HOOKS" "(lvm2 filesystems)"
|
||||
|
||||
elif [[ "$LUKS" -eq 1 ]]; then
|
||||
do_partition
|
||||
|
|
@ -147,12 +181,16 @@ elif [[ "$LUKS" -eq 1 ]]; then
|
|||
# enter luks password to cryptsetup and format root partition
|
||||
echo -n "$LUKS_PASSWORD" | cryptsetup -y -v luksFormat "$PART2" -
|
||||
# open luks container and ROOT will be place holder
|
||||
# $LUKS_PATH "/dev/mapper/luks"
|
||||
echo -n "$LUKS_PASSWORD" | cryptsetup open "$PART2" luks -
|
||||
pvcreate "$LUKS_PATH"
|
||||
vgcreate "$LVM_VG" "$LUKS_PATH"
|
||||
do_lvm
|
||||
lvm_mount
|
||||
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
|
||||
modprobe dm-mod
|
||||
|
|
@ -166,22 +204,22 @@ elif [[ "$LAYOUT" -eq 0 ]]; then
|
|||
fi
|
||||
|
||||
else
|
||||
|
||||
something_failed
|
||||
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 "Rebooting in 3 Seconds ..." && sleep 1
|
||||
echo "Rebooting in 2 Seconds ..." && sleep 1
|
||||
echo "Rebooting in 1 Second ..." && sleep 1
|
||||
reboot now
|
||||
# reboot now
|
||||
exit 1
|
||||
fi
|
||||
|
||||
title "Arch Install on Main Drive"
|
||||
# for test purposes
|
||||
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
|
||||
|
||||
genfstab -U "$MOUNTPOINT" >>"$MOUNTPOINT"/etc/fstab
|
||||
|
|
@ -189,11 +227,11 @@ genfstab -U "$MOUNTPOINT" >>"$MOUNTPOINT"/etc/fstab
|
|||
cp -R "${SCRIPT_DIR}" "$MOUNTPOINT"/root/ArchTitus
|
||||
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=$(grep -i "memtotal" "/proc/meminfo" | grep -o '[[:digit:]]*')
|
||||
TOTALMEM="$(grep -i "memtotal" "/proc/meminfo" | grep -o '[[:digit:]]*')"
|
||||
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.
|
||||
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.
|
||||
|
|
|
|||
297
1-setup.sh
297
1-setup.sh
|
|
@ -1,60 +1,54 @@
|
|||
#!/usr/bin/env bash
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
|
||||
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
|
||||
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
|
||||
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
|
||||
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
|
||||
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
|
||||
-------------------------------------------------------------------------
|
||||
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
|
||||
# shellcheck disable=SC1091
|
||||
# shellcheck source=./setup.conf
|
||||
|
||||
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 "
|
||||
-------------------------------------------------------------------------
|
||||
You have " $nc" cores. And
|
||||
changing the makeflags for "$nc" cores. Aswell as
|
||||
You have \"$CPU\" cores. And
|
||||
changing the makeflags for \"$CPU\" cores. As well as
|
||||
changing the compression settings.
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')
|
||||
|
||||
TOTALMEM="$(grep -i "memtotal" "/proc/meminfo" | grep -o '[[:digit:]]*')"
|
||||
if [[ $TOTALMEM -gt 8000000 ]]; then
|
||||
sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$nc\"/g" /etc/makepkg.conf
|
||||
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
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
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
|
||||
|
||||
title Setup Language 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
|
||||
|
||||
locale-gen
|
||||
timedatectl --no-ask-password set-timezone ${TIMEZONE}
|
||||
timedatectl --no-ask-password set-timezone "$TIMEZONE"
|
||||
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
|
||||
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
|
||||
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
|
||||
sed -i "/\[multilib\]/,/Include/"'s/^#//' /etc/pacman.conf
|
||||
pacman -Sy --noconfirm
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Installing Base System
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
cat /root/ArchTitus/pkg-files/pacman-pkgs.txt | while read line
|
||||
do
|
||||
echo "INSTALLING: ${line}"
|
||||
sudo pacman -S --noconfirm --needed ${line}
|
||||
done
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Installing Microcode
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
# pacman -Sy --noconfirm
|
||||
refresh_pacman
|
||||
|
||||
title Installing desktop
|
||||
case "$DESKTOP" in
|
||||
"default")
|
||||
# cat /root/ArchTitus/pkg-files/pacman-pkgs.txt | while read line
|
||||
while IFS= read -r LINE; do
|
||||
echo "INSTALLING: $LINE"
|
||||
install_pkg "$LINE"
|
||||
done </root/ArchTitus/pkg-files/pacman-pkgs.txt
|
||||
;;
|
||||
"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
|
||||
proc_type=$(lscpu)
|
||||
if grep -E "GenuineIntel" <<< ${proc_type}; then
|
||||
PROC_TYPE="$(lscpu | grep "Vendor ID:" | awk '{print $3}')"
|
||||
|
||||
case "$PROC_TYPE" in
|
||||
"GenuineIntel")
|
||||
echo "Installing Intel microcode"
|
||||
pacman -S --noconfirm intel-ucode
|
||||
proc_ucode=intel-ucode.img
|
||||
elif grep -E "AuthenticAMD" <<< ${proc_type}; then
|
||||
install_pkg intel-ucode
|
||||
;;
|
||||
"AuthenticAMD")
|
||||
echo "Installing AMD microcode"
|
||||
pacman -S --noconfirm amd-ucode
|
||||
proc_ucode=amd-ucode.img
|
||||
fi
|
||||
install_pkg amd-ucode
|
||||
;;
|
||||
*)
|
||||
something_failed
|
||||
;;
|
||||
esac
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
Installing Graphics Drivers
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
title Installing Graphics Drivers
|
||||
# Graphics Drivers find and install
|
||||
gpu_type=$(lspci)
|
||||
if grep -E "NVIDIA|GeForce" <<< ${gpu_type}; then
|
||||
pacman -S nvidia --noconfirm --needed
|
||||
nvidia-xconfig
|
||||
elif lspci | grep 'VGA' | grep -E "Radeon|AMD"; then
|
||||
pacman -S xf86-video-amdgpu --noconfirm --needed
|
||||
elif grep -E "Integrated Graphics Controller" <<< ${gpu_type}; then
|
||||
pacman -S libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel libva-intel-driver libva-utils lib32-mesa --needed --noconfirm
|
||||
elif grep -E "Intel Corporation UHD" <<< ${gpu_type}; then
|
||||
pacman -S libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel libva-intel-driver libva-utils lib32-mesa --needed --noconfirm
|
||||
if [[ "$(lspci | grep -E '(NVIDIA|GeForce)' -c)" -gt "0" ]]; then
|
||||
install_pkg "nvidia nvidia-utils libglvnd"
|
||||
elif [[ "$(lspci | grep -E '(Radeon|AMD)' -c)" -gt "0" ]]; then
|
||||
install_pkg "xf86-video-amdgpu mesa-libgl mesa-vdpau libvdpau-va-gl"
|
||||
elif [[ "$(lspci | grep -E '(Integrated Graphics Controller|Intel Corporation UHD)' -c)" -gt "0" ]]; then
|
||||
# install_pkg "libva-intel-driver libvdpau-va-gl lib32-vulkan-intel vulkan-intel libva-intel-driver libva-utils lib32-mesa"
|
||||
install_pkg "xf86-video-intel vulkan-radeon mesa-libgl mesa-vdpau libvdpau-va-gl"
|
||||
else
|
||||
echo "No graphics card found!"
|
||||
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
|
||||
read -p "Please enter password:" password
|
||||
echo "password=${password,,}" >> ${HOME}/ArchTitus/setup.conf
|
||||
title Adding User
|
||||
if [ "$(whoami)" = "root" ]; then
|
||||
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
|
||||
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
|
||||
# use chpasswd to enter $USERNAME:$password
|
||||
echo "$USERNAME:$PASSWORD" | chpasswd
|
||||
cp -R /root/ArchTitus /home/$USERNAME/
|
||||
chown -R $USERNAME: /home/$USERNAME/ArchTitus
|
||||
# enter $nameofmachine to /etc/hostname
|
||||
echo $nameofmachine > /etc/hostname
|
||||
cp -R /root/ArchTitus /home/"$USERNAME"/
|
||||
chown -R "$USERNAME": /home/"$USERNAME"/ArchTitus
|
||||
# enter $nameofmachine to /etc/hostname
|
||||
echo "$HOSTNAME" >>/etc/hostname
|
||||
else
|
||||
echo "You are already a user proceed with aur installs"
|
||||
fi
|
||||
if [[ ${FS} == "luks" ]]; then
|
||||
|
||||
# Making sure to edit mkinitcpio conf if luks is selected
|
||||
# add encrypt in mkinitcpio.conf before filesystems in hooks
|
||||
sed -i 's/filesystems/encrypt filesystems/g' /etc/mkinitcpio.conf
|
||||
# making mkinitcpio with linux kernel
|
||||
if [[ "$LVM" -eq 1 ]]; then
|
||||
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
|
||||
fi
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
SYSTEM READY FOR 2-user.sh
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
|
||||
title SYSTEM READY FOR 2-user.sh
|
||||
|
|
|
|||
49
2-user.sh
49
2-user.sh
|
|
@ -1,33 +1,31 @@
|
|||
#!/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. However I will leave this up to you.
|
||||
source $HOME/ArchTitus/setup.conf
|
||||
# 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.
|
||||
# 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"
|
||||
cd ~/yay
|
||||
cd ~/yay || exit 1
|
||||
makepkg -si --noconfirm
|
||||
cd ~
|
||||
touch "~/.cache/zshhistory"
|
||||
cd ~ || exit 1
|
||||
|
||||
touch "$HOME/.cache/zshhistory"
|
||||
git clone "https://github.com/ChrisTitusTech/zsh"
|
||||
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
|
||||
cp -r ~/ArchTitus/dotfiles/* ~/.config/
|
||||
|
|
@ -36,9 +34,4 @@ konsave -i ~/ArchTitus/kde.knsv
|
|||
sleep 1
|
||||
konsave -a kde
|
||||
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
SYSTEM READY FOR 3-post-setup.sh
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
exit
|
||||
title SYSTEM READY FOR 3-post-setup.sh
|
||||
|
|
|
|||
|
|
@ -1,29 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
echo -ne "
|
||||
-------------------------------------------------------------------------
|
||||
█████╗ ██████╗ ██████╗██╗ ██╗████████╗██╗████████╗██╗ ██╗███████╗
|
||||
██╔══██╗██╔══██╗██╔════╝██║ ██║╚══██╔══╝██║╚══██╔══╝██║ ██║██╔════╝
|
||||
███████║██████╔╝██║ ███████║ ██║ ██║ ██║ ██║ ██║███████╗
|
||||
██╔══██║██╔══██╗██║ ██╔══██║ ██║ ██║ ██║ ██║ ██║╚════██║
|
||||
██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ██║ ██║ ╚██████╔╝███████║
|
||||
╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝
|
||||
-------------------------------------------------------------------------
|
||||
Automated Arch Linux Installer
|
||||
SCRIPTHOME: ArchTitus
|
||||
-------------------------------------------------------------------------
|
||||
# shellcheck disable=SC1091
|
||||
# shellcheck source=./setup.conf
|
||||
|
||||
Final Setup and Configurations
|
||||
GRUB EFI Bootloader Install & Check
|
||||
"
|
||||
source /root/ArchTitus/setup.conf
|
||||
genfstab -U / >> /etc/fstab
|
||||
if [[ -d "/sys/firmware/efi" ]]; then
|
||||
grub-install --efi-directory=/boot ${DISK}
|
||||
CONFIG_FILE=$(pwd)/setup.conf
|
||||
if [[ -f "$CONFIG_FILE" ]]; then
|
||||
source "$CONFIG_FILE"
|
||||
else
|
||||
echo "Missing file: setup.conf"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# set kernel parameter for decrypting the drive
|
||||
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
|
||||
fi
|
||||
# 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
|
||||
# fi
|
||||
|
||||
echo -e "Installing CyberRe Grub theme..."
|
||||
THEME_DIR="/boot/grub/themes"
|
||||
|
|
@ -31,13 +21,13 @@ THEME_NAME=CyberRe
|
|||
echo -e "Creating the theme directory..."
|
||||
mkdir -p "${THEME_DIR}/${THEME_NAME}"
|
||||
echo -e "Copying the theme..."
|
||||
cd ${HOME}/ArchTitus
|
||||
cd "$HOME"/ArchTitus || exit 1
|
||||
cp -a ${THEME_NAME}/* ${THEME_DIR}/${THEME_NAME}
|
||||
echo -e "Backing up Grub config..."
|
||||
cp -an /etc/default/grub /etc/default/grub.bak
|
||||
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
|
||||
echo "GRUB_THEME=\"${THEME_DIR}/${THEME_NAME}/theme.txt\"" >> /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 -e "Updating grub..."
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
echo -e "All set!"
|
||||
|
|
@ -53,7 +43,7 @@ echo -ne "
|
|||
Setting up SDDM Theme
|
||||
-------------------------------------------------------------------------
|
||||
"
|
||||
cat <<EOF > /etc/sddm.conf
|
||||
cat <<EOF >/etc/sddm.conf
|
||||
[Theme]
|
||||
Current=Nordic
|
||||
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
|
||||
|
||||
rm -r /root/ArchTitus
|
||||
rm -r /home/$USERNAME/ArchTitus
|
||||
rm -r /home/"$USERNAME"/ArchTitus
|
||||
|
||||
# Replace in the same state
|
||||
cd $pwd
|
||||
cd "$(pwd)" || exit 1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# shellcheck disable=SC1091
|
||||
|
||||
# Find the name of the folder the scripts are in
|
||||
setfont ter-v22b
|
||||
|
|
@ -17,10 +18,10 @@ echo -ne "
|
|||
Scripts are in directory named ArchTitus
|
||||
"
|
||||
bash startup.sh
|
||||
source $SCRIPT_DIR/setup.conf
|
||||
source "$SCRIPT_DIR"/setup.conf
|
||||
bash 0-preinstall.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
|
||||
|
||||
echo -ne "
|
||||
|
|
|
|||
113
startup.sh
113
startup.sh
|
|
@ -155,7 +155,7 @@ elements_present() {
|
|||
|
||||
# Invalid option message
|
||||
invalid_option() {
|
||||
echo -ne "Please select a valid option: \n"
|
||||
echo -ne "Your selected option is invalid, retry \n"
|
||||
}
|
||||
|
||||
# Password helper function
|
||||
|
|
@ -208,12 +208,17 @@ install_pkg () {
|
|||
}
|
||||
|
||||
refresh_pacman() {
|
||||
pacman -Syy
|
||||
pacman -Sy --noconfirm
|
||||
}
|
||||
|
||||
something_failed() {
|
||||
echo "Something is not right. Exiting."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Setup for logging
|
||||
LOG="${SCRIPT_DIR}/main.log"
|
||||
[[ -f \$LOG ]] && rm -f "\$LOG"
|
||||
# LOG="${SCRIPT_DIR}/main.log"
|
||||
# [[ -f \$LOG ]] && rm -f "\$LOG"
|
||||
|
||||
logo () {
|
||||
echo -ne "
|
||||
|
|
@ -263,7 +268,7 @@ background_check() {
|
|||
check_arch
|
||||
check_pacman
|
||||
efi_check
|
||||
# check_root
|
||||
check_root
|
||||
set_ntp
|
||||
do_curl
|
||||
install_font
|
||||
|
|
@ -273,7 +278,7 @@ background_check() {
|
|||
# This function will handle file systems.
|
||||
set_filesystem() {
|
||||
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"
|
||||
select OPT in "${FILESYS[@]}"; do
|
||||
if elements_present "$OPT" "${FILESYS[@]}"; then
|
||||
|
|
@ -455,17 +460,31 @@ disk_selection() {
|
|||
|
||||
user_info() {
|
||||
title "Add Your Information"
|
||||
while true; do
|
||||
read -r -p "Please enter your username [default is archtitus]: " USERNAME
|
||||
if [[ -z "$USERNAME" ]]; then
|
||||
USERNAME="archtitus"
|
||||
fi
|
||||
set_option "USERNAME" "archtitus"
|
||||
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
|
||||
set_password "PASSWORD"
|
||||
read -r -p "Please enter your hostname [default is ArchLinux]: " HOSTNAME
|
||||
if [[ -z "$HOSTNAME" ]]; then
|
||||
HOSTNAME="ArchLinux"
|
||||
break
|
||||
else
|
||||
invalid_option
|
||||
continue
|
||||
fi
|
||||
set_option "HOSTNAME" "$HOSTNAME"
|
||||
done
|
||||
set_password "PASSWORD"
|
||||
while true; do
|
||||
read -r -p "Please enter your hostname [default is archlinux]: " HOSTNAME
|
||||
if [[ -z "$HOSTNAME" ]]; then
|
||||
set_option "HOSTNAME" "archlinux"
|
||||
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
|
||||
|
|
@ -488,67 +507,19 @@ set_locale() {
|
|||
# Desktop selection
|
||||
set_desktop() {
|
||||
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"
|
||||
select OPT in "${SELECTION[@]}"; do
|
||||
if elements_present "$OPT" "${SELECTION[@]}"; then
|
||||
case "$REPLY" in
|
||||
1)
|
||||
# More packages can be added here
|
||||
set_option "DE" "plasma"
|
||||
set_option "DM" "sddm"
|
||||
echo "${SELECTION[0]}"
|
||||
if [[ "$OPT" == "Default (KDE)" ]]; then
|
||||
set_option "DESKTOP" "default"
|
||||
break
|
||||
;;
|
||||
2)
|
||||
set_option "DE" "gnome"
|
||||
set_option "DM" "gdm"
|
||||
else
|
||||
set_option "DESKTOP" "${OPT,,}"
|
||||
break
|
||||
;;
|
||||
3)
|
||||
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
|
||||
|
||||
fi
|
||||
else
|
||||
invalid_option
|
||||
set_desktop
|
||||
|
|
@ -588,8 +559,7 @@ make_choice() {
|
|||
ssd_drive
|
||||
set_btrfs
|
||||
set_option "FS" "btrfs"
|
||||
set_option "DE" "plasma"
|
||||
set_option "DM" "sddm"
|
||||
set_option "DE" "default"
|
||||
set_option "LAYOUT" 1
|
||||
|
||||
break
|
||||
|
|
@ -629,4 +599,5 @@ background_check
|
|||
clear
|
||||
logo
|
||||
make_choice
|
||||
# user_info
|
||||
# set_partion_layout
|
||||
|
|
|
|||
Loading…
Reference in New Issue