You are not logged in.
I'm trying to automate my Arch Linux installation using a bash script. The script would allow me to choose between installing Arch on a single SSD or using a combination of SSD (for root and home) and HDD (for specific user directories like Downloads, Documents, etc.). I'd like some feedback on my approach and any potential improvements.
Here are the key features of my script:
1. Allows selection of filesystem (btrfs, ext4, or LUKS encryption)
2. Supports both BIOS and UEFI systems
3. Detects and installs appropriate graphics drivers
4. Sets up GRUB bootloader with a custom theme
5. Configures user accounts and sudo access
6. Handles different partition schemes based on disk selection
I'm particularly interested in feedback on:
- The overall structure and flow of the script
- Handling of different filesystem options, especially LUKS encryption
- The approach to setting up the secondary HDD for user directories
- Any potential security issues or best practices I might have missed
- Ways to make the script more robust and error-resistant
Here's a snippet of the disk partitioning and filesystem setup part of my script:
diskpart() {
# ... (disk selection code)
printf "%b\n" "
Do you want to use a secondary disk (HDD) for user directories?
"
options="Yes No"
select_option $options
case $? in
0)
select_secondary_disk
drivessd
;;
1)
drivessd
;;
esac
}
# ... (filesystem creation and mounting code)
if [ -n "$SECONDARY_DISK" ]; then
mkdir -p /mnt/mnt/data
if [ "$FS" = "luks" ]; then
mount -o "$MOUNT_OPTIONS" /dev/mapper/DATA /mnt/mnt/data
else
mount -o "$MOUNT_OPTIONS" "$SECONDARY_DISK" /mnt/mnt/data
fi
mkdir -p /mnt/mnt/data/{Downloads,Documents,Music,Pictures,Videos,Public}
fi
# ... (fstab and bind mount setup for secondary disk)
Full script link is here.
Are there any improvements or considerations I should keep in mind for this approach? Any potential pitfalls or edge cases I should be aware of?
Thanks in advance for any insights or suggestions!
Last edited by fam007e (2024-10-10 15:01:24)
Offline
Don't use `pacman -Sy`: https://wiki.archlinux.org/title/System … nsupported
And why have you used a mix of POSIX and bash tests? If you're using bash then stick to [[...]] rather than [...].
Para todos todo, para nosotros nada
Offline
Don't use `pacman -Sy`: https://wiki.archlinux.org/title/System … nsupported
And why have you used a mix of POSIX and bash tests? If you're using bash then stick to [[...]] rather than [...].
Thanks for your feedback.
Offline