mirror of
https://github.com/classy-giraffe/easy-arch.git
synced 2025-11-17 19:40:55 +00:00
Cleaning code.
This commit is contained in:
parent
c5f30b8aa6
commit
91e57fe2c9
1 changed files with 25 additions and 8 deletions
33
easy-arch.sh
33
easy-arch.sh
|
|
@ -191,7 +191,7 @@ fi
|
||||||
|
|
||||||
# Pacstrap (setting up a base sytem onto the new root).
|
# Pacstrap (setting up a base sytem onto the new root).
|
||||||
print "Installing the base system (it may take a while)."
|
print "Installing the base system (it may take a while)."
|
||||||
pacstrap /mnt base $kernel $microcode linux-firmware btrfs-progs grub grub-btrfs efibootmgr snapper reflector base-devel snap-pac zram-generator
|
pacstrap /mnt base $kernel $microcode linux-firmware btrfs-progs grub grub-btrfs rsync efibootmgr snapper reflector base-devel snap-pac zram-generator
|
||||||
|
|
||||||
# Virtualization check
|
# Virtualization check
|
||||||
hypervisor=$(systemd-detect-virt)
|
hypervisor=$(systemd-detect-virt)
|
||||||
|
|
@ -202,7 +202,7 @@ case $hypervisor in
|
||||||
print "Enabling specific services for the guest tools."
|
print "Enabling specific services for the guest tools."
|
||||||
systemctl enable qemu-guest-agent --root=/mnt &>/dev/null
|
systemctl enable qemu-guest-agent --root=/mnt &>/dev/null
|
||||||
;;
|
;;
|
||||||
vmware ) print "VMWare Workstation/ESXi has been detected."
|
vmware ) print "VMWare Workstation/ESXi has been detected."
|
||||||
print "Installing guest tools."
|
print "Installing guest tools."
|
||||||
pacstrap /mnt open-vm-tools
|
pacstrap /mnt open-vm-tools
|
||||||
print "Enabling specific services for the guest tools."
|
print "Enabling specific services for the guest tools."
|
||||||
|
|
@ -223,6 +223,7 @@ case $hypervisor in
|
||||||
systemctl enable hv_kvp_daemon --root=/mnt &>/dev/null
|
systemctl enable hv_kvp_daemon --root=/mnt &>/dev/null
|
||||||
systemctl enable hv_vss_daemon --root=/mnt &>/dev/null
|
systemctl enable hv_vss_daemon --root=/mnt &>/dev/null
|
||||||
;;
|
;;
|
||||||
|
* ) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Setting up the network.
|
# Setting up the network.
|
||||||
|
|
@ -263,8 +264,6 @@ sed -i "s,quiet,quiet cryptdevice=UUID=$UUID:cryptroot root=$BTRFS,g" /mnt/etc/d
|
||||||
|
|
||||||
# Configuring the system.
|
# Configuring the system.
|
||||||
arch-chroot /mnt /bin/bash -e <<EOF
|
arch-chroot /mnt /bin/bash -e <<EOF
|
||||||
|
|
||||||
print "test"
|
|
||||||
|
|
||||||
# Setting up timezone.
|
# Setting up timezone.
|
||||||
echo "Setting up the timezone."
|
echo "Setting up the timezone."
|
||||||
|
|
@ -299,21 +298,39 @@ arch-chroot /mnt /bin/bash -e <<EOF
|
||||||
# Creating grub config file.
|
# Creating grub config file.
|
||||||
echo "Creating GRUB config file."
|
echo "Creating GRUB config file."
|
||||||
grub-mkconfig -o /boot/grub/grub.cfg &>/dev/null
|
grub-mkconfig -o /boot/grub/grub.cfg &>/dev/null
|
||||||
|
|
||||||
|
# Setting root password.
|
||||||
|
echo "Setting root password."
|
||||||
|
passwd
|
||||||
|
|
||||||
# Adding user with sudo privileges.
|
# Adding user with sudo privileges.
|
||||||
if [ -n "$username" ]; then
|
if [ -n "$username" ]; then
|
||||||
echo "Adding $username with root privilege."
|
echo "Adding $username with root privilege."
|
||||||
useradd -m "$username"
|
useradd -m "$username"
|
||||||
usermod -aG wheel "$username"
|
usermod -aG wheel "$username"
|
||||||
|
echo "Setting user password for $username."
|
||||||
|
passwd $username
|
||||||
echo "$username ALL=(ALL) ALL" >> /etc/sudoers.d/"$username"
|
echo "$username ALL=(ALL) ALL" >> /etc/sudoers.d/"$username"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Setting root password.
|
# Boot backup hook.
|
||||||
print "Setting root password."
|
print "Configuring /boot backup when pacman transactions are made."
|
||||||
arch-chroot /mnt /bin/passwd
|
cat > /mnt/etc/pacman.d/hooks/50-bootbackup.hook <<EOF
|
||||||
[ -n "$username" ] && print "Setting user password for ${username}." && arch-chroot /mnt /bin/passwd "$username"
|
[Trigger]
|
||||||
|
Operation = Upgrade
|
||||||
|
Operation = Install
|
||||||
|
Operation = Remove
|
||||||
|
Type = Path
|
||||||
|
Target = usr/lib/modules/*/vmlinuz
|
||||||
|
|
||||||
|
[Action]
|
||||||
|
Depends = rsync
|
||||||
|
Description = Backing up /boot...
|
||||||
|
When = PostTransaction
|
||||||
|
Exec = /usr/bin/rsync -a --delete /boot /.bootbackup
|
||||||
|
EOF
|
||||||
|
|
||||||
# ZRAM configuration.
|
# ZRAM configuration.
|
||||||
print "Configuring ZRAM."
|
print "Configuring ZRAM."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue