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"
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
28 echo "Building root /sbin. Some Could not find messages are normal ..."
29 for file in `cat rootsbin.list` ; do
30 command=`basename $file`
31 fullfile=`which $command 2> /dev/null`
32 if [ x$fullfile != x ] ; then
33 # echo "updating $command in roottree with $fullfile"
34 cp -fpd $fullfile $file
39 strip $file 2>/dev/null
41 echo "==== Could not find $command on your system ===="
49 # Copy all needed shared libraries
50 echo "Building root shared libaries ..."
51 rm -f `find roottree/lib/ -maxdepth 1 -type f 2>/dev/null`
53 # Statically linked binaries create an error
54 # message from ldd, so we ignore those
56 for lib in `find roottree/sbin/ -type f -exec ldd {} \; | awk '{print $3}' | sort | uniq` ; do
58 cp -fp $lib roottree/lib/
65 cp -fp /lib/ld-linux.so.2 roottree/lib/
66 strip `find roottree/lib/ -maxdepth 1 -type f` 2>/dev/null
69 cp -p /etc/services roottree/etc/
76 # Get a bunch of stuff from /etc
78 echo "Building /etc ..."
79 for file in `cat rootetc.list` ; do
80 if [ -e $file ] ; then
81 cp -fp $file roottree/etc/
83 echo "==== Could not find $file in /etc ===="
86 if [ -e /etc/modules.conf ] ; then
87 cp -fp /etc/modules.conf roottree/etc/
89 if [ -e /etc/modprobe.conf ] ; then
90 cp -fp /etc/modprobe.conf roottree/etc/
92 rm -rf roottree/etc/pam.d
93 if [ -e /etc/pam.d ] ; then
94 cp -a /etc/pam.d roottree/etc/
95 if [ -e /etc/pam.conf ] ; then
96 cp -fp /etc/pam.conf roottree/etc/
100 if [ -e /etc/init.d ] ; then
101 rm -rf roottree/etc/init.d
102 cp -aL /etc/init.d roottree/etc/
105 if [ -e /etc/udev ] ; then
106 rm -rf roottree/etc/udev
107 cp -aL /etc/udev roottree/etc/
111 if [ -e /etc/ssh ] ; then
112 cp -a /etc/ssh roottree/etc/
113 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
115 echo "!!!! Warning your /etc/ssh directory was copied. !!!!"
116 echo "!!!! Keep this directory and the CDROM secure. !!!!"
118 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
120 if [ -e /etc/security ] ; then
121 cp -a /etc/security roottree/etc/
125 # Pull a few files needed by PAM
127 if [ -e /lib/libnss_files.so.1 ] ; then
128 cp -fp /lib/libnss_files.so.1 roottree/lib/
130 cp -fp /lib/libnss_files.so.2 roottree/lib/
131 cp -a /lib/security roottree/lib/