ia64/xen-unstable

view tools/security/updategrub.sh @ 8740:3d7ea7972b39

Update patches for linux 2.6.15.

Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Thu Feb 02 17:16:00 2006 +0000 (2006-02-02)
parents 8aac8746047b
children 909664b50602
line source
1 #!/bin/sh
2 # *
3 # * updategrub
4 # *
5 # * Copyright (C) 2005 IBM Corporation
6 # *
7 # * Authors:
8 # * Stefan Berger <stefanb@us.ibm.com>
9 # *
10 # * This program is free software; you can redistribute it and/or
11 # * modify it under the terms of the GNU General Public License as
12 # * published by the Free Software Foundation, version 2 of the
13 # * License.
14 # *
15 # *
16 #
18 if [ -z "$runbash" ]; then
19 runbash="1"
20 export runbash
21 exec sh -c "bash $0 $*"
22 exit
23 fi
25 dir=`dirname $0`
26 source $dir/labelfuncs.sh
28 acmroot=$ACM_DEFAULT_ROOT
31 # Show usage of this program
32 usage ()
33 {
34 prg=`basename $0`
35 echo "Use this tool to add the binary policy to the Xen grub entry and
36 have Xen automatically enforce the policy when starting.
38 Usage: $prg [-d <policies root>] <policy name> [<kernel version>]
40 <policies root> : The directory where the policies directory is located in;
41 default is $acmroot
42 <policy name> : The name of the policy, i.e. xen_null
43 <kernel version> : The version of the kernel to apply the policy
44 against, i.e. 2.6.12.6-xen0
45 If not specified, a kernel version ending with '-xen0'
46 will be searched for in '/lib/modules'
47 "
48 }
52 if [ "$1" == "-h" ]; then
53 usage
54 exit 0
55 elif [ "$1" == "-d" ]; then
56 shift
57 acmroot=$1
58 shift
59 fi
61 if [ "$1" == "" ]; then
62 echo "Error: Not enough command line parameters."
63 echo ""
64 usage
65 exit -1
66 fi
69 policy=$1
70 policyfile=$policy.bin
72 getLinuxVersion $2
74 findGrubConf
75 ret=$?
76 if [ $ret -eq 0 ]; then
77 echo "Could not find grub.conf."
78 exit -1
79 elif [ $ret -eq 2 ]; then
80 echo "Need to have write-access to $grubconf. Exiting."
81 exit -1
82 fi
84 cpBootPolicy /boot $acmroot $policy
85 ret=$?
86 if [ $ret -ne 1 ]; then
87 echo "Error copying or generating the binary policy."
88 exit -1
89 fi
90 updateGrub $grubconf $policyfile $linux