Fix typos and make naming convention consistent

This commit is contained in:
Austin Horstman 2022-01-10 20:33:03 -06:00
parent b75139876b
commit ae085b9348
5 changed files with 81 additions and 81 deletions

View File

@ -23,7 +23,7 @@ echo -ne "
Setting up mirrors for optimal download Setting up mirrors for optimal download
" "
source setup.conf source setup.conf
iso=$(curl -4 ifconfig.co/country-iso) ISO=$(curl -4 ifconfig.co/country-iso)
timedatectl set-ntp true timedatectl set-ntp true
pacman -S --noconfirm pacman-contrib terminus-font pacman -S --noconfirm pacman-contrib terminus-font
setfont ter-v22b setfont ter-v22b
@ -32,10 +32,10 @@ pacman -S --noconfirm reflector rsync grub
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
echo -ne " echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
Setting up $iso mirrors for faster downloads Setting up $ISO mirrors for faster downloads
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
reflector -a 48 -c $iso -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist reflector -a 48 -c $ISO -f 5 -l 20 --sort rate --save /etc/pacman.d/mirrorlist
mkdir /mnt &>/dev/null # Hiding error message if any mkdir /mnt &>/dev/null # Hiding error message if any
echo -ne " echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
@ -74,34 +74,34 @@ createsubvolumes () {
} }
mountallsubvol () { mountallsubvol () {
mount -o ${mountoptions},subvol=@home /dev/mapper/ROOT /mnt/home mount -o ${MOUNT_OPTIONS},subvol=@home /dev/mapper/ROOT /mnt/home
mount -o ${mountoptions},subvol=@tmp /dev/mapper/ROOT /mnt/tmp mount -o ${MOUNT_OPTIONS},subvol=@tmp /dev/mapper/ROOT /mnt/tmp
mount -o ${mountoptions},subvol=@.snapshots /dev/mapper/ROOT /mnt/.snapshots mount -o ${MOUNT_OPTIONS},subvol=@.snapshots /dev/mapper/ROOT /mnt/.snapshots
mount -o ${mountoptions},subvol=@var /dev/mapper/ROOT /mnt/var mount -o ${MOUNT_OPTIONS},subvol=@var /dev/mapper/ROOT /mnt/var
} }
if [[ "${DISK}" =~ "nvme" ]]; then if [[ "${DISK}" =~ "nvme" ]]; then
partition2=${DISK}p2 PARTITION_2=${DISK}p2
partition3=${DISK}p3 PARTITION_3=${DISK}p3
else else
partition2=${DISK}2 PARTITION_2=${DISK}2
partition3=${DISK}3 PARTITION_3=${DISK}3
fi fi
if [[ "${FS}" == "btrfs" ]]; then if [[ "${FS}" == "btrfs" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${partition2} mkfs.vfat -F32 -n "EFIBOOT" ${PARTITION_2}
mkfs.btrfs -L ROOT ${partition3} -f mkfs.btrfs -L ROOT ${PARTITION_3} -f
mount -t btrfs ${partition3} /mnt mount -t btrfs ${PARTITION_3} /mnt
elif [[ "${FS}" == "ext4" ]]; then elif [[ "${FS}" == "ext4" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${partition2} mkfs.vfat -F32 -n "EFIBOOT" ${PARTITION_2}
mkfs.ext4 -L ROOT ${partition3} mkfs.ext4 -L ROOT ${PARTITION_3}
mount -t ext4 ${partition3} /mnt mount -t ext4 ${PARTITION_3} /mnt
elif [[ "${FS}" == "luks" ]]; then elif [[ "${FS}" == "luks" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${partition2} mkfs.vfat -F32 -n "EFIBOOT" ${PARTITION_2}
# 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 ${partition3} - echo -n "${LUKS_PASSWORD}" | cryptsetup -y -v luksFormat ${PARTITION_3} -
# open luks container and ROOT will be place holder # open luks container and ROOT will be place holder
echo -n "${luks_password}" | cryptsetup open ${partition3} ROOT - echo -n "${LUKS_PASSWORD}" | cryptsetup open ${PARTITION_3} ROOT -
# now format that container # now format that container
mkfs.btrfs -L ROOT /dev/mapper/ROOT mkfs.btrfs -L ROOT /dev/mapper/ROOT
# create subvolumes for btrfs # create subvolumes for btrfs
@ -109,13 +109,13 @@ elif [[ "${FS}" == "luks" ]]; then
createsubvolumes createsubvolumes
umount /mnt umount /mnt
# mount @ subvolume # mount @ subvolume
mount -o ${mountoptions},subvol=@ /dev/mapper/ROOT /mnt mount -o ${MOUNT_OPTIONS},subvol=@ /dev/mapper/ROOT /mnt
# make directories home, .snapshots, var, tmp # make directories home, .snapshots, var, tmp
mkdir -p /mnt/{home,var,tmp,.snapshots} mkdir -p /mnt/{home,var,tmp,.snapshots}
# mount subvolumes # mount subvolumes
mountallsubvol mountallsubvol
# store uuid of encrypted partition for grub # store uuid of encrypted partition for grub
echo encryped_partition_uuid=$(blkid -s UUID -o value ${partition3}) >> setup.conf echo ENCRYPTED_PARTITION_UUID=$(blkid -s UUID -o value ${PARTITION_3}) >> setup.conf
fi fi
# checking if user selected btrfs # checking if user selected btrfs
@ -161,8 +161,8 @@ echo -ne "
Checking for low memory systems <8G Checking for low memory systems <8G
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') TOTAL_MEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')
if [[ $TOTALMEM -lt 8000000 ]]; then if [[ $TOTAL_MEM -lt 8000000 ]]; then
# 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 /mnt/opt/swap # make a dir that we can apply NOCOW to to make it btrfs-friendly. mkdir /mnt/opt/swap # make a dir that we can apply NOCOW to to make it btrfs-friendly.
chattr +C /mnt/opt/swap # apply NOCOW, btrfs needs that. chattr +C /mnt/opt/swap # apply NOCOW, btrfs needs that.

View File

@ -29,18 +29,18 @@ pacman -S --noconfirm pacman-contrib curl
pacman -S --noconfirm reflector rsync pacman -S --noconfirm reflector rsync
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
nc=$(grep -c ^processor /proc/cpuinfo) NC=$(grep -c ^processor /proc/cpuinfo)
echo -ne " echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
You have " $nc" cores. And You have " $NC" cores. And
changing the makeflags for "$nc" cores. Aswell as changing the makeflags for "$NC" cores. Aswell as
changing the compression settings. changing the compression settings.
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
TOTALMEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*') TOTAL_MEM=$(cat /proc/meminfo | grep -i 'memtotal' | grep -o '[[:digit:]]*')
if [[ $TOTALMEM -gt 8000000 ]]; then if [[ $TOTAL_MEM -gt 8000000 ]]; then
sed -i "s/#MAKEFLAGS=\"-j2\"/MAKEFLAGS=\"-j$nc\"/g" /etc/makepkg.conf 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/COMPRESSXZ=(xz -c -z -)/COMPRESSXZ=(xz -c -T $NC -z -)/g" /etc/makepkg.conf
fi fi
echo -ne " echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
@ -71,10 +71,10 @@ echo -ne "
Installing Base System Installing Base System
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
cat /root/ArchTitus/pkg-files/pacman-pkgs.txt | while read line cat /root/ArchTitus/pkg-files/pacman-pkgs.txt | while read LINE
do do
echo "INSTALLING: ${line}" echo "INSTALLING: ${LINE}"
sudo pacman -S --noconfirm --needed ${line} sudo pacman -S --noconfirm --needed ${LINE}
done done
echo -ne " echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
@ -82,12 +82,12 @@ echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
# determine processor type and install microcode # determine processor type and install microcode
proc_type=$(lscpu) PROC_TYPE=$(lscpu)
if grep -E "GenuineIntel" <<< ${proc_type}; then if grep -E "GenuineIntel" <<< ${PROC_TYPE}; then
echo "Installing Intel microcode" echo "Installing Intel microcode"
pacman -S --noconfirm intel-ucode pacman -S --noconfirm intel-ucode
proc_ucode=intel-ucode.img proc_ucode=intel-ucode.img
elif grep -E "AuthenticAMD" <<< ${proc_type}; then elif grep -E "AuthenticAMD" <<< ${PROC_TYPE}; then
echo "Installing AMD microcode" echo "Installing AMD microcode"
pacman -S --noconfirm amd-ucode pacman -S --noconfirm amd-ucode
proc_ucode=amd-ucode.img proc_ucode=amd-ucode.img
@ -99,15 +99,15 @@ echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
" "
# Graphics Drivers find and install # Graphics Drivers find and install
gpu_type=$(lspci) GPU_TYPE=$(lspci)
if grep -E "NVIDIA|GeForce" <<< ${gpu_type}; then if grep -E "NVIDIA|GeForce" <<< ${GPU_TYPE}; then
pacman -S nvidia --noconfirm --needed pacman -S nvidia --noconfirm --needed
nvidia-xconfig nvidia-xconfig
elif lspci | grep 'VGA' | grep -E "Radeon|AMD"; then elif lspci | grep 'VGA' | grep -E "Radeon|AMD"; then
pacman -S xf86-video-amdgpu --noconfirm --needed pacman -S xf86-video-amdgpu --noconfirm --needed
elif grep -E "Integrated Graphics Controller" <<< ${gpu_type}; then 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 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 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 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 #SETUP IS WRONG THIS IS RUN
@ -115,28 +115,28 @@ if ! source /root/ArchTitus/setup.conf; then
# Loop through user input until the user gives a valid username # Loop through user input until the user gives a valid username
while true while true
do do
read -p "Please enter username:" username 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 # 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 # lowercase the username to test regex
if [[ "${username,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]] if [[ "${USERNAME,,}" =~ ^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\$)$ ]]
then then
break break
fi fi
echo "Incorrect username." echo "Incorrect username."
done done
# convert name to lowercase before saving to setup.conf # convert name to lowercase before saving to setup.conf
echo "username=${username,,}" >> ${HOME}/ArchTitus/setup.conf echo "USERNAME=${USERNAME,,}" >> ${HOME}/ArchTitus/setup.conf
#Set Password #Set Password
read -p "Please enter password:" password read -p "Please enter password:" PASSWORD
echo "password=${password,,}" >> ${HOME}/ArchTitus/setup.conf echo "PASSWORD=${PASSWORD,,}" >> ${HOME}/ArchTitus/setup.conf
# Loop through user input until the user gives a valid hostname, but allow the user to force save # Loop through user input until the user gives a valid hostname, but allow the user to force save
while true while true
do do
read -p "Please name your machine:" nameofmachine read -p "Please name your machine:" NAME_OF_MACHINE
# hostname regex (!!couldn't find spec for computer name!!) # hostname regex (!!couldn't find spec for computer name!!)
if [[ "${nameofmachine,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]] if [[ "${NAME_OF_MACHINE,,}" =~ ^[a-z][a-z0-9_.-]{0,62}[a-z0-9]$ ]]
then then
break break
fi fi
@ -148,7 +148,7 @@ echo "password=${password,,}" >> ${HOME}/ArchTitus/setup.conf
fi fi
done done
echo "nameofmachine=${nameofmachine,,}" >> ${HOME}/ArchTitus/setup.conf echo "NAME_OF_MACHINE=${NAME_OF_MACHINE,,}" >> ${HOME}/ArchTitus/setup.conf
fi fi
echo -ne " echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
@ -159,19 +159,19 @@ if [ $(whoami) = "root" ]; then
groupadd libvirt groupadd libvirt
useradd -m -G wheel,libvirt -s /bin/bash $USERNAME 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 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 $NAME_OF_MACHINE to /etc/hostname
echo $nameofmachine > /etc/hostname echo $NAME_OF_MACHINE > /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 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 sed -i 's/filesystems/eNCrypt filesystems/g' /etc/mkinitcpio.conf
# making mkinitcpio with linux kernel # making mkinitcpio with linux kernel
mkinitcpio -p linux mkinitcpio -p linux
fi fi

View File

@ -21,7 +21,7 @@ if [[ -d "/sys/firmware/efi" ]]; then
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=${ENCRYPTED_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..."
@ -83,4 +83,4 @@ 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

View File

@ -1,3 +1,3 @@
hostname=host HOSTNAME=host
username=titus USERNAME=titus
password=1234 PASSWORD=1234

View File

@ -48,8 +48,8 @@ case $FS in
2) set_option FS ext4;; 2) set_option FS ext4;;
3) 3)
echo -ne "Please enter your luks password: " echo -ne "Please enter your luks password: "
read -s luks_password # read password without echo read -s LUKS_PASSWORD # read password without echo
set_option luks_password $luks_password set_option LUKS_PASSWORD $LUKS_PASSWORD
set_option FS luks;; set_option FS luks;;
0) exit ;; 0) exit ;;
*) echo "Wrong option please select again"; filesystem;; *) echo "Wrong option please select again"; filesystem;;
@ -57,17 +57,17 @@ esac
} }
timezone () { timezone () {
# Added this from arch wiki https://wiki.archlinux.org/title/System_time # Added this from arch wiki https://wiki.archlinux.org/title/System_time
time_zone="$(curl --fail https://ipapi.co/timezone)" TIME_ZONE="$(curl --fail https://ipapi.co/timezone)"
echo -ne "System detected your timezone to be '$time_zone' \n" echo -ne "System detected your timezone to be '$TIME_ZONE' \n"
echo -ne "Is this correct? yes/no:" echo -ne "Is this correct? yes/no:"
read answer read answer
case $answer in case $answer in
y|Y|yes|Yes|YES) y|Y|yes|Yes|YES)
set_option TIMEZONE $time_zone;; set_option TIMEZONE $TIME_ZONE;;
n|N|no|NO|No) n|N|no|NO|No)
echo "Please enter your desired timezone e.g. Europe/London :" echo "Please enter your desired timezone e.g. Europe/London :"
read new_timezone read NEW_TIMEZONE
set_option TIMEZONE $new_timezone;; set_option TIMEZONE $NEW_TIMEZONE;;
*) echo "Wrong option. Try again";timezone;; *) echo "Wrong option. Try again";timezone;;
esac esac
} }
@ -104,21 +104,21 @@ Please select key board layout from this list
-us -us
" "
read -p "Your key boards layout:" keymap read -p "Your key boards layout:" KEYMAP
set_option KEYMAP $keymap set_option KEYMAP $KEYMAP
} }
drivessd () { drivessd () {
echo -ne " echo -ne "
Is this an ssd? yes/no: Is this an ssd? yes/no:
" "
read ssd_drive read SSD_DRIVE
case $ssd_drive in case $SSD_DRIVE in
y|Y|yes|Yes|YES) y|Y|yes|Yes|YES)
echo "mountoptions=noatime,compress=zstd,ssd,commit=120" >> setup.conf;; echo "MOUNT_OPTIONS=noatime,compress=zstd,ssd,commit=120" >> setup.conf;;
n|N|no|NO|No) n|N|no|NO|No)
echo "mountoptions=noatime,compress=zstd,commit=120" >> setup.conf;; echo "MOUNT_OPTIONS=noatime,compress=zstd,commit=120" >> setup.conf;;
*) echo "Wrong option. Try again";drivessd;; *) echo "Wrong option. Try again";drivessd;;
esac esac
} }
@ -136,20 +136,20 @@ echo -ne "
Please enter full path to disk: (example /dev/sda): Please enter full path to disk: (example /dev/sda):
" "
read option read OPTION
echo "DISK=$option" >> setup.conf echo "DISK=$OPTION" >> setup.conf
drivessd drivessd
set_option DISK $option set_option DISK $OPTION
} }
userinfo () { userinfo () {
read -p "Please enter your username: " username read -p "Please enter your username: " USERNAME
set_option USERNAME ${username,,} # convert to lower case as in issue #109 set_option USERNAME ${USERNAME,,} # convert to lower case as in issue #109
echo -ne "Please enter your password: \n" echo -ne "Please enter your password: \n"
read -s password # read password without echo read -s PASSWORD # read password without echo
set_option PASSWORD $password set_option PASSWORD $PASSWORD
read -rep "Please enter your hostname: " nameofmachine read -rep "Please enter your hostname: " NAME_OF_MACHINE
set_option nameofmachine $nameofmachine set_option NAME_OF_MACHINE $NAME_OF_MACHINE
} }
# More features in future # More features in future
# language (){} # language (){}