no layout
This commit is contained in:
parent
b293e2cf34
commit
57708e6b03
|
|
@ -17,7 +17,7 @@ make_boot() {
|
||||||
}
|
}
|
||||||
|
|
||||||
something_failed() {
|
something_failed() {
|
||||||
echo "Something failed. Exiting."
|
echo "Something is not right. Exiting."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,35 +63,46 @@ do_lvm() {
|
||||||
lvm_mount() {
|
lvm_mount() {
|
||||||
vgchange -ay &>/dev/null
|
vgchange -ay &>/dev/null
|
||||||
i=0
|
i=0
|
||||||
|
if [[ "$LUKS" -eq 1 ]]; then
|
||||||
|
LVM_PATH=/dev/mapper/
|
||||||
|
else
|
||||||
|
LVM_PATH=/dev/"$LVM_VG"/
|
||||||
|
fi
|
||||||
while [[ "$i" -le "${#LVM_PART_NUM[@]}" ]]; do
|
while [[ "$i" -le "${#LVM_PART_NUM[@]}" ]]; do
|
||||||
lvchange -ay /dev/"$LVM_VG"/"${LVM_NAMES[$i]}" &>/dev/null
|
lvchange -ay "$LVM_PATH""${LVM_NAMES[$i]}" &>/dev/null
|
||||||
do_format /dev/"$LVM_VG"/"${LVM_NAMES[$i]}"
|
do_format "$LVM_PATH""${LVM_NAMES[$i]}"
|
||||||
|
|
||||||
i=$((i + 1))
|
i=$((i + 1))
|
||||||
done
|
done
|
||||||
mount /dev/"$LVM_VG"/"${LVM_NAMES[0]}" "$MOUNTPOINT"
|
mount "$LVM_PATH""${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 "$LVM_PATH""$x" "$MOUNTPOINT"/"$x"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
do_partition() {
|
do_partition() {
|
||||||
if [[ "$UEFI" -eq 1 ]]; then
|
if [[ "$UEFI" -eq 1 ]]; then
|
||||||
sgdisk -Z "$DISK" # zap all on disk
|
sgdisk -Z "$DISK" # zap all on disk
|
||||||
sgdisk -a 2048 -o "$DISK" # new gpt disk 2048 alignment
|
sgdisk -a 2048 -o "$DISK" # new gpt disk 2048 alignment
|
||||||
sgdisk -n 1::+300M --typecode=1:ef00 --change-name=1:"$BOOT" "$DISK" # partition 2 (UEFI Boot Partition)
|
sgdisk -n 1::+300M --typecode=1:ef00 --change-name=1:"$BOOT" "$DISK" # partition 2 (UEFI Boot Partition)
|
||||||
sgdisk -n 2::-0 --typecode=2:8300 --change-name=2:"$ROOT" "$DISK" # partition 3 (Root), default start, remaining
|
sgdisk -n 2::-0 --typecode=2:8300 --change-name=2:"$ROOT" "$DISK" # partition 3 (Root), default start, remaining
|
||||||
else
|
else
|
||||||
sgdisk -Z "$DISK" # zap all on disk
|
sgdisk -Z "$DISK" # zap all on disk
|
||||||
sgdisk -a 2048 -o "$DISK"
|
sgdisk -a 2048 -o "$DISK"
|
||||||
sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:"BIOSBOOT" "$DISK" # partition 1 (BIOS Boot Partition)
|
sgdisk -n 1::+1M --typecode=1:ef02 --change-name=1:"BIOSBOOT" "$DISK" # partition 1 (BIOS Boot Partition)
|
||||||
sgdisk -n 2::-0 --typecode=2:8300 --change-name=2:"$ROOT" "$DISK"
|
sgdisk -n 2::-0 --typecode=2:8300 --change-name=2:"$ROOT" "$DISK"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# mount boot partition
|
||||||
|
mount_boot() {
|
||||||
|
if [[ "$UEFI" -eq 1 ]]; then
|
||||||
|
mkdir "$MOUNTPOINT"/boot
|
||||||
|
mount -t vfat -L EFIBOOT "$MOUNTPOINT"/boot/
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# format a partition from given list of filesystems
|
# format a partition from given list of filesystems
|
||||||
|
|
||||||
|
|
@ -100,11 +111,14 @@ title "Setting up mirrors for faster downloads"
|
||||||
install_pkg pacman-contrib reflector rsync gptfdisk btrfs-progs
|
install_pkg pacman-contrib reflector rsync gptfdisk btrfs-progs
|
||||||
|
|
||||||
sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
|
sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
|
||||||
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
|
|
||||||
|
if [[ ! -f /etc/pacman.d/mirrorlist.backup ]]; then
|
||||||
|
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
|
||||||
|
fi
|
||||||
|
|
||||||
# added https protocol for mirrors
|
# added https protocol for mirrors
|
||||||
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 /mnt &>/dev/null # Hiding error message if any
|
mkdir "$MOUNTPOINT" &>/dev/null # Hiding error message if any
|
||||||
|
|
||||||
title "Partitioning disk"
|
title "Partitioning disk"
|
||||||
if [[ "$SDD" -eq 1 ]]; then
|
if [[ "$SDD" -eq 1 ]]; then
|
||||||
|
|
@ -115,11 +129,11 @@ else
|
||||||
PART2=${DISK}2
|
PART2=${DISK}2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [[ "$LAYOUT" -eq 1 ]]; then
|
if [[ "$LAYOUT" -eq 1 ]]; then
|
||||||
do_partition
|
do_partition
|
||||||
make_boot
|
make_boot
|
||||||
do_btrfs "$ROOT" "$PART2"
|
do_btrfs "$ROOT" "$PART2"
|
||||||
|
mount_boot
|
||||||
|
|
||||||
elif [[ "$LVM" -eq 1 ]]; then
|
elif [[ "$LVM" -eq 1 ]]; then
|
||||||
do_partition
|
do_partition
|
||||||
|
|
@ -130,6 +144,7 @@ elif [[ "$LVM" -eq 1 ]]; then
|
||||||
vgcreate "$LVM_VG" "$PART2"
|
vgcreate "$LVM_VG" "$PART2"
|
||||||
do_lvm
|
do_lvm
|
||||||
lvm_mount
|
lvm_mount
|
||||||
|
mount_boot
|
||||||
|
|
||||||
elif [[ "$LUKS" -eq 1 ]]; then
|
elif [[ "$LUKS" -eq 1 ]]; then
|
||||||
do_partition
|
do_partition
|
||||||
|
|
@ -142,21 +157,24 @@ elif [[ "$LUKS" -eq 1 ]]; then
|
||||||
vgcreate "$LVM_VG" "$LUKS_PATH"
|
vgcreate "$LVM_VG" "$LUKS_PATH"
|
||||||
do_lvm
|
do_lvm
|
||||||
lvm_mount
|
lvm_mount
|
||||||
elif [[ "$LAYOUT" == 0 ]]; then
|
mount_boot
|
||||||
|
|
||||||
|
elif [[ "$LAYOUT" -eq 0 ]]; then
|
||||||
modprobe dm-mod
|
modprobe dm-mod
|
||||||
vgscan &>/dev/null
|
vgscan &>/dev/null
|
||||||
vgchange -ay &>/dev/null
|
vgchange -ay &>/dev/null
|
||||||
# need to address boot partition
|
do_format "$ROOT_PARTITION"
|
||||||
# need to get root partition
|
mount "$ROOT_PARTITION" "$MOUNTPOINT"
|
||||||
# need to format root partition
|
if [[ "$UEFI" -eq 1 ]]; then
|
||||||
|
mkfs.vfat -F32 -n "$BOOT" "$BOOT_PARTITION"
|
||||||
|
mount_boot
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
something_failed
|
something_failed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# mount target
|
|
||||||
mkdir "$MOUNTPOINT"/boot
|
|
||||||
mount -t vfat -L EFIBOOT "$MOUNTPOINT"/boot/
|
|
||||||
|
|
||||||
if ! grep -qs '/mnt' /proc/mounts; then
|
if ! grep -qs '/mnt' /proc/mounts; 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
|
||||||
|
|
@ -169,12 +187,12 @@ 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 /mnt base base-devel linux linux-firmware vim nano sudo archlinux-keyring wget libnewt --noconfirm --needed
|
||||||
echo "keyserver hkp://keyserver.ubuntu.com" >>/mnt/etc/pacman.d/gnupg/gpg.conf
|
echo "keyserver hkp://keyserver.ubuntu.com" >>"$MOUNTPOINT"/etc/pacman.d/gnupg/gpg.conf
|
||||||
|
|
||||||
genfstab -U /mnt >>/mnt/etc/fstab
|
genfstab -U "$MOUNTPOINT" >>"$MOUNTPOINT"/etc/fstab
|
||||||
|
|
||||||
cp -R "${SCRIPT_DIR}" /mnt/root/ArchTitus
|
cp -R "${SCRIPT_DIR}" "$MOUNTPOINT"/root/ArchTitus
|
||||||
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
|
cp /etc/pacman.d/mirrorlist "$MOUNTPOINT"/etc/pacman.d/mirrorlist
|
||||||
|
|
||||||
title "Checking for low memory systems <8G "
|
title "Checking for low memory systems <8G "
|
||||||
|
|
||||||
|
|
@ -182,15 +200,15 @@ title "Checking for low memory systems <8G "
|
||||||
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
|
||||||
# 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 /mnt/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 /mnt/opt/swap # apply NOCOW, btrfs needs that.
|
chattr +C "$MOUNTPOINT"/opt/swap # apply NOCOW, btrfs needs that.
|
||||||
dd if=/dev/zero of=/mnt/opt/swap/swapfile bs=1M count=2048 status=progress
|
dd if=/dev/zero of="$MOUNTPOINT"/opt/swap/swapfile bs=1M count=2048 status=progress
|
||||||
chmod 600 /mnt/opt/swap/swapfile # set permissions.
|
chmod 600 "$MOUNTPOINT"/opt/swap/swapfile # set permissions.
|
||||||
chown root /mnt/opt/swap/swapfile
|
chown root "$MOUNTPOINT"/opt/swap/swapfile
|
||||||
mkswap /mnt/opt/swap/swapfile
|
mkswap "$MOUNTPOINT"/opt/swap/swapfile
|
||||||
swapon /mnt/opt/swap/swapfile
|
swapon "$MOUNTPOINT"/opt/swap/swapfile
|
||||||
# The line below is written to /mnt/ but doesn't contain /mnt/, since it's just / for the system itself.
|
# The line below is written to /mnt/ but doesn't contain /mnt/, since it's just / for the system itself.
|
||||||
echo "/opt/swap/swapfile none swap sw 0 0" >>/mnt/etc/fstab # Add swap to fstab, so it KEEPS working after installation.
|
echo "/opt/swap/swapfile none swap sw 0 0" >>"$MOUNTPOINT"/etc/fstab # Add swap to fstab, so it KEEPS working after installation.
|
||||||
fi
|
fi
|
||||||
|
|
||||||
title "SYSTEM READY FOR 1-setup.sh"
|
title "SYSTEM READY FOR 1-setup.sh"
|
||||||
|
|
|
||||||
52
startup.sh
52
startup.sh
|
|
@ -270,6 +270,23 @@ background_check() {
|
||||||
setfont ter-v22b
|
setfont ter-v22b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# This function will handle file systems.
|
||||||
|
set_filesystem() {
|
||||||
|
title "Setup File System"
|
||||||
|
FILESYS=("btrfs" "ext2" "ext3" "ext4" "f2fs" "jfs" "nilfs2" "ntfs" "reiserfs" "vfat" "xfs")
|
||||||
|
PS3="$PROMPT"
|
||||||
|
select OPT in "${FILESYS[@]}"; do
|
||||||
|
if elements_present "$OPT" "${FILESYS[@]}"; then
|
||||||
|
set_option "FS" "$OPT"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
invalid_option
|
||||||
|
set_filesystem
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Set partioning layouts
|
# Set partioning layouts
|
||||||
set_partion_layout() {
|
set_partion_layout() {
|
||||||
title "Setup Partioning Layout"
|
title "Setup Partioning Layout"
|
||||||
|
|
@ -291,21 +308,33 @@ set_partion_layout() {
|
||||||
3)
|
3)
|
||||||
set_lvm
|
set_lvm
|
||||||
set_option "LUKS" 1
|
set_option "LUKS" 1
|
||||||
set_option "LUKS_PATH" "/dev/mapper/ROOT"
|
set_option "LUKS_PATH" "/dev/mapper/luks"
|
||||||
set_password "LUKS_PASSWORD"
|
set_password "LUKS_PASSWORD"
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
4)
|
4)
|
||||||
echo -ne "Maintaining current settings"
|
echo -ne "Maintaining current settings"
|
||||||
CHOICE=($(lsblk | grep 'part' | awk '{print "/dev/" substr($1,3)}'))
|
CHOICE=($(lsblk | grep 'part' | awk '{print "/dev/" substr($1,3)}'))
|
||||||
|
if [[ -d "/sys/firmware/efi/" ]]; then
|
||||||
|
echo "Select your boot partition"
|
||||||
|
PS3="$PROMPT"
|
||||||
|
select OPT in "${CHOICE[@]}"; do
|
||||||
|
if elements_present "$OPT" "${CHOICE[@]}"; then
|
||||||
|
set_option "LAYOUT" 0
|
||||||
|
set_option "BOOT_PARTITION" "$OPT"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
echo "Select your root partition"
|
||||||
PS3="$PROMPT"
|
PS3="$PROMPT"
|
||||||
select OPT in "${CHOICE[@]}"; do
|
select OPT in "${CHOICE[@]}"; do
|
||||||
if elements_present "$OPT" "${CHOICE[@]}"; then
|
if elements_present "$OPT" "${CHOICE[@]}"; then
|
||||||
set_option "LAYOUT" 0
|
set_option "ROOT_PARTITION" "$OPT"
|
||||||
set_option "PARTITION" "$OPT"
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
set_filesystem
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
@ -321,23 +350,6 @@ set_partion_layout() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function will handle file systems.
|
|
||||||
set_filesystem() {
|
|
||||||
title "Setup File System"
|
|
||||||
FILESYS=("btrfs" "ext2" "ext3" "ext4" "f2fs" "jfs" "nilfs2" "ntfs" "reiserfs" "vfat" "xfs")
|
|
||||||
PS3="$PROMPT"
|
|
||||||
select OPT in "${FILESYS[@]}"; do
|
|
||||||
if elements_present "$OPT" "${FILESYS[@]}"; then
|
|
||||||
set_option "FS" "$OPT"
|
|
||||||
break
|
|
||||||
else
|
|
||||||
invalid_option
|
|
||||||
set_filesystem
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Added this from arch wiki https://wiki.archlinux.org/title/System_time
|
# Added this from arch wiki https://wiki.archlinux.org/title/System_time
|
||||||
set_timezone() {
|
set_timezone() {
|
||||||
title "Setup Time Zone"
|
title "Setup Time Zone"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue