mkimage.sh.in: Use abstracted chroot access
This commit is contained in:
@@ -285,29 +285,28 @@ GCP*)
|
|||||||
|
|
||||||
# Setup GRUB
|
# Setup GRUB
|
||||||
mount_pseudofs
|
mount_pseudofs
|
||||||
chroot "${ROOTFS}" grub-install "${LOOPDEV}"
|
run_cmd_chroot "${ROOTFS}" "grub-install ${LOOPDEV}"
|
||||||
sed -i "s:page_poison=1:page_poison=1 console=ttyS0,38400n8d:" "${ROOTFS}/etc/default/grub"
|
sed -i "s:page_poison=1:page_poison=1 console=ttyS0,38400n8d:" "${ROOTFS}/etc/default/grub"
|
||||||
chroot "${ROOTFS}" update-grub
|
run_cmd_chroot "${ROOTFS}" update-grub
|
||||||
umount_pseudofs
|
|
||||||
|
|
||||||
# Setup the GCP Guest services
|
# Setup the GCP Guest services
|
||||||
for _service in dhcpcd sshd agetty-console nanoklogd socklog-unix GCP-Guest-Initialization GCP-accounts GCP-clock-skew GCP-ip-forwarding ; do
|
for _service in dhcpcd sshd agetty-console nanoklogd socklog-unix GCP-Guest-Initialization GCP-accounts GCP-clock-skew GCP-ip-forwarding ; do
|
||||||
chroot "${ROOTFS}" ln -sv /etc/sv/$_service /etc/runit/runsvdir/default/$_service
|
run_cmd_chroot "${ROOTFS}" "ln -sv /etc/sv/$_service /etc/runit/runsvdir/default/$_service"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Turn off the agetty's since we can't use them anyway
|
# Turn off the agetty's since we can't use them anyway
|
||||||
rm -v "${ROOTFS}/etc/runit/runsvdir/default/agetty-tty*"
|
rm -v "${ROOTFS}/etc/runit/runsvdir/default/agetty-tty"*
|
||||||
|
|
||||||
# Disable root login over ssh and lock account
|
# Disable root login over ssh and lock account
|
||||||
sed -i "s:PermitRootLogin yes:PermitRootLogin no:" "${ROOTFS}/etc/ssh/sshd_config"
|
sed -i "s:PermitRootLogin yes:PermitRootLogin no:" "${ROOTFS}/etc/ssh/sshd_config"
|
||||||
chroot "${ROOTFS}" passwd -l root
|
run_cmd_chroot "${ROOTFS}" "passwd -l root"
|
||||||
|
|
||||||
# Set the Timezone
|
# Set the Timezone
|
||||||
chroot "${ROOTFS}" ln -svf /usr/share/zoneinfo/UTC /etc/localtime
|
run_cmd_chroot "${ROOTFS}" "ln -svf /usr/share/zoneinfo/UTC /etc/localtime"
|
||||||
|
|
||||||
# Generate glibc-locales if necessary (this is a noop on musl)
|
# Generate glibc-locales if necessary (this is a noop on musl)
|
||||||
if [ "$PLATFORM" = GCP ] ; then
|
if [ "$PLATFORM" = GCP ] ; then
|
||||||
chroot "${ROOTFS}" xbps-reconfigure -f glibc-locales
|
run_cmd_chroot "${ROOTFS}" "xbps-reconfigure -f glibc-locales"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove SSH host keys (these will get rebuilt on first boot)
|
# Remove SSH host keys (these will get rebuilt on first boot)
|
||||||
@@ -316,6 +315,10 @@ GCP*)
|
|||||||
|
|
||||||
# Force the hostname since this isn't read from DHCP
|
# Force the hostname since this isn't read from DHCP
|
||||||
echo void-GCE > "${ROOTFS}/etc/hostname"
|
echo void-GCE > "${ROOTFS}/etc/hostname"
|
||||||
|
|
||||||
|
# Cleanup the chroot from anything that was setup for the
|
||||||
|
# run_cmd_chroot commands
|
||||||
|
cleanup_chroot
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -181,6 +181,9 @@ run_cmd_chroot "$ROOTFS" "xbps-reconfigure -a"
|
|||||||
# lock on the passwd database, lest it be left in the system and
|
# lock on the passwd database, lest it be left in the system and
|
||||||
# propogated to other points.
|
# propogated to other points.
|
||||||
info_msg "Setting the default root password ('voidlinux')"
|
info_msg "Setting the default root password ('voidlinux')"
|
||||||
|
if [ ! -f "$ROOTFS/etc/shadow" ] ; then
|
||||||
|
run_cmd_chroot "$ROOTFS" pwconv
|
||||||
|
fi
|
||||||
echo root:voidlinux | run_cmd_chroot "$ROOTFS" "chpasswd -c SHA512" || die "Could not set default credentials"
|
echo root:voidlinux | run_cmd_chroot "$ROOTFS" "chpasswd -c SHA512" || die "Could not set default credentials"
|
||||||
rm -f "$ROOTFS/etc/.pwd.lock"
|
rm -f "$ROOTFS/etc/.pwd.lock"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user