~vcs-imports/fai/trunk

« back to all changes in this revision

Viewing changes to bin/make-fai-nfsroot

  • Committer: lange
  • Date: 2005-11-10 12:47:47 UTC
  • Revision ID: svn-v4:ba5ec265-b0fb-0310-8e1a-cf9e4c2b1591:trunk:3022
rename directory scripts to bin, fix pathes in Makefile

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/bash
 
2
 
 
3
# $Id$
 
4
#*********************************************************************
 
5
#
 
6
# make-fai-nfsroot -- create nfsroot directory and add additional packages
 
7
#
 
8
# This script is part of FAI (Fully Automatic Installation)
 
9
# (c) 2000-2005 by Thomas Lange, lange@informatik.uni-koeln.de
 
10
# Universitaet zu Koeln
 
11
#
 
12
#*********************************************************************
 
13
# This program is free software; you can redistribute it and/or modify
 
14
# it under the terms of the GNU General Public License as published by
 
15
# the Free Software Foundation; either version 2 of the License, or
 
16
# (at your option) any later version.
 
17
#
 
18
# This program is distributed in the hope that it will be useful, but
 
19
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
21
# General Public License for more details.
 
22
 
23
# A copy of the GNU General Public License is available as
 
24
# `/usr/share/common-licences/GPL' in the Debian GNU/Linux distribution
 
25
# or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html.  You
 
26
# can also obtain it by writing to the Free Software Foundation, Inc.,
 
27
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
28
#*********************************************************************
 
29
 
 
30
PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
 
31
 
 
32
if [ `id -u` -ne 0 ]; then
 
33
    echo "Run this program as root."
 
34
    exit 9
 
35
fi
 
36
 
 
37
merror="properly"
 
38
# option e currently does nothing
 
39
while getopts ervc:f:kK opt ; do
 
40
    case "$opt" in
 
41
        c) cfdir=$OPTARG ;;
 
42
        v) verbose=1 ; v=-v ;;
 
43
        r) recover=1 ;;
 
44
        f) cfg=$OPTARG ;;
 
45
        k) kinstall=1 ;;
 
46
        K) kremove=1; kinstall=1 ;;
 
47
        e) expert=1 ;;
 
48
        ?) exit 5 ;; # error in option parsing
 
49
    esac
 
50
done
 
51
 
 
52
set -e
 
53
 
 
54
[ -z "$cfdir" ] && cfdir=/etc/fai
 
55
if [ ! -d "$cfdir" ]; then
 
56
    echo "$cfdir is not a directory"
 
57
    exit 6
 
58
fi
 
59
[ "$verbose" ] && echo "Using configuration files from directory $cfdir"
 
60
if [ -n "$cfg" ]; then
 
61
    . $cfdir/$cfg
 
62
else
 
63
    . $cfdir/fai.conf
 
64
fi
 
65
 
 
66
# read config file for this tool
 
67
if [ -f "$cfdir/make-fai-nfsroot.conf" ]; then
 
68
    . $cfdir/make-fai-nfsroot.conf
 
69
else
 
70
    echo "Can't read $cfdir/make-fai-nfsroot.conf"
 
71
    exit 8
 
72
fi
 
73
 
 
74
if [ -z "$NFSROOT" ]; then
 
75
    echo "\$NFSROOT is not set. Please check your settings in $cfdir/fai.conf."
 
76
    exit 4
 
77
fi
 
78
 
 
79
if [ "$FAI_SOURCES_LIST" ]; then
 
80
    echo "The usage of the variable \$FAI_SOURCES_LIST is deprecated. Please use sources.list now."
 
81
    exit 3
 
82
fi
 
83
 
 
84
if [ ! -s "$cfdir/sources.list" -a ! -f /etc/apt/sources.list ]; then
 
85
    echo "Neither $cfdir/sources.list nor /etc/apt/sources.list exists."
 
86
    echo "I think something is wrong. Can't continue."
 
87
    exit 7
 
88
fi
 
89
 
 
90
kfile="vmlinuz"
 
