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 ===="
67 # Eliminate recursive link
71 # Copy all needed shared libraries
72 echo "Building root shared libaries ..."
73 rm -f `find roottree/lib/ -maxdepth 1 -type f 2>/dev/null`
75 # Statically linked binaries create an error
76 # message from ldd, so we ignore those
78 for lib in `find roottree/sbin/ -type f -exec ldd {} \; | awk '{print $3}' | sort | uniq` ; do
80 cp -fp $lib roottree/lib/
88 # Wouldn't you know, there is one so that is critical to have or
89 # nothing will load on 2.6 kernels.
91 cp -fp /lib/ld-linux.so.* roottree/lib/
92 strip `find roottree/lib/ -maxdepth 1 -type f` 2>/dev/null
95 mkdir -p roottree/usr/share/grub
96 cp -fpr /usr/share/grub/* roottree/usr/share/grub
99 # Get a bunch of stuff from /etc
101 echo "Building /etc ..."
102 cp -p /etc/services roottree/etc/
103 if [ $? != 0 ] ; then
104 echo "Update failed."
108 for file in `cat rootetc.list` ; do
109 if [ -e $file ] ; then
110 cp -fp $file roottree/etc/
112 echo "==== Could not find $file in /etc ===="
115 if [ -e /etc/modules.conf ] ; then
116 cp -fp /etc/modules.conf roottree/etc/
118 if [ -e /etc/modprobe.conf ] ; then
119 cp -fp /etc/modprobe.conf roottree/etc/
121 rm -rf roottree/etc/pam.d
122 if [ -e /etc/pam.d ] ; then
123 cp -a /etc/pam.d roottree/etc/
124 if [ -e /etc/pam.conf ] ; then
125 cp -fp /etc/pam.conf roottree/etc/
129 if [ -e /etc/init.d ] ; then
130 rm -rf roottree/etc/init.d
131 cp -aL /etc/init.d roottree/etc/
134 if [ -e /etc/udev ] ; then
135 rm -rf roottree/etc/udev
136 cp -aL /etc/udev roottree/etc/
140 if [ -e /etc/ssh ] ; then
141 cp -a /etc/ssh roottree/etc/
142 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
144 echo "!!!! Warning your /etc/ssh directory was copied. !!!!"
145 echo "!!!! Keep this directory and the CDROM secure. !!!!"
147 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
149 if [ -e /etc/security ] ; then
150 cp -a /etc/security roottree/etc/
154 # Pull a few files needed by PAM
156 if [ -f /lib/libnss_files.so.1 ] ; then
157 cp -fp /lib/libnss_files.so.1 roottree/lib/
159 cp -fp /lib/libnss_files.so.* roottree/lib/
160 cp -a /lib/security roottree/lib/