Skip to content

Commit 2a095a3

Browse files
committed
After bootstrap, drop to a shell if needed, then shut down cleanly
1 parent 133c054 commit 2a095a3

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

steps/improve/after.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/sh
2+
#
3+
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <[email protected]>
4+
#
5+
# SPDX-License-Identifier: GPL-3.0-or-later
6+
#
7+
# After bootstrap, drop to a shell if needed, then shut down cleanly.
8+
9+
. /steps/bootstrap.cfg
10+
. /steps/env
11+
12+
if [ "${INTERACTIVE}" = True ]; then
13+
env - PATH=${PREFIX}/bin PS1="\w # " bash -i
14+
fi
15+
16+
if [ "${CHROOT}" = False ]; then
17+
# ignore errors due to fstab or swapfile not existing
18+
swapoff -a &> /dev/null || true
19+
sync
20+
# sysrq to avoid device busy; then mount to wait for it to finish
21+
echo u > /proc/sysrq_trigger
22+
mount -o remount,ro /
23+
echo o > /proc/sysrq_trigger # power off
24+
fi

steps/jump/move_disk.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ mkdir -p /rootonly
2727
# This doesn't recursively mount - that's why we're able to copy everything over
2828
mount --bind / /rootonly
2929
cp -ar /rootonly/* /newroot/
30+
sed -e 's/newroot//' /rootonly/etc/mtab | grep -v 'rootonly' > /newroot/etc/mtab
3031
umount /rootonly
3132
switch_root /newroot /init

steps/manifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,4 @@ build: binutils-2.41
182182
build: gcc-13.1.0
183183
improve: null_time ( FORCE_TIMESTAMPS == True )
184184
improve: update_checksums ( UPDATE_CHECKSUMS == True )
185+
improve: after

0 commit comments

Comments
 (0)