/[fai]/trunk/scripts/make-fai-nfsroot
ViewVC logotype

Diff of /trunk/scripts/make-fai-nfsroot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 187 by lange, Wed Nov 15 17:09:01 2000 UTC revision 203 by lange, Thu Nov 16 18:06:27 2000 UTC
# Line 44  done Line 44  done
44  . /etc/fai.conf  . /etc/fai.conf
45    
46  conffile=$NFSROOT/etc/rcS_fai.conf  conffile=$NFSROOT/etc/rcS_fai.conf
 aptconf=$LIBFAI/etc/apt.conf.nfsroot  
47    
48  # Additional packages that are install to nfsroot  # Additional packages that are install to nfsroot
49  packages="$NFSROOT_PACKAGES perl-5.005 dhcp-client file rdate cfengine bootpc wget rsh-client less ssh dump ext2resize raidtools2 lvm strace expect5.31"  packages="$NFSROOT_PACKAGES perl-5.005 dhcp-client file rdate cfengine bootpc wget rsh-client less ssh dump ext2resize raidtools2 lvm strace expect5.31"
# Line 58  else Line 57  else
57  fi  fi
58    
59  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
60    die() {
61    
62        echo $*
63        exit 99
64    }
65    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
66  setup_ssh() {  setup_ssh() {
67    
68      # enable root login      # enable root login
# Line 85  copy_fai_files() { Line 90  copy_fai_files() {
90          KERNELVERSION=$KERNELVERSION          KERNELVERSION=$KERNELVERSION
91          FAI_PACKAGEDIR=$FAI_PACKAGEDIR          FAI_PACKAGEDIR=$FAI_PACKAGEDIR
92          FAI_BASETGZ=$FAI_BASETGZ          FAI_BASETGZ=$FAI_BASETGZ
93            MNTPOINT=$MNTPOINT
94  EOF  EOF
95  }  }
96  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Line 95  create_nfsroot() { Line 101  create_nfsroot() {
101      get_basetgz      get_basetgz
102      echo -n "Unpacking " ; ls /tmp/base?_?.tgz      echo -n "Unpacking " ; ls /tmp/base?_?.tgz
103      tar zxpf /tmp/base?_?.tgz      tar zxpf /tmp/base?_?.tgz
104      mknod dev/boot255 c 0 255      mknod $NFSROOT/dev/boot255 c 0 255
105        mkdir -p $NFSROOT/$MNTPOINT
106    
107        if [ "$FAI_PACKAGEDIR" ]; then
108            mount -o ro,rsize=8192 $FAI_PACKAGEDIR $NFSROOT/$MNTPOINT || die "Can't mount $FAI_PACKAGEDIR"
109        fi
110    
111      # hoaks some packages      # hoaks some packages
112      touch etc/fstab etc/raidtab # dump and raidtool2 needs these files      touch etc/fstab etc/raidtab # dump and raidtool2 needs these files
# Line 104  create_nfsroot() { Line 115  create_nfsroot() {
115      mkdir -p $NFSROOT/etc/ssh ; touch $NFSROOT/etc/ssh/NOSERVER      mkdir -p $NFSROOT/etc/ssh ; touch $NFSROOT/etc/ssh/NOSERVER
116    
117      echo "$FAI_SOURCES_LIST" > $NFSROOT/etc/apt/sources.list      echo "$FAI_SOURCES_LIST" > $NFSROOT/etc/apt/sources.list
   
118      upgrade_nfsroot      upgrade_nfsroot
119      copy_fai_files      copy_fai_files
120    
121      # set timezone      # set timezone
122      rm -f $NFSROOT/etc/localtime      rm -f $NFSROOT/etc/localtime
123      cp -dp /etc/localtime $NFSROOT/etc      cp -dp /etc/localtime /etc/timezone $NFSROOT/etc
     cp -dp /etc/timezone $NFSROOT/etc  
124    
125      # make little changes to nfsroot, because most file systems are read only      # make little changes to nfsroot, because most file systems are read only
126      rm -rf etc/mtab var/run      rm -rf etc/mtab var/run
# Line 152  upgrade_nfsroot() { Line 161  upgrade_nfsroot() {
161    
162      echo "Upgrading $NFSROOT"      echo "Upgrading $NFSROOT"
163      {      {
164      apt-get -c $aptconf update      chroot $NFSROOT apt-get update
165      apt-get -c $aptconf check      chroot $NFSROOT apt-get check
166      chroot $NFSROOT mount -n -t proc proc /proc      chroot $NFSROOT mount -n -t proc proc /proc
167      rm -rf $NFSROOT/etc/pcmcia $NFSROOT/etc/apm      rm -rf $NFSROOT/etc/pcmcia $NFSROOT/etc/apm
168      apt-get -c $aptconf -y remove pcmcia-cs </dev/null      chroot $NFSROOT apt-get -y remove pcmcia-cs </dev/null
169    
170      # because start-stop-dameon must be faked do it here      # because start-stop-dameon must be faked do it here
171      apt-get -c $aptconf -y install dpkg </dev/null      chroot $NFSROOT apt-get -y install dpkg </dev/null
172      cp -p $LIBFAI/sbin/start-stop-daemon $NFSROOT/sbin      cp -p $LIBFAI/sbin/start-stop-daemon $NFSROOT/sbin
173    
174      apt-get -c $aptconf -y upgrade </dev/null      chroot $NFSROOT apt-get -y upgrade </dev/null
175      } > $devnull      } > $devnull
176      echo "Adding additional packages to $NFSROOT:"      echo "Adding additional packages to $NFSROOT:"
177      echo "$packages"      echo "$packages"
178      {      {
179      apt-get -c $aptconf -y --fix-missing install $packages </dev/null      chroot $NFSROOT apt-get -y --fix-missing install $packages </dev/null
180      chroot $NFSROOT umount -n /proc      chroot $NFSROOT umount -n /proc
181      } > $devnull      } > $devnull
182  }  }
# Line 175  upgrade_nfsroot() { Line 184  upgrade_nfsroot() {
184  get_basetgz() {  get_basetgz() {
185    
186      [ -f /tmp/base?_?.tgz ] && return      [ -f /tmp/base?_?.tgz ] && return
187        [ "$BASETGZ" ] || die "no /tmp/base?_?.tgz found and BASETGZ not defined."
188      case $BASETGZ in      case $BASETGZ in
189          ftp:*|http:*)          ftp:*|http:*)
190              echo "Getting $BASETGZ via wget. This may take some time."              echo "Getting $BASETGZ via wget. This may take some time."
191              wget -q -P/tmp $BASETGZ  
192                TMPBDIR=`mktemp /tmp/FAI-wget-XXXXXX` || exit 1
193                rm $TMPBDIR; mkdir $TMPBDIR || exit
194                wget -q -P$TMPBDIR $BASETGZ
195                mv $TMPBDIR/base?_?.tgz /tmp
196                rm -rf $TMPBDIR
197              ;;              ;;
198          *) cd /tmp ; ln -s $BASETGZ          *)
199                cd /tmp
200                rm -f base?_?.tgz
201                ln -s $BASETGZ
202              ;;              ;;
203      esac      esac
204  }  }
# Line 196  install_kernel_nfsroot() { Line 214  install_kernel_nfsroot() {
214    
215  if [ -d $NFSROOT/fai ]; then  if [ -d $NFSROOT/fai ]; then
216      echo $NFSROOT already exists. Removing $NFSROOT      echo $NFSROOT already exists. Removing $NFSROOT
217      umount $NFSROOT/dev/pts 2>/dev/null      umount $NFSROOT/dev/pts 1>/dev/null 2>&1
218      rm -rf $NFSROOT      rm -rf $NFSROOT
219  fi  fi
220      create_nfsroot  
221      install_kernel_nfsroot  create_nfsroot
222    test -d $NFSROOT/$MNTPOINT && umount $NFSROOT/$MNTPOINT
223    
224  # create tftp boot images  # create tftp boot images
225    install_kernel_nfsroot
226  mknbi-linux --verbose $NFSROOT/boot/vmlinuz-$KERNELVERSION /boot/fai/installimage  mknbi-linux --verbose $NFSROOT/boot/vmlinuz-$KERNELVERSION /boot/fai/installimage
227    # imggen is a free software from 3com
 # imggen is a tool from 3com  
228  imggen=`which imggen || true`  imggen=`which imggen || true`
229  if [ -x $imggen ]; then  if [ -x $imggen ]; then
230      imggen -a /boot/fai/installimage /boot/fai/installimage_3com      imggen -a /boot/fai/installimage /boot/fai/installimage_3com

Legend:
Removed from v.187  
changed lines
  Added in v.203

  ViewVC Help
Powered by ViewVC 1.1.5