summaryrefslogtreecommitdiffstats
path: root/shutdown
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-11-16 15:51:25 +0100
committerDave Reisner <dreisner@archlinux.org>2012-11-24 00:01:34 +0100
commit70f54ce9e6898d0f28a6b1d2911eb82ce902d429 (patch)
treedbaf50a7d6b69f709736dbf44aee6452c4bfe022 /shutdown
parent1fc9e188c81204d57715dfd2916737b3e824f43d (diff)
downloadmkinitcpio-70f54ce9e6898d0f28a6b1d2911eb82ce902d429.tar.gz
mkinitcpio-70f54ce9e6898d0f28a6b1d2911eb82ce902d429.tar.xz
shutdown: copy kexec from host if requested and not available
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'shutdown')
-rw-r--r--shutdown18
1 files changed, 18 insertions, 0 deletions
diff --git a/shutdown b/shutdown
index c705541..dc293d4 100644
--- a/shutdown
+++ b/shutdown
@@ -50,10 +50,28 @@ disassemble() {
done
}
+copy_binary_from_host() {
+ local bin=$1
+
+ # hardcode a sane PATH
+ for p in '/usr/sbin' '/usr/bin' '/sbin' '/bin'; do
+ if [ -e "/oldroot/$p/$bin" ]; then
+ cp "/oldroot/$p/$bin" "/usr/bin/$1"
+ return 0
+ fi
+ done
+
+ return 1
+}
+
# XXX: Discourage libdevmapper from thinking that udev
# might be in a useful state. FS#30995.
rm -rf /run/udev
+if [ "$1" = kexec ] && ! command -v kexec >/dev/null; then
+ copy_binary_from_host kexec
+fi
+
# chdir, so that we can avoid a lot of path chopping
cd /sys/class/block