4 PATH
=/usr
/bin
:/sbin
:/usr
/sbin
6 # Create chroot'd area under Solaris 2.5.1 for postfix.
8 # Dug Song <dugsong@UMICH.EDU>
11 echo "Usage: `basename $0` <directory>, e.g.: /var/spool/postfix" ; exit 1
16 # If CHROOT does not exist but parent does, create CHROOT
17 if [ ! -d ${CHROOT} ]; then
18 # lack of -p below is intentional
21 if [ ! -d ${CHROOT} -o "${CHROOT}" = "/" -o "${CHROOT}" = "/usr
" ]; then
22 echo "$0: bad chroot directory
${CHROOT}"
25 for dir in etc/default etc/inet dev usr/lib usr/share/lib/zoneinfo ; do
26 if [ ! -d ${CHROOT}/${dir} ]; then mkdir -p ${CHROOT}/${dir} ; fi
28 #chmod -R 755 ${CHROOT}
31 if [ "`echo $CHROOT | cut -c1-4`" = "/afs
" ]; then
32 echo '\tCreating memory resident /dev...'
33 mount -F tmpfs -o size=10 swap ${CHROOT}/dev
37 cp /etc/nsswitch.conf ${CHROOT}/etc
38 cp /etc/netconfig /etc/resolv.conf ${CHROOT}/etc
39 cp /etc/default/init ${CHROOT}/etc/default
40 cp /etc/inet/services ${CHROOT}/etc/inet/services
41 ln -s /etc/inet/services ${CHROOT}/etc/services
42 find ${CHROOT}/etc -type f -exec chmod 444 {} \;
44 # Most of the following are needed for basic operation, except
45 # for libnsl.so, nss_nis.so, libsocket.so, and straddr.so which are
46 # needed to resolve NIS names.
47 cp /usr/lib/ld.so /usr/lib/ld.so.1 ${CHROOT}/usr/lib
48 for lib in libc libdl libintl libmp libnsl libsocket libw \
49 nss_nis nss_nisplus nss_dns nss_files; do
50 cp /usr/lib/${lib}.so.1 ${CHROOT}/usr/lib
51 rm -f ${CHROOT}/usr/lib/${lib}.so
52 ln -s ./${lib}.so.1 ${CHROOT}/usr/lib/${lib}.so
54 cp /usr/lib/straddr.so.2 ${CHROOT}/usr/lib
55 rm -f ${CHROOT}/usr/lib/straddr.so
56 ln -s ./straddr.so.2 ${CHROOT}/usr/lib/straddr.so
57 chmod 555 ${CHROOT}/usr/lib/*
59 # Copy timezone database.
60 (cd ${CHROOT}/usr/share/lib/zoneinfo
61 (cd /usr/share/lib/zoneinfo; find . -print | cpio -o) | cpio -imdu
62 find . -print | xargs chmod 555
65 # Make device nodes. We need ticotsord, ticlts and udp to resolve NIS names.
66 for device in zero tcp udp ticotsord ticlts; do
67 line=`ls -lL /dev/${device} | sed -e 's/,//'`
68 major=`echo $line | awk '{print $5}'`
69 minor=`echo $line | awk '{print $6}'`
70 rm -f ${CHROOT}/dev/${device}
71 mknod ${CHROOT}/dev/${device} c ${major} ${minor}
73 chmod 666 ${CHROOT}/dev/*