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
|
#!/usr/bin/python
#
# mk-rescueimage.ia64 - builds a rescue image from an existing tree
# which can be converted into a isolinux bootable
# iso and used as a sysadmin rescue image.
#
#
# Usage: mk-rescueimage.ia64 <src-tree> <dest-dir> <productname>
#
# the rescue image will be created as <dest-dir>/ia64-rescueimage
#
#
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import os
import sys
import string
def usage():
print "usage: mk-rescueimage.ia64 <toplevel> <dest-dir> <productname> <productpath>"
if len(sys.argv) < 5:
usage()
sys.exit(1)
if not os.access("%s" % (sys.argv[2],), os.F_OK):
print "ERROR - Destination directory %s does not exist!" % (sys.argv[2],)
sys.exit(1)
srcdir = sys.argv[1]
destdir = sys.argv[2]+"/ia64-rescueimage"
productname = sys.argv[3]
productpath = sys.argv[4]
# clean and create destination directory
os.system("rm -rf %s" % (destdir,))
os.system("mkdir %s" % (destdir,))
# copy documentation
for pat in ["*eula*", "*EULA*", "README*", "RELEASE*", "GPL", "RPM-*"]:
os.system("cp -p %s/%s %s/ 2>/dev/null" % (srcdir, pat, destdir))
# cp boot.img, etc., into images
os.system("mkdir -p %s/images" % (destdir,))
os.system("cp -ar %s/images/* %s/images" % (srcdir, destdir))
# PRARIT did not execute the below ...
# munge elilo.conf to have a default of rescue mode
os.system("mkdir %s/mnt" % (destdir,))
os.system("mount -oloop %s/images/boot.img %s/mnt" % (destdir, destdir))
elilofile = open("%s/mnt/elilo.conf" % (destdir,), "r")
elilolines = elilofile.readlines()
elilofile.close()
# backup old one
os.system("echo \"\tappend=\"rescue\"\" >> %s/mnt/elilo.conf" % (destdir,))
os.system("cp -f %s/mnt/elilo.conf %s/mnt/efi/boot/elilo.conf" % (destdir, destdir))
# cleanup
os.system("umount %s/mnt" % (destdir,))
os.system("rm -rf %s/mnt" % (destdir,))
|