source: trunk/packs/build/makeroot.sh @ 20475

Revision 20475, 4.1 KB checked in by ghudson, 21 years ago (diff)
Remove smmsp from the group file as well as the passwd file.
Line 
1#!/bin/sh
2# $Id: makeroot.sh,v 1.24 2004-05-16 21:19:01 ghudson Exp $
3
4if [ $# -lt 1 ]; then
5  echo "Usage: $0 rootdir [fullversion]" >&2
6  exit 1
7fi
8
9root=$1
10ver=$2
11
12case `machtype` in
13linux)
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
41sun4)
42  pwconv=/usr/sbin/pwconv
43
44  # Create an admin file for pkgadd, which will skip most checks, but
45  # will check package dependencies.
46  admin=/tmp/admin$$
47  rm -rf "$admin"
48  cat > "$admin" << 'EOF'
49mail=
50instance=unique
51partial=nocheck
52runlevel=nocheck
53idepend=quit
54rdepend=quit
55space=nocheck
56setuid=nocheck
57conflict=nocheck
58action=nocheck
59basedir=default
60EOF
61
62  # Install packages.
63  for i in `cat /install/cdrom/.order.install`; do
64    echo "$i: \c"
65    pkgadd -n -R "$root" -a "$admin" -d /install/cdrom "$i"
66  done 2>/dev/null
67  cp /install/cdrom/INST_RELEASE "$root/var/sadm/system/admin"
68  rm -f "$admin"
69
70  # Install patches.
71  jot -b y 50 | patchadd -d -R "$root" -u -M /install/patches \
72    `cat /install/patches/current-patches`
73
74  # /usr/lib/isaexec (a front end which selects between the sparcv7 and
75  # sparcv9 versions of a binary) doesn't work in a chrooted environment
76  # (getexecname() fails due to lack of procfs).  The only binary
77  # linked to isaexec relevant to the build system is "sort".  Work
78  # around the problem by copying the sparcv9 "sort" to /usr/bin,
79  # since ensuring that procfs is always mounted in the chroot area is a
80  # little messy.
81  rm -f "$root/usr/bin/sort"
82  cp "$root/usr/bin/sparcv9/sort" "$root/usr/bin/sort"
83
84  # Make devices.
85  cd "$root"
86  drvconfig -r devices -p "$root/etc/path_to_inst"
87  devlinks -t "$root/etc/devlink.tab" -r "$root"
88  disks -r "$root"
89
90  # third/gnome-utils wants to know where to look for log messages.
91  touch "$root/var/adm/messages"
92
93  # pkgadd needs to use mnttab.  We can fake it out by copying /etc/mnttab.
94  cp /etc/mnttab "$root/etc"
95
96  # Make links into destination area.
97  ln -s ../build/athtools/usr/athena "$root/usr/athena"
98  ln -s ../build/athtools/usr/afsws "$root/usr/afsws"
99  ln -s ../build/athtools/usr/gcc "$root/usr/gcc"
100
101  # So packages can figure out where sendmail is.  (sendmail normally
102  # comes from MIT-sendmail, which we don't install; this is simpler
103  # than installing either the MIT-sendmail or a native sendmail package.)
104  touch "$root/usr/lib/sendmail"
105  chmod a+x "$root/usr/lib/sendmail"
106  ;;
107
108esac
109
110# It's really convenient to have a nice shell in the build root area,
111# at least on Solaris.
112mkdir -p "$root/bin/athena"
113cp /bin/athena/tcsh "$root/bin/athena/tcsh"
114
115# Make sure there is no smmsp user in the passwd file; Solaris has one
116# by default, and it confuses sendmail.
117grep -v '^smmsp' $root/etc/passwd > $root/etc/passwd.new
118mv $root/etc/passwd.new $root/etc/passwd
119chmod 644 $root/etc/passwd
120
121# Likewise for the group file.
122grep -v '^smmsp' $root/etc/group > $root/etc/group.new
123mv $root/etc/group.new $root/etc/group
124chmod 644 $root/etc/group
125
126# The discuss build needs the discuss user to be in the passwd file.
127grep '^discuss' /etc/passwd >> $root/etc/passwd
128
129# Create the shadow password file, so programs such as passwd get
130# configured properly.
131chroot $root $pwconv
132
133# Prepare the source locker symlinks.
134mkdir -p "$root/mit"
135ln -s /afs/dev.mit.edu/source/src-current $root/mit/source
136if [ -n "$ver" ]; then
137  ln -s /afs/dev.mit.edu/source/src-$ver $root/mit/source-$ver
138fi
Note: See TracBrowser for help on using the repository browser.