History

mkimage.sh.in: Use abstracted chroot access

Michael Aldridge committed 9 years ago

Commit c0424731 parent 0b638dd2 files · +14 −8Browse files

Unified · Split

2 files
  1. mkimage.sh.in +11 −8
  2. mkrootfs.sh.in +3 −0
mkimage.sh.in+11−8
@@ -285,29 +285,28 @@ GCP*) · 284 unmodified lines
285285
286286 # Setup GRUB
287287 mount_pseudofs
288− chroot "${ROOTFS}" grub-install "${LOOPDEV}"
288+ run_cmd_chroot "${ROOTFS}" "grub-install ${LOOPDEV}"
289289 sed -i "s:page_poison=1:page_poison=1 console=ttyS0,38400n8d:" "${ROOTFS}/etc/default/grub"
290− chroot "${ROOTFS}" update-grub
291− umount_pseudofs
290+ run_cmd_chroot "${ROOTFS}" update-grub
292291
293292 # Setup the GCP Guest services
294293 for _service in dhcpcd sshd agetty-console nanoklogd socklog-unix GCP-Guest-Initialization GCP-accounts GCP-clock-skew GCP-ip-forwarding ; do
295− chroot "${ROOTFS}" ln -sv /etc/sv/$_service /etc/runit/runsvdir/default/$_service
294+ run_cmd_chroot "${ROOTFS}" "ln -sv /etc/sv/$_service /etc/runit/runsvdir/default/$_service"
296295 done
297296
298297 # Turn off the agetty's since we can't use them anyway
299− rm -v "${ROOTFS}/etc/runit/runsvdir/default/agetty-tty*"
298+ rm -v "${ROOTFS}/etc/runit/runsvdir/default/agetty-tty"*
300299
301300 # Disable root login over ssh and lock account
302301 sed -i "s:PermitRootLogin yes:PermitRootLogin no:" "${ROOTFS}/etc/ssh/sshd_config"
303− chroot "${ROOTFS}" passwd -l root
302+ run_cmd_chroot "${ROOTFS}" "passwd -l root"
304303
305304 # Set the Timezone
306− chroot "${ROOTFS}" ln -svf /usr/share/zoneinfo/UTC /etc/localtime
305+ run_cmd_chroot "${ROOTFS}" "ln -svf /usr/share/zoneinfo/UTC /etc/localtime"
307306
308307 # Generate glibc-locales if necessary (this is a noop on musl)
309308 if [ "$PLATFORM" = GCP ] ; then
310− chroot "${ROOTFS}" xbps-reconfigure -f glibc-locales
309+ run_cmd_chroot "${ROOTFS}" "xbps-reconfigure -f glibc-locales"
311310 fi
312311
313312 # Remove SSH host keys (these will get rebuilt on first boot)
@@ -316,6 +315,10 @@ GCP*) · 2 unmodified lines
316315
317316 # Force the hostname since this isn't read from DHCP
318317 echo void-GCE > "${ROOTFS}/etc/hostname"
318+
319+ # Cleanup the chroot from anything that was setup for the
320+ # run_cmd_chroot commands
321+ cleanup_chroot
319322 ;;
320323 esac
321324
mkrootfs.sh.in+3−0
@@ -181,6 +181,9 @@ run_cmd_chroot "$ROOTFS" "xbps-reconfigure -a" · 180 unmodified lines
181181 # lock on the passwd database, lest it be left in the system and
182182 # propogated to other points.
183183 info_msg "Setting the default root password ('voidlinux')"
184+if [ ! -f "$ROOTFS/etc/shadow" ] ; then
185+ run_cmd_chroot "$ROOTFS" pwconv
186+fi
184187 echo root:voidlinux | run_cmd_chroot "$ROOTFS" "chpasswd -c SHA512" || die "Could not set default credentials"
185188 rm -f "$ROOTFS/etc/.pwd.lock"
186189

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t