Merge pull request #173 from khaneliman/logging

Add log files for scripts
This commit is contained in:
Chris Titus 2022-01-13 10:21:18 -06:00 committed by GitHub
commit 4b146c4975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 53 deletions

View File

@ -81,19 +81,25 @@ mountallsubvol () {
} }
if [[ "${DISK}" =~ "nvme" ]]; then if [[ "${DISK}" =~ "nvme" ]]; then
if [[ "${FS}" == "btrfs" ]]; then partition2=${DISK}p2
mkfs.vfat -F32 -n "EFIBOOT" ${DISK}p2 partition3=${DISK}p3
mkfs.btrfs -L ROOT ${DISK}p3 -f else
mount -t btrfs ${DISK}p3 /mnt partition2=${DISK}2
elif [[ "${FS}" == "ext4" ]]; then partition3=${DISK}3
mkfs.vfat -F32 -n "EFIBOOT" ${DISK}p2 fi
mkfs.ext4 -L ROOT ${DISK}p3
mount -t ext4 ${DISK}p3 /mnt
elif [[ "${FS}" == "luks" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${DISK}p2
# enter luks password to cryptsetup and format root partition
echo -n "${luks_password}" | cryptsetup -v luksFormat ${DISK}p3 -
if [[ "${FS}" == "btrfs" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${partition2}
mkfs.btrfs -L ROOT ${partition3} -f
mount -t btrfs ${partition3} /mnt
elif [[ "${FS}" == "ext4" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${partition2}
mkfs.ext4 -L ROOT ${partition3}
mount -t ext4 ${partition3} /mnt
elif [[ "${FS}" == "luks" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${partition2}
# enter luks password to cryptsetup and format root partition
echo -n "${luks_password}" | cryptsetup -y -v luksFormat ${partition3} -
# 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 ${partition3} ROOT -
# now format that container # now format that container
@ -103,42 +109,13 @@ if [[ "${DISK}" =~ "nvme" ]]; then
createsubvolumes createsubvolumes
umount /mnt umount /mnt
# mount @ subvolume # mount @ subvolume
mount -o ${mountoptions},subvol=@ /dev/mapper/ROOT /mnt
mount -o ${mountoptions},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
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 encryped_partition_uuid=$(blkid -s UUID -o value ${partition3}) >> setup.conf
mountallsubvol
fi
else
if [[ "${FS}" == "btrfs" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${DISK}2
mkfs.btrfs -f -L ROOT ${DISK}3
mount -t btrfs ${DISK}3 /mnt
elif [[ "${FS}" == "ext4" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${DISK}2
mkfs.ext4 -L ROOT ${DISK}3
mount -t ext4 ${DISK}3 /mnt
elif [[ "${FS}" == "luks" ]]; then
mkfs.vfat -F32 -n "EFIBOOT" ${DISK}2
echo -n "${luks_password}" | cryptsetup -v luksFormat ${DISK}3 -
echo -n "${luks_password}" | cryptsetup open ${DISK}3 ROOT -
mkfs.btrfs -L ROOT /dev/mapper/ROOT
mount -t btrfs /dev/mapper/ROOT /mnt
createsubvolumes
umount /mnt
# mount all the subvolumes
mount -o ${mountoptions},subvol=@ /dev/mapper/ROOT /mnt
# make directories home, .snapshots, var, tmp
mkdir -p /mnt/{home,var,tmp,.snapshots}
# mount subvolumes
mountallsubvol
fi
fi fi
# checking if user selected btrfs # checking if user selected btrfs

View File

@ -103,7 +103,7 @@ 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 grep -E "Radeon" <<< ${gpu_type}; 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
@ -159,7 +159,7 @@ 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

View File

@ -80,7 +80,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

View File

@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
# Find the name of the folder the scripts are in # Find the name of the folder the scripts are in
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
echo -ne " echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
@ -16,12 +15,12 @@ echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------
Scripts are in directory named ArchTitus Scripts are in directory named ArchTitus
" "
bash startup.sh ( bash startup.sh )|& tee startup.log
source $SCRIPT_DIR/setup.conf source $SCRIPT_DIR/setup.conf
bash 0-preinstall.sh ( bash 0-preinstall.sh )|& tee 0-preinstall.log
arch-chroot /mnt /root/ArchTitus/1-setup.sh ( arch-chroot /mnt /root/ArchTitus/1-setup.sh )|& tee 1-setup.log
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 )|& tee 2-user.log
arch-chroot /mnt /root/ArchTitus/3-post-setup.sh ( arch-chroot /mnt /root/ArchTitus/3-post-setup.sh )|& tee 3-post-setup.log
echo -ne " echo -ne "
------------------------------------------------------------------------- -------------------------------------------------------------------------