1 | #!/bin/sh |
---|
2 | # $Id: makeroot.sh,v 1.16 2003-03-31 17:28:01 ghudson Exp $ |
---|
3 | |
---|
4 | if [ $# -lt 1 ]; then |
---|
5 | echo "Usage: $0 rootdir [fullversion]" >&2 |
---|
6 | exit 1 |
---|
7 | fi |
---|
8 | |
---|
9 | root=$1 |
---|
10 | ver=$2 |
---|
11 | |
---|
12 | case `machtype` in |
---|
13 | linux) |
---|
14 | sysprefix=/afs/.dev.mit.edu/system/rhlinux |
---|
15 | syscontrol=control/control-${ver:-current} |
---|
16 | pwconv=/usr/sbin/pwconv |
---|
17 | |
---|
18 | mkdir -p "$root/dev" |
---|
19 | /dev/MAKEDEV -d "$root/dev" std |
---|
20 | |
---|
21 | cd "$sysprefix" |
---|
22 | list=`awk '{ x = $2; } END { print x; }' "$syscontrol"` |
---|
23 | rpms=`awk '/^athena/ { next; } { print $1; }' $list` |
---|
24 | |
---|
25 | mkdir -p "$root/var/lib/rpm" "$root/etc" |
---|
26 | touch "$root/etc/fstab" |
---|
27 | rpm --root "$root" --initdb |
---|
28 | rpm --root "$root" -ivh $rpms |
---|
29 | |
---|
30 | # Make links into destination area. |
---|
31 | ln -s ../build/athtools/usr/athena "$root/usr/athena" |
---|
32 | ln -s ../build/athtools/usr/afsws "$root/usr/afsws" |
---|
33 | |
---|
34 | # So packages can figure out where sendmail is. (sendmail normally |
---|
35 | # comes from athena-sendmail, which we don't install; this is simpler |
---|
36 | # than installing either the athena-sendmail or a native sendmail RPM.) |
---|
37 | touch "$root/usr/sbin/sendmail" |
---|
38 | chmod a+x "$root/usr/sbin/sendmail" |
---|
39 | ;; |
---|
40 | |
---|
41 | sun4) |
---|
42 | pwconv=/usr/sbin/pwconv |
---|
43 | |
---|
44 | # Install packages. |
---|
45 | for i in `cat /install/cdrom/install-local-u`; do |
---|
46 | echo "$i: \c" |
---|
47 | jot -b y 50 | pkgadd -R "$root" -d /install/cdrom "$i" |
---|
48 | done 2>/dev/null |
---|
49 | for i in `cat /install/cdrom/install-nolocal-u`; do |
---|
50 | echo "$i: \c" |
---|
51 | jot -b y 50 | pkgadd -R "$root" -d /install/cdrom/cdrom.link "$i" |
---|
52 | done 2>/dev/null |
---|
53 | cp /install/cdrom/INST_RELEASE "$root/var/sadm/system/admin" |
---|
54 | |
---|
55 | # Install patches. |
---|
56 | jot -b y 50 | patchadd -d -R "$root" -u -M /install/patches/patches.link \ |
---|
57 | `cat /install/patches/current-patches` |
---|
58 | |
---|
59 | # /usr/lib/isaexec (a front end which selects between the sparcv7 and |
---|
60 | # sparcv9 versions of a binary) doesn't work in a chrooted environment |
---|
61 | # (getexecname() fails due to lack of procfs). The only binary |
---|
62 | # linked to isaexec relevant to the build system is "sort". Work |
---|
63 | # around the problem by copying the sparcv9 "sort" to /usr/bin, |
---|
64 | # since ensuring that procfs is always mounted in the chroot area is a |
---|
65 | # little messy. |
---|
66 | rm -f "$root/usr/bin/sort" |
---|
67 | cp "$root/usr/bin/sparcv9/sort" "$root/usr/bin/sort" |
---|
68 | |
---|
69 | # Make devices. |
---|
70 | cd "$root" |
---|
71 | drvconfig -r devices -p "$root/etc/path_to_inst" |
---|
72 | devlinks -t "$root/etc/devlink.tab" -r "$root" |
---|
73 | disks -r "$root" |
---|
74 | |
---|
75 | # third/gnome-utils wants to know where to look for log messages. |
---|
76 | touch "$root/var/adm/messages" |
---|
77 | |
---|
78 | # Copy the /os symlink. |
---|
79 | (cd / && tar cf - os) | (cd "$root" && tar xf -) |
---|
80 | |
---|
81 | # Make links into destination area. |
---|
82 | ln -s ../.srvd/usr/athena "$root/usr/athena" |
---|
83 | ln -s ../.srvd/usr/afsws "$root/usr/afsws" |
---|
84 | ;; |
---|
85 | |
---|
86 | esac |
---|
87 | |
---|
88 | # It's really convenient to have a nice shell in the build root area, |
---|
89 | # at least on Solaris. |
---|
90 | mkdir -p "$root/bin/athena" |
---|
91 | cp /bin/athena/tcsh "$root/bin/athena/tcsh" |
---|
92 | |
---|
93 | # The discuss build needs the discuss user to be in the passwd file. |
---|
94 | grep '^discuss' /etc/passwd >> $root/etc/passwd |
---|
95 | |
---|
96 | # Create the shadow password file, so programs such as passwd get |
---|
97 | # configured properly. |
---|
98 | chroot $root $pwconv |
---|
99 | |
---|
100 | # Prepare the source locker symlinks. |
---|
101 | mkdir -p "$root/mit" |
---|
102 | ln -s /afs/dev.mit.edu/source/src-current $root/mit/source |
---|
103 | if [ -n "$ver" ]; then |
---|
104 | ln -s /afs/dev.mit.edu/source/src-$ver $root/mit/source-$ver |
---|
105 | fi |
---|