/usr/share/doc/xen-tools/examples/setup-kernel-initrd is in xen-tools 4.6.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | #!/bin/sh
#
# This script is designed to setup the kernel and ramdisk inside
# the xen-tools configuration file; and also update any stored values
# in any pre-generated Xen guests.
#
# This is useful if you have upgraded your Xen kernel.
#
# Steve
# --
#
#
# Find the kernel to use, and the ramdisk, unless they are specified
# in the environment.
#
if [ -z "${kernel}" ]; then
kernel=`ls -1 /boot| grep ^vm| grep -v syms| grep xen | sort -r| head -n 1`
kernel="/boot/${kernel}"
fi
if [ -z "${ramdisk}" ]; then
ramdisk=`ls -1 /boot| grep ^init| grep xen| sort -r| head -n 1`
ramdisk="/boot/${ramdisk}"
fi
#
# Abort if we didn't find a kernel / ramdisk
#
if [ -z "${kernel}" ]; then
echo "Failed to find Xen kernel."
exit
fi
if [ -z "${ramdisk}" ]; then
echo "Failed to find Xen ramdisk."
exit
fi
#
# Show what we're going to do - and prompt for confirmation.
#
cat <<EOF
Updating xen-tools configuration file, and all Xen guests with:
kernel : ${kernel}
ramdisk : ${ramdisk}
Press enter to continue, or Ctrl-c to abort.
EOF
read __dummy
#
# Update the xen-tools configuration file.
#
perl -pi -e "s|^\s*kernel\s*=(.*)|kernel = ${kernel}|" /etc/xen-tools/xen-tools.conf
perl -pi -e "s|^\s*initrd\s*=(.*)|initrd = ${ramdisk}|" /etc/xen-tools/xen-tools.conf
#
# Now modify each of the Xen guest configuration files beneath /etc/xen.
#
for i in /etc/xen/*.cfg; do
# test that the file exists - ie. glob succeeded.
if [ -e $i ]; then
#
# Upgrade kernel + ramdisk
#
perl -pi -e "s|^\s*kernel\s*=(.*)|kernel = '${kernel}'|" $i
perl -pi -e "s|^\s*ramdisk\s*=(.*)|ramdisk = '${ramdisk}'|" $i
fi
done
|