Add runInChrootWithInput() function

This commit is contained in:
Santiago Lo Coco 2021-12-22 17:43:35 -03:00
parent bdf8cc6ebd
commit db65dd6d33
1 changed files with 20 additions and 13 deletions

View File

@ -93,7 +93,8 @@ networkConf() {
} }
setPassword() { setPassword() {
echo root:password | chpasswd # echo root:password | chpasswd
runInChrootWithInput "passwd"
} }
installMorePackages() { installMorePackages() {
@ -110,20 +111,29 @@ grubSetUp() {
} }
userSetUp() { userSetUp() {
useradd -m slococo runInChroot "useradd -m slococo"
echo slococo:password | chpasswd # echo slococo:password | chpasswd
# echo "$(whiptail --passwordbox "Enter the root password" 0 0 1>&2)" | chpasswd
runInChrootWithInput "passwd slococo"
# echo "slococo ALL=(ALL) ALL" >> /etc/sudoers.d/slococo # echo "slococo ALL=(ALL) ALL" >> /etc/sudoers.d/slococo
# Uncomment wheel line: # Uncomment wheel line:
EDITOR=nvim visudo runInChroot "EDITOR=nvim visudo"
usermod -aG wheel slococo runInChroot "usermod -aG wheel slococo"
} }
runInChroot() { runInChroot() {
chroot /mnt /bin/bash << END arch-chroot /mnt bash -c '${1}'
}
runInChrootWithInput() {
cat << EOF > /mnt/runme
${1} ${1}
END EOF
chmod 755 /mnt/runme
arch-chroot /mnt /runme
rm /mnt/runme
} }
runScript() { runScript() {
@ -133,18 +143,15 @@ runScript() {
# partDisks # partDisks
# installPackages # installPackages
generateFstab generateFstab
arch-chroot /mnt
setTimeZone setTimeZone
setLocale setLocale
networkConf networkConf
# setPassword setPassword
installMorePackages installMorePackages
grubSetUp grubSetUp
# userSetUp userSetUp
# exit
# umount -R /mnt # umount -R /mnt
# reboot # reboot
} }
runScript runScript
# runInChroot "ls -al"