File: uml-rhroot.sh

package info (click to toggle)
openswan 1%3A2.4.6%2Bdfsg.2-1.1%2Betch2
  • links: PTS
  • area: main
  • in suites: etch
  • size: 25,000 kB
  • ctags: 16,877
  • sloc: ansic: 121,112; sh: 19,782; xml: 9,699; asm: 4,422; perl: 4,087; makefile: 3,367; tcl: 713; exp: 657; yacc: 396; pascal: 328; lex: 289; sed: 265; awk: 124; lisp: 3
file content (113 lines) | stat: -rw-r--r-- 2,545 bytes parent folder | download | duplicates (5)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh

# don't touch below
rpmcanon() {
    rpm=$1
    for i in `eval echo $d1/$rpm*.rpm $d2/$rpm*.rpm`
    do
	if [ -r $i ]
        then
	    echo $i
	fi
    done
}

nri() {
    list=`for i; do rpmcanon $i; done`
    rpm --root=$root -i $list
}

usage() {
    echo "Usage: $0 rootdir cdimagedir" >&2
    exit 2
}

# ARG1 is space to build root image
# ARG2 is pointer to CDs images/etc.

if [ ! -w / ]
then
    echo unfortunately, you have to run me as root, since I need chroot.
fi

root=$1; shift
if [ -z "$root" ]
then
    usage;
fi

if [ -d $root/* ]
then
    echo Root space $root has stuff in it, aborting.
    exit 0
fi

uproot=`dirname $root`
if [ ! -w $uproot ]
then
    echo $uproot is not writable.
    exit 1
fi

image=$1; shift
if [ -z "$image" ] || [ ! -d $image ]
then
    usage;
fi

if [ -d $image/RedHat/RPMS ]
then
    d1=$image/RedHat/RPMS
    d2=$image/RedHat/RPMS
    echo "Assuming merged RH disc1/2 at $d1"
elif [ -d $image/disc1 ] && [ -d $image/disc2 ]
then
    d1=$image/disc1/RedHat/RPMS
    d2=$image/disc2/RedHat/RPMS
    echo "Assuming RH disc1 at $d1"
    echo "        and disc2 at $d2"
elif [ -r $image/basesystem-*.rpm ]
then
    d1=$image
    echo "Assuming download RPMS directory at $d1"
fi
    

mkdir -p $root/var/lib/rpm
mkdir -p $root/etc $root/usr/bin $root/bin $root/usr/lib $root/lib
mkdir -p $root/usr/bin $root/etc/X11/applnk/System $root/usr/include


rpm --root=$root --initdb

nri basesystem setup filesystem "glibc-[0-9.]*.i386" glibc-common- "slang-[0-9]" "newt-[0-9]" popt- 

nri info- makeinfo- mktemp- shadow-utils- ntsysv- syslinux- \
	libtermcap- bzip2- libstdc++- logrotate- \
	modutils- diffutils- fileutils- findutils- \
	grep- gzip- psmisc- readline- rootfiles- \
	console-tools- tar- textutils- \
	mount- tmpwatch- vim-common- \
	which- passwd- zlib- util-linux- \
	chkconfig- db1- "db3-[0-9]" e2fsprogs- \
	file- iputils- losetup- mingetty- \
	net-tools- pwdb- netconfig- termcap- \
	bash- crontabs- iproute- MAKEDEV- \
	"ncurses-[0-9]" cpio- ed- gawk- less- \
	procps- redhat-release- sed- sysklogd- \
	dev- time- vim-minimal- pam- \
	sh-utils- SysVinit- rpm-4 mingetty- \
	initscripts- cracklib fileutils- textutils- glib- \
	termcap- bzip2-libs info krbafs words krb5-libs-

# do one fixup, not clear why!
(cd $root/lib; ln -fs libtermcap.so.2.* libtermcap.so.2 )

# fixup password file
chroot $root pwconv

# should now chown it to yourself.
echo You should now chown it to yourself.
# now copy some UML friendly files in
#(cd umlroot; tar cf - . ) | (cd $root; tar xf - )