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
285 285
286 # Setup GRUB286 # Setup GRUB
287 mount_pseudofs287 mount_pseudofs
288 chroot "${ROOTFS}" grub-install "${LOOPDEV}"288 run_cmd_chroot "${ROOTFS}" "grub-install ${LOOPDEV}"
289 sed -i "s:page_poison=1:page_poison=1 console=ttyS0,38400n8d:" "${ROOTFS}/etc/default/grub"289 sed -i "s:page_poison=1:page_poison=1 console=ttyS0,38400n8d:" "${ROOTFS}/etc/default/grub"
290 chroot "${ROOTFS}" update-grub290 run_cmd_chroot "${ROOTFS}" update-grub
291 umount_pseudofs
292 291
293 # Setup the GCP Guest services292 # Setup the GCP Guest services
294 for _service in dhcpcd sshd agetty-console nanoklogd socklog-unix GCP-Guest-Initialization GCP-accounts GCP-clock-skew GCP-ip-forwarding ; do293 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/$_service294 run_cmd_chroot "${ROOTFS}" "ln -sv /etc/sv/$_service /etc/runit/runsvdir/default/$_service"
296 done295 done
297 296
298 # Turn off the agetty's since we can't use them anyway297 # 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"*
300 299
301 # Disable root login over ssh and lock account300 # Disable root login over ssh and lock account
302 sed -i "s:PermitRootLogin yes:PermitRootLogin no:" "${ROOTFS}/etc/ssh/sshd_config"301 sed -i "s:PermitRootLogin yes:PermitRootLogin no:" "${ROOTFS}/etc/ssh/sshd_config"
303 chroot "${ROOTFS}" passwd -l root302 run_cmd_chroot "${ROOTFS}" "passwd -l root"
304 303
305 # Set the Timezone304 # Set the Timezone
306 chroot "${ROOTFS}" ln -svf /usr/share/zoneinfo/UTC /etc/localtime305 run_cmd_chroot "${ROOTFS}" "ln -svf /usr/share/zoneinfo/UTC /etc/localtime"
307 306
308 # Generate glibc-locales if necessary (this is a noop on musl)307 # Generate glibc-locales if necessary (this is a noop on musl)
309 if [ "$PLATFORM" = GCP ] ; then308 if [ "$PLATFORM" = GCP ] ; then
310 chroot "${ROOTFS}" xbps-reconfigure -f glibc-locales309 run_cmd_chroot "${ROOTFS}" "xbps-reconfigure -f glibc-locales"
311 fi310 fi
312 311
313 # Remove SSH host keys (these will get rebuilt on first boot)312 # Remove SSH host keys (these will get rebuilt on first boot)
@@ -316,6 +315,10 @@ GCP*) · 2 unmodified lines
316 315
317 # Force the hostname since this isn't read from DHCP316 # Force the hostname since this isn't read from DHCP
318 echo void-GCE > "${ROOTFS}/etc/hostname"317 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
319 ;;322 ;;
320esac323esac
321 324
mkrootfs.sh.in+3−0
@@ -181,6 +181,9 @@ run_cmd_chroot "$ROOTFS" "xbps-reconfigure -a" · 180 unmodified lines
181# lock on the passwd database, lest it be left in the system and181# lock on the passwd database, lest it be left in the system and
182# propogated to other points.182# propogated to other points.
183info_msg "Setting the default root password ('voidlinux')"183info_msg "Setting the default root password ('voidlinux')"
184if [ ! -f "$ROOTFS/etc/shadow" ] ; then
185 run_cmd_chroot "$ROOTFS" pwconv
186fi
184echo root:voidlinux | run_cmd_chroot "$ROOTFS" "chpasswd -c SHA512" || die "Could not set default credentials"187echo root:voidlinux | run_cmd_chroot "$ROOTFS" "chpasswd -c SHA512" || die "Could not set default credentials"
185rm -f "$ROOTFS/etc/.pwd.lock"188rm -f "$ROOTFS/etc/.pwd.lock"
186 189

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