Proper chroot setup.

This commit is contained in:
lemniskett 2020-10-28 10:02:56 +07:00
parent 64559fa96f
commit 5692fcf15d
3 changed files with 30 additions and 5 deletions

View File

@ -70,9 +70,6 @@ case $1 in
mkdir -p $CHROOT/lib/modules
mount -R /lib/modules $CHROOT/lib/modules
mount -R /boot $CHROOT/boot
;;
--setup)
asroot
cp /usr/local/share/archbox/chroot_setup.bash $CHROOT/chroot_setup
chroot $CHROOT /bin/bash -c "sh /chroot_setup"
;;

26
chroot_setup.bash Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
err(){
echo "$(tput bold)$(tput setaf 1)==> $@ $(tput sgr0)"
exit 1
}
msg(){
echo "$(tput bold)$(tput setaf 2)==> $@ $(tput sgr0)"
}
msg "Initializing pacman keyrings..."
pacman-key --init
pacman-key --populate archlinux
msg "Installing essential packages..."
pacman -Syu base base-devel xorg --noconfirm
msg "Creating user account..."
echo "Enter the name of the user account, you may want it to be the same as the host os so it will share the same home directory"
read CHROOT_USER
useradd -m $CHROOT_USER
gpasswd -a $CHROOT_USER wheel
echo "Enter root password"
passwd
echo "Enter $CHROOT_USER password"
passwd $CHROOT_USER
sed -i 's/# %wheel ALL=(ALL) NOPASSWD: ALL/%wheel ALL=(ALL) NOPASSWD: ALL/g' /etc/sudoers

View File

@ -1,7 +1,9 @@
#!/bin/sh
mkdir -p /usr/local/share/archbox/bin
cp -v ./archbox.bash /usr/local/bin/archbox
cp -v ./archbox.conf /etc/archbox.conf
cp -v ./archboxenter.bash /usr/local/share/archbox/bin/archboxenter
cp -v ./copyresolv.bash /usr/local/share/archbox/bin/copyresolv
cp -v ./archboxcommand.bash /usr/local/share/archbox/bin/archboxcommand
cp -v ./chroot_setup.bash /usr/local/share/archbox/chroot_setup.bash