3 # this script finds all binaries and updates them with the ones
4 # from your system, in order to maintain them more easily.
5 # Be careful. If you have specially made binaries (perhaps lean ones),
6 # they will be overwritten.
10 PATH="/sbin:/bin:/usr/sbin:/usr/bin:$PATH"
13 # Cleanup and make necessary directories
15 mkdir -p $R/etc $R/initrd $R/lib $R/mnt $R/mnt/cdrom
16 mkdir -p $R/proc $R/root $R/sbin $R/tmp $R/var
17 mkdir -p $R/dev $R/sys $R/initrd $R/sysroot
18 mkdir -p $R/etc/terminfo $R/etc/terminfo/l
19 mkdir -p $R/var/lib $R/var/log $R/var/run $R/var/state
20 mkdir -p $R/var/lib/nfs
21 mkdir -p $R/var/log/news
22 touch $R/var/log/news/news.crit $R/var/log/news/news.err $R/var/log/news.notice
29 # Some users have a different shell for root, so be
30 # sure to add it to the rootsbin list. Note, the shell may
31 # be copied twice, but it is not worth the effort to run uniq
34 TMPFILE=`mktemp -t bin.XXXXXXXXXX`
36 echo "Could not make temp file"
39 cat rootsbin.list >${TMPFILE}
40 command=`grep ^root: /etc/passwd | cut -d ':' -f 7`
41 command=`basename $command`
42 if [ x$command != "xbash" ] ; then
43 echo "roottree/sbin/$command" >>${TMPFILE}
46 echo "Building root /sbin. Some Could not find messages are normal ..."
47 for file in `cat ${TMPFILE}` ; do
48 command=`basename $file`
49 fullfile=`which $command 2> /dev/null`
50 if [ x$fullfile != x ] ; then
51 echo "updating $command in roottree with $fullfile"
52 cp -fpd $fullfile $file
57 strip $file 2>/dev/null
59 echo "==== Could not find $command on your system ===="
69 # Copy all needed shared libraries
70 echo "Building root shared libaries ..."
71 rm -f `find roottree/lib/ -maxdepth 1 -type f 2>/dev/null`
73 # Statically linked binaries create an error
74 # message from ldd, so we ignore those
76 for lib in `find roottree/sbin/ -type f -exec ldd {} \; | awk '{print $3}' | sort | uniq` ; do
78 cp -fp $lib roottree/lib/
86 # Wouldn't you know, there is one so that is critical to have or
87 # nothing will load on 2.6 kernels.
89 cp -fp /lib/ld-linux.so.* roottree/lib/
90 strip `find roottree/lib/ -maxdepth 1 -type f` 2>/dev/null
94 # Get a bunch of stuff from /etc
96 echo "Building /etc ..."
97 cp -p /etc/services roottree/etc/
103 for file in `cat rootetc.list` ; do
104 if [ -e $file ] ; then
105 cp -fp $file roottree/etc/
107 echo "==== Could not find $file in /etc ===="
110 if [ -e /etc/modules.conf ] ; then
111 cp -fp /etc/modules.conf roottree/etc/
113 if [ -e /etc/modprobe.conf ] ; then
114 cp -fp /etc/modprobe.conf roottree/etc/
116 rm -rf roottree/etc/pam.d
117 if [ -e /etc/pam.d ] ; then
118 cp -a /etc/pam.d roottree/etc/
119 if [ -e /etc/pam.conf ] ; then
120 cp -fp /etc/pam.conf roottree/etc/
124 if [ -e /etc/init.d ] ; then
125 rm -rf roottree/etc/init.d
126 cp -aL /etc/init.d roottree/etc/
129 if [ -e /etc/udev ] ; then
130 rm -rf roottree/etc/udev
131 cp -aL /etc/udev roottree/etc/
135 if [ -e /etc/ssh ] ; then
136 cp -a /etc/ssh roottree/etc/
137 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
139 echo "!!!! Warning your /etc/ssh directory was copied. !!!!"
140 echo "!!!! Keep this directory and the CDROM secure. !!!!"
142 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
144 if [ -e /etc/security ] ; then
145 cp -a /etc/security roottree/etc/
149 # Pull a few files needed by PAM
151 if [ -f /lib/libnss_files.so.1 ] ; then
152 cp -fp /lib/libnss_files.so.1 roottree/lib/
154 cp -fp /lib/libnss_files.so.* roottree/lib/
155 cp -a /lib/security roottree/lib/