1
0
mirror of synced 2026-04-27 04:46:28 +00:00

2007-02-23 22:46:15 by steve

Install an example script to update the kernel and initrd image
 for both the xen-tools.conf file and any pre-existing xen domains.
This commit is contained in:
steve
2007-02-23 22:46:15 +00:00
parent 07acbf8371
commit dbcbf9b6b0
2 changed files with 81 additions and 2 deletions

80
debian/examples/setup-kernel-initrd vendored Executable file
View File

@@ -0,0 +1,80 @@
#!/bin/sh
#
# Attempt to setup the kernel= + initrd= lines in the xen-tools configuration
# file.
#
# Steve
# --
#
# Find a kernel
#
kernel=` ls -1 /boot | grep ^vm |grep -v syms| grep xen | head -n 1`
if [ ! -z "${kernel}" ]; then
#
# it worked - update the configuration file.
perl -pi.bak -e "s/^\s*kernel\s*=(.*)/kernel = \/boot\/${kernel}/" /etc/xen-tools/xen-tools.conf
else
#
# failed. but the user can fixup
:
fi
#
# Find a ramdisk
#
ramdisk=` ls -1 /boot | grep ^init | grep xen | head -n 1`
if [ ! -z "${ramdisk}" ]; then
#
# it worked - update the configuration file.
#
perl -pi.bak -e "s/^\s*initrd\s*=(.*)/initrd = \/boot\/${ramdisk}/" /etc/xen-tools/xen-tools.conf
else
# failed. user can fixup
:
fi
#
# If we found a kernel and an initial ramdisk then modify the configuration
# files under /etc/xen
#
if [ ! -z "${ramdisk}" ] ; then
if [ ! -z "${kernel}" ]; then
#
# Process each file
#
for i in /etc/xen/*.cfg; do
if [ -e $i ]; then
cp $i $i.bak
#
# Upgrade kernel
#
perl -pi -e "s/^\s*kernel\s*=(.*)/kernel = '\/boot\/${kernel}'/" $i
#
# Upgrade ramdisk
#
perl -pi -e "s/^\s*ramdisk\s*=(.*)/ramdisk = '\/boot\/${ramdisk}'/" $i
fi
done
fi
fi

3
debian/rules vendored
View File

@@ -18,9 +18,7 @@ build-stamp: configure-stamp
clean:
dh_testdir
dh_testroot
make clean
rm -f build-stamp configure-stamp
dh_clean
@@ -43,6 +41,7 @@ binary-arch: build install
dh_testdir
dh_testroot
dh_install
dh_installexamples debian/examples/setup-kernel-initrd
dh_installchangelogs ChangeLog
dh_installdocs
dh_compress