91
case `dpkg --print-installation-architecture` in
 
92
    i386)
 
93
        arch_packages="grub lilo kudzu dmidecode hwtools read-edid" ;;
 
94
 
 
95
    amd64)
 
96
        arch_packages="grub lilo kudzu dmidecode" ;;
 
97
 
 
98
    ia64)
 
99
        arch_packages="elilo gnu-efi efibootmgr" ;;
 
100
 
 
101
    sparc)
 
102
        arch_packages="silo sparc-utils" ;;
 
103
 
 
104
    powerpc)
 
105
        arch_packages="" ;;
 
106
 
 
107
    alpha)
 
108
        arch_packages="aboot" ;;
 
109
 
 
110
    *)  arch_packages="" ;;
 
111
esac
 
112
packages="$packages
 
113
$arch_packages"
 
114
 
 
115
ROOTCMD="chroot $NFSROOT"
 
116
 
 
117
RUNDIR=/var/run/fai/make-fai-nfsroot
 
118
[ ! -d $RUNDIR ] && mkdir -p $RUNDIR
 
119
export DEBIAN_FRONTEND=noninteractive
 
120
[ "$recover" ] || rm -rf $RUNDIR/*
 
121
 
 
122
trap "umount_dirs" EXIT
 
123
trap "bad_exit" ERR
 
124
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
125
bad_exit() {
 
126
 
 
127
    merror="with errors"
 
128
    echo "An error occured during make-fai-nfsroot."
 
129
    echo "Please fix the error or try make-fai-nfsroot -v"
 
130
}
 
131
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
132
die() {
 
133
 
 
134
    echo "$@"
 
135
    exit 99
 
136
}
 
137
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
138
call_with_stamp() {
 
139
 
 
140
    local func=$1
 
141
    local stamp=$RUNDIR/$func
 
142
    # call subroutine
 
143
    [ "$recover" -a -f $stamp ] && return 0 
 
144
    "$@"
 
145
    > $stamp
 
146
}
 
147
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
148
call_verbose() {
 
149
 
 
150
    if [ "$verbose" ]; then
 
151
        "$@"
 
152
    else
 
153
        "$@" > /dev/null
 
154
    fi
 
155
}
 
156
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
157
install_kernel_nfsroot() {
 
158
 
 
159
    rm -rf $NFSROOT/boot/*-$KERNELVERSION $NFSROOT/lib/modules/$KERNELVERSION
 
160
    # since woody we can install the kernel using dpkg -i
 
161
    echo "do_boot_enable=no" > $NFSROOT/etc/kernel-img.conf
 
162
    dpkg -x $KERNELPACKAGE $NFSROOT
 
163
    # if $NFROOT/proc/modules exists, then update-modules calls depmod -a without
 
164
    # these special flags; so umount first
 
165
    [ -e $NFSROOT/proc/modules ] && umount $NFSROOT/proc
 
166
    chroot $NFSROOT update-modules
 
167
    chroot $NFSROOT depmod -qaF /boot/System.map-$KERNELVERSION $KERNELVERSION || true
 
168
}
 
169
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
170
setup_ssh() {
 
171
 
 
172
    # nothing to do if no ssh is available in nfsroot
 
173
    [ -f $NFSROOT/var/lib/dpkg/info/ssh.list ] || return 0
 
174
    mkdir -p -m 700 $NFSROOT/root/.ssh
 
175
    if [ -n "$LOGUSER" ] ; then
 
176
        loguserhome=`eval "cd ~$LOGUSER 2>/dev/null && pwd;true"`
 
177
    # is copying of *.pub important?
 
178
        [ -f $loguserhome/.ssh/known_hosts ] && cp $loguserhome/.ssh/known_hosts $NFSROOT/root/.ssh/known_hosts
 
179
        [ -d $loguserhome/.ssh ] && {
 
180
            [ -f $loguserhome/.ssh/id_dsa ] &&
 
181
               cp -p $loguserhome/.ssh/id_dsa* $NFSROOT/root/.ssh/
 
182
            [ -f $loguserhome/.ssh/id_rsa ] &&
 
183
               cp -p $loguserhome/.ssh/id_rsa* $NFSROOT/root/.ssh/
 
184
            cp -p $loguserhome/.ssh/*.pub $NFSROOT/root/.ssh/
 
185
        }
 
186
    fi
 
187
 
 
188
    # enable root login
 
189
    perl -pi -e 's/PermitRootLogin no/PermitRootLogin yes/' $NFSROOT/etc/ssh/sshd_config
 
190
    if [ -f "$SSH_IDENTITY" ]; then
 
191
        cp $SSH_IDENTITY $NFSROOT/root/.ssh/authorized_keys
 
192
        chmod 0644 $NFSROOT/root/.ssh/authorized_keys
 
193
        echo You can log into install clients without password using $SSH_IDENTITY
 
194
    fi
 
195
}
 
196
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
197
copy_fai_files() {
 
198
 
 
199
    # copy to nfsroot
 
200
    perl -pi -e "s#^root::#root:${FAI_ROOTPW}:#" etc/passwd
 
201
    cd $NFSROOT
 
202
    cp -Rpv $cfdir/* $NFSROOT/etc/fai
 
203
    # remove some files that should not be copied
 
204
    rm -f $NFSROOT/etc/fai/make-fai-nfsroot.conf
 
205
    [ -f $cfdir/.cvspass ] && cp -p $v $cfdir/.cvspass $NFSROOT/.cvspass
 
206
    $ROOTCMD shadowconfig on
 
207
}
 
208
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
209
call_debootstrap() {
 
210
    
 
211
    echo "Creating nfsroot for $1 using debootstrap"
 
212
    [ "$verbose" ] && echo "Calling debootstrap $1 $NFSROOT $2"
 
213
    yes '' | LC_ALL=C call_verbose debootstrap $FAI_DEBOOTSTRAP_OPTS $1 $NFSROOT $2 || true
 
214
}
 
215
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
216
create_base() {
 
217
 
 
218
    if [ "$FAI_DEBOOTSTRAP" ]; then
 
219
        call_with_stamp call_debootstrap $FAI_DEBOOTSTRAP
 
220
        $ROOTCMD apt-get clean
 
221
        rm -f $NFSROOT/etc/resolv.conf
 
222
        echo "Creating base.tgz"
 
223
        tar -l -C $NFSROOT -cf - --exclude var/tmp/base.tgz . | gzip > $NFSROOT/var/tmp/base.tgz
 
224
        touch $NFSROOT/.THIS_IS_THE_FAI_NFSROOT
 
225
    else
 
226
        die "\$FAI_DEBOOTSTRAP not defined."
 
227
    fi
 
228
}
 
229
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
230
create_nfsroot() {
 
231
 
 
232
    mkdir -p $NFSROOT/$FAI
 
233
    cd $NFSROOT || die "Error: Can't cd to $NFSROOT"
 
234
 
 
235
    call_with_stamp create_base
 
236
    # save the list of all packages in the base.tgz
 
237
    $ROOTCMD dpkg --get-selections | egrep 'install$' | awk '{print $1}' > var/tmp/base-pkgs.lis
 
238
    echo $arch_packages > $NFSROOT/var/tmp/packages.arch
 
239
 
 
240
    if [ "$FAI_DEBMIRROR" ]; then
 
241
        [ "$verbose" ] && echo "Mounting $FAI_DEBMIRROR to $NFSROOT/$MNTPOINT."
 
242
        mkdir -p $NFSROOT/$MNTPOINT
 
243
        mount -o ro,noatime,rsize=8192 $FAI_DEBMIRROR $NFSROOT/$MNTPOINT || \
 
244
                die "Can't mount $FAI_DEBMIRROR to $NFSROOT/$MNTPOINT."
 
245
        fi
 
246
 
 
247
    # hoaks some packages
 
248
    # liloconfig, dump and raidtool2 needs these files
 
249
    echo "# UNCONFIGURED FSTAB FOR BASE SYSTEM" > etc/fstab
 
250
    > etc/raidtab
 
251
    mkdir -p lib/modules/$KERNELVERSION           # dirty trick to hoax lvm
 
252
    >  lib/modules/$KERNELVERSION/modules.dep  # dirty trick to hoax lvm
 
253
    echo 'NTPSERVERS=""' > etc/default/ntp-servers
 
254
 
 
255
    [ -d $NFSROOT/var/state ] || mkdir $NFSROOT/var/state
 
256
    [ "$verbose" ] && echo "Try to copy $cfdir/sources.list or /etc/apt/sources.list."
 
257
    cp -v $cfdir/sources.list $NFSROOT/etc/apt/sources.list || \
 
258
        cp -v /etc/apt/sources.list $NFSROOT/etc/apt/sources.list || \
 
259
        { echo "No sources.list file found."
 
260
          echo "I think something is wrong. But I'll try to continue."
 
261
        }
 
262
 
 
263
    echo "127.0.0.1 localhost" >> etc/hosts
 
264
    echo "$NFSROOT_ETC_HOSTS" >> etc/hosts
 
265
    [ -f /etc/apt/preferences ] && cp -v /etc/apt/preferences $NFSROOT/etc/apt
 
266
    [ -f $cfdir/preferences ] && cp -v $cfdir/preferences $NFSROOT/etc/apt
 
267
    echo "Upgrading $NFSROOT"
 
268
    LC_ALL=C call_verbose call_with_stamp upgrade_nfsroot  
 
269
    echo "Adding additional packages to $NFSROOT:"
 
270
    echo "$packages"
 
271
    LC_ALL=C call_verbose call_with_stamp add_packages_nfsroot
 
272
    call_with_stamp copy_fai_files
 
273
 
 
274
    # set timezone in nfsroot
 
275
    timezone=$(readlink /etc/localtime | sed 's%^/usr/share/zoneinfo/%%')
 
276
    echo $timezone > etc/timezone 
 
277
    rm -f etc/localtime && ln -sf /usr/share/zoneinfo/$timezone etc/localtime
 
278
 
 
279
    # make little changes to nfsroot, because nfsroot is
 
280
    # read only for the install clients 
 
281
    rm -rf etc/mtab var/run etc/sysconfig
 
282
    ln -s /proc/mounts etc/mtab
 
283
    ln -s /tmp/var/run var/run
 
284
    ln -sf /tmp/var/state/discover var/state/discover
 
285
    ln -sf /tmp/var/lib/discover var/lib/discover
 
286
    ln -s /tmp/etc/syslogsocket dev/log
 
287
    ln -sf /tmp/etc/resolv.conf etc/resolv.conf
 
288
    ln -sf /tmp etc/sysconfig
 
289
    ln -s /usr/sbin/fai etc/init.d/rcS
 
290
    ln -sf /dev/null etc/network/ifstate
 
291
    # for nis
 
292
    [ -d var/yp ] && ln -s /tmp/binding var/yp/binding
 
293
 
 
294
    # turn off logging of loading kernel modules
 
295
    [ -d var/log/ksymoops/ ] && rmdir var/log/ksymoops/
 
296
    ln -s /dev/null var/log/ksymoops
 
297
 
 
298
    # definition for loopback device
 
299
    echo "iface lo inet loopback" > etc/network/interfaces
 
300
 
 
301
    echo "*.* /tmp/fai/syslog.log" > etc/syslog.conf
 
302
    cat >> root/.profile <<-EOF
 
303
        PATH=/usr/local/sbin:/usr/local/bin:/usr/lib/fai:/bin:/sbin:/usr/bin:/usr/sbin:
 
304
        export PATH
 
305
        . /usr/lib/fai/subroutines
 
306
        . /usr/lib/fai/subroutines-$OS_TYPE
 
307
        set -a
 
308
        . /tmp/fai/variables.sh 2>/dev/null
 
309
EOF
 
310
 
 
311
    call_verbose call_with_stamp setup_ssh
 
312
 
 
313
    cat >$NFSROOT/etc/rc2.d/S01fai_abort <<-EOF
 
314
        #!/bin/sh
 
315
        echo FAI: installation aborted.
 
316
        echo reboot with: faireboot
 
317
        echo or after a logout
 
318
        sh
 
319
        cd /
 
320
        umount -ar
 
321
        reboot -dfi
 
322
EOF
 
323
    chmod a+rx $NFSROOT/etc/rc2.d/S01fai_abort
 
324
 
 
325
    echo -e "\n$FAI_LOCAL_REPOSITORY" >> etc/apt/sources.list
 
326
}
 
327
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
328
upgrade_nfsroot() {
 
329
 
 
330
    cp -p $v /etc/resolv.conf $NFSROOT/etc/resolv.conf-installserver
 
331
    cp -p $v /etc/resolv.conf $NFSROOT/etc/resolv.conf # this is needed during make-fai-nfsroot
 
332
    $ROOTCMD apt-get update
 
333
    $ROOTCMD apt-get -fyu install
 
334
    $ROOTCMD apt-get check
 
335
    rm -rf $NFSROOT/etc/apm
 
336
    mount -t proc /proc $NFSROOT/proc
 
337
 
 
338
    fdivert /sbin/start-stop-daemon /sbin/discover-modprobe
 
339
    cp -p /sbin/fai-start-stop-daemon $NFSROOT/sbin/start-stop-daemon
 
340
    $ROOTCMD apt-get -y dist-upgrade
 
341
}
 
342
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
343
add_packages_nfsroot() {
 
344
 
 
345
    $ROOTCMD apt-get -y --fix-missing install $packages </dev/null
 
346
    if [ -n "$NFSROOT_PACKAGES" ] ; then
 
347
        LC_ALL=C $ROOTCMD apt-get -y --fix-missing install $NFSROOT_PACKAGES </dev/null
 
348
    fi
 
349
    $ROOTCMD apt-get clean
 
350
}
 
351
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
352
umount_dirs() {
 
353
 
 
354
    [ -f $NFSROOT/usr/sbin/dpkg-divert ] && 
 
355
       LC_ALL=C $ROOTCMD dpkg-divert --rename --remove /sbin/discover-modprobe
 
356
    cd /
 
357
    sleep 2
 
358
    [ -d $NFSROOT/proc/self ] && umount $NFSROOT/proc 
 
359
    [ -d $NFSROOT/proc/self ] && umount $NFSROOT/dev/pts
 
360
    if [ "$FAI_DEBMIRROR" ]; then
 
361
        test -d $NFSROOT/$MNTPOINT && umount $NFSROOT/$MNTPOINT || true
 
362
    fi
 
363
    # show directories still mounted on nfsroot
 
364
    mount | grep " on $NFSROOT " || true
 
365
}
 
366
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
367
get_kernel_version() {
 
368
 
 
369
    local package=$1
 
370
    KERNELVERSION=`dpkg --info $package | grep "Package: kernel-image" | sed -e 's/.*kernel-image-'//`
 
371
}
 
372
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
373
setup_bootp(){
 
374
 
 
375
    if [ -x "`which mkelf-linux`" ]; then
 
376
        mkelf-linux --ip=any --output=/boot/fai/installimage \
 
377
          $NFSROOT/boot/$kfile-$KERNELVERSION 
 
378
    else
 
379
        echo "Command mkelf-linux not found. Can not set up BOOTP booting. Please install the package mknbi and rerun fai-setup."
 
380
        return
 
381
    fi
 
382
 
 
383
    # imggen is free software from 3com - use ver1.00: 1.01 produces "Image too Big" errors.
 
384
    # it converts netboot images to images which are bootable by 3com network cards
 
385
    if [ -x "`which imggen`" ]; then
 
386
        imggen -a /boot/fai/installimage /boot/fai/installimage_3com
 
387
    fi
 
388
    echo "BOOTP environment prepared."
 
389
}
 
390
 
 
391
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
392
setup_dhcp(){
 
393
 
 
394
    # pxe and dhcp environment
 
395
    local pxebin=/usr/lib/syslinux/pxelinux.0
 
396
    cp -p $NFSROOT/boot/$kfile-$KERNELVERSION /boot/fai/$kfile-install
 
397
    [ -f $pxebin ] && cp $pxebin /boot/fai
 
398
    [ -d /boot/fai/pxelinux.cfg ] || mkdir -p /boot/fai/pxelinux.cfg || true
 
399
    echo "DHCP environment prepared. If you want to use it, you have to enable the dhcpd and the tftp-hpa daemon."
 
400
}
 
401
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
402
fdivert() {
 
403
 
 
404
    local item
 
405
    for item in "$@"; do
 
406
        LC_ALL=C $ROOTCMD dpkg-divert --quiet --add --rename $item
 
407
    done
 
408
}
 
409
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
410
kernel_install() {
 
411
 
 
412
# Install the kernel package
 
413
if [ -f $KERNELPACKAGE ]; then
 
414
    # determine kernel version
 
415
    get_kernel_version $KERNELPACKAGE
 
416
 
 
417
    # create tftp boot images
 
418
    call_with_stamp install_kernel_nfsroot
 
419
 
 
420
    # setup for DHCP, BOOTP or both
 
421
    [ "x$FAI_BOOT" = "x" ] && FAI_BOOT="dhcp bootp"
 
422
    
 
423
    for bootopt in $FAI_BOOT; do
 
424
        case $bootopt in
 
425
                dhcp|DHCP)      
 
426
                        call_with_stamp setup_dhcp ;;
 
427
                bootp|BOOTP)      
 
428
                        call_with_stamp setup_bootp ;;
 
429
                *)
 
430
                        echo "Unknown boot option" ;;
 
431
        esac
 
432
    done
 
433
else
 
434
    merror="with errors"
 
435
    echo "Error. Kernel package $KERNELPACKAGE not found."
 
436
    echo "No install kernel installed in /boot/fai."
 
437
    echo "No kernel modules available in nfsroot."
 
438
fi
 
439
}
 
440
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
441
# main routine
 
442
 
 
443
[ -z "$KERNELPACKAGE" ] && die "\$KERNELPACKAGE is not set. Aborting."
 
444
 
 
445
# remove all kernels from nfsroot
 
446
[ -n "$kremove" ] && {
 
447
    echo "Removing all kernels from NFSROOT."
 
448
    rm -f $NFSROOT/boot/{System.map,vmlinuz,config}*
 
449
    rm -rf $NFSROOT/lib/modules/2.*
 
450
}
 
451
 
 
452
# just install a new kernel to the nfsroot
 
453
[ -n "$kinstall" ] && {
 
454
    trap "true" EXIT
 
455
    echo "Installing new kernel into the nfsroot."
 
456
    kernel_install
 
457
    echo "New kernel from" $KERNELPACKAGE "installed into the nfsroot."
 
458
    exit
 
459
}
 
460
 
 
461
echo Creating FAI nfsroot can take a long time and will
 
462
echo need more than $nfssize disk space in $NFSROOT.
 
463
 
 
464
# Kill the directory if not in recover mode
 
465
if [ -d $NFSROOT/$FAI -a ! "$recover" ]
 
466
then
 
467
    echo $NFSROOT already exists. Removing $NFSROOT
 
468
    umount $NFSROOT/dev/pts 1>/dev/null 2>&1 || true
 
469
    rm -rf $NFSROOT/.??* $NFSROOT/*
 
470
    # also remove files $NFSROOT/.? but not . and ..
 
471
    find $NFSROOT ! -type d -xdev -maxdepth 1 | xargs -r rm -f
 
472
fi
 
473
 
 
474
# Create a new nfsroot
 
475
if [ ! -x "`which debootstrap`" ]; then
 
476
    die "Can't find debootstrap command. Aborting."
 
477
fi
 
478
call_with_stamp create_nfsroot
 
479
 
 
480
kernel_install
 
481
 
 
482
umount_dirs
 
483
trap "true" EXIT
 
484
echo "make-fai-nfsroot finished $merror."
 
485
exit 0