Add aliases for arch linux

This commit is contained in:
Augusto Gunsch 2021-08-10 10:17:16 -03:00
parent d65bfb3cee
commit 315c829e70
No known key found for this signature in database
GPG Key ID: F7EEFE29825C72DC
1 changed files with 13 additions and 17 deletions

View File

@ -47,7 +47,7 @@ CUR_PHASE=1
MAX_PHASE=3 MAX_PHASE=3
### INFO ### ### INFO ###
AVAILABLE_PLATFORMS='Arch\nArtix (OpenRC)\n' AVAILABLE_PLATFORMS='Both BIOS and UEFI systems\nOnly x86_64 systems\nDistros:\nArch\nArtix (OpenRC)\n'
readonly AVAILABLE_PLATFORMS readonly AVAILABLE_PLATFORMS
echo "This script can only be run interactively. Make sure you are in a supported platform and have an Internet connection. Available platforms:" echo "This script can only be run interactively. Make sure you are in a supported platform and have an Internet connection. Available platforms:"
@ -61,6 +61,10 @@ testif ls /sys/firmware/efi/efivars
readonly DISTRO readonly DISTRO
readonly INIT_SYS readonly INIT_SYS
readonly UEFI readonly UEFI
if [ "$DISTRO" = "arch" ]; then
alias chroot="arch-chroot"
alias fstabgen="genfstab"
fi
print_phase() { print_phase() {
echo -e "${BOLD}${YELLOW}[$CUR_PHASE/$MAX_PHASE] $1 phase${NC}${NORM}" echo -e "${BOLD}${YELLOW}[$CUR_PHASE/$MAX_PHASE] $1 phase${NC}${NORM}"
@ -157,10 +161,10 @@ partition() {
install_base() { install_base() {
print_phase "System installation" print_phase "System installation"
echo -n "Installing base system, kernel, bootloader and vi..." echo -n "Installing base system, kernel, bootloader and vi..."
if [ "$DISTRO" = "artix" ]; then
quiet basestrap /mnt base base-devel linux linux-firmware grub vi quiet basestrap /mnt base base-devel linux linux-firmware grub vi
echo "done" echo "done"
if [ "$DISTRO" = "artix" ]; then
if [ "$INIT_SYS" = "openrc-init" ]; then if [ "$INIT_SYS" = "openrc-init" ]; then
echo -n "Installing openrc..." echo -n "Installing openrc..."
quiet basestrap /mnt openrc elogind-openrc quiet basestrap /mnt openrc elogind-openrc
@ -170,20 +174,13 @@ install_base() {
echo "Error: Unsupported init system \"$INIT_SYS\"" echo "Error: Unsupported init system \"$INIT_SYS\""
exit 1 exit 1
fi fi
elif [ "$DISTRO" != "arch" ]; then
echo "Error: Unsupported distro \"$DISTRO\""
fi
echo -n "Generating fstab..." echo -n "Generating fstab..."
fstabgen -U /mnt >> /mnt/etc/fstab fstabgen -U /mnt >> /mnt/etc/fstab
echo "done" echo "done"
elif [ "$DISTRO" = "arch" ]; then
quiet pacstrap /mnt base base-devel linux linux-firmware grub vi
echo "done"
echo -n "Generating fstab..."
genfstab -U /mnt >> /mnt/etc/fstab
echo "done"
else
echo
echo "Error: Unsupported distro."
exit 1
fi
} }
set_timezone() { set_timezone() {
@ -191,7 +188,6 @@ set_timezone() {
qpushd /mnt/usr/share/zoneinfo qpushd /mnt/usr/share/zoneinfo
ln -sf "/mnt/usr/share/zoneinfo/$(fzf --layout=reverse --height=20)" /mnt/etc/localtime ln -sf "/mnt/usr/share/zoneinfo/$(fzf --layout=reverse --height=20)" /mnt/etc/localtime
qpopd qpopd
[ "$DISTRO" = "arch" ] && alias chroot="arch-chroot"
quiet chroot /mnt hwclock --systohc quiet chroot /mnt hwclock --systohc
} }