From 70f54ce9e6898d0f28a6b1d2911eb82ce902d429 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 16 Nov 2012 09:51:25 -0500 Subject: shutdown: copy kexec from host if requested and not available Signed-off-by: Dave Reisner --- shutdown | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'shutdown') 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 -- cgit v1.2.3-24-g4f1b