5 # Copyright 2005 Red Hat, Inc.
7 # Written by Erik Troan <ewt@redhat.com>
10 # Elliot Lee <sopwith@cuc.edu>
11 # Miguel de Icaza <miguel@nuclecu.unam.mx>
12 # Christian 'Dr. Disk' Hechelmann <drdisk@ds9.au.s.shuttle.de>
13 # Michael K. Johnson <johnsonm@redhat.com>
14 # Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>
15 # Jakub Jelinek <jakub@redhat.com>
16 # Carlo Arenas Belon (carenas@chasqui.lared.net.pe>
17 # Keith Owens <kaos@ocs.com.au>
18 # Bernhard Rosenkraenzer <bero@redhat.com>
19 # Matt Wilson <msw@redhat.com>
20 # Trond Eivind Glomsrød <teg@redhat.com>
21 # Jeremy Katz <katzj@redhat.com>
22 # Preston Brown <pbrown@redhat.com>
23 # Bill Nottingham <notting@redhat.com>
24 # Guillaume Cottenceau <gc@mandrakesoft.com>
25 # Peter Jones <pjones@redhat.com>
29 PATH
=/sbin
:/usr
/sbin
:/bin
:/usr
/bin
:$PATH
46 modulefile
=/etc
/modules.conf
50 PRESCSIMODS
="scsi_mod sd_mod unknown"
53 if [ -f /etc
/udev
/udev.conf
]; then
58 [ -x /sbin
/udev.static
] || USE_UDEV
=
62 echo "usage: `basename $0` [--version] [-v] [-f] [--preload <module>]" >&2
63 echo " [--omit-scsi-modules] [--omit-raid-modules] [--omit-lvm-modules]" >&2
64 echo " [--with=<module>] [--image-version] [--fstab=<fstab>] [--nocompress]" >&2
65 echo " [--builtin=<module>] [--nopivot] [--nosquashfs] <initrd-image> <kernel-version>" >&2
67 echo " (ex: `basename $0` /boot/initrd-2.2.5-15.img 2.2.5-15)" >&2
72 if [ ! -f "/lib/modules/$kernel/modules.dep" ]; then
73 echo "No dep file found for kernel $kernel" >&2
77 [ -n "$verbose" ] && echo -n "Looking for deps of module $1"
78 deps
=$
(gawk
'BEGIN { searched=ARGV[2]; ARGV[2]=""; rc=1 } \
79 function modname(filename) { match(filename, /\/([^\/]+)\.k?o:?$/, ret); return ret[1] } \
80 function show() { if (orig == searched) { print dep; orig=""; rc=0; exit } } \
82 orig=modname($1); dep=""; \
83 if ($2) { for (i = 2; i <= NF; i++) { dep=sprintf("%s %s", dep, modname($i)); } } } \
84 /^ / { dep=sprintf("%s %s", dep, modname($1)); } \
85 END { show(); exit(rc) }' /lib
/modules
/$kernel/modules.dep
$1)
86 [ -n "$verbose" ] && echo -e "\t$deps"
92 if [ $1 == "--skiperrors" ]; then
93 skiperrors
=--skiperrors
99 if [ "$modName" = "off" -o "$modName" = "null" ]; then
103 if [ $
(echo $modName | cut
-b1) = "-" ]; then
104 skiperrors
=--skiperrors
105 modName
=$
(echo $modName | cut
-b2-)
108 if echo $builtins |
egrep -q '(^| )'$modName'( |$)' ; then
109 [ -n "$verbose" ] && echo "module $modName assumed to be built in"
115 if [ "$modName" = "i2o_block" ]; then
119 elif [ "$modName" = "ppa" ]; then
121 findmodule parport_pc
123 elif [ "$modName" = "sbp2" ]; then
134 for modExt
in o.gz o ko
; do
135 if [ -d /lib
/modules
/$kernel/updates
]; then
136 fmPath
=`(cd /lib/modules/$kernel/updates; echo find . -name $modName.$modExt -type f | /sbin/nash --quiet) | gawk {'print $1; exit;'}`
139 if [ -f /lib
/modules
/$kernel/updates
/$fmPath ]; then
140 fmPath
=updates
/$fmPath
144 fmPath
=`(cd /lib/modules/$kernel; echo find . -name $modName.$modExt -type f | /sbin/nash --quiet) | gawk {'print $1; exit;'}`
145 if [ -f /lib
/modules
/$kernel/$fmPath ]; then
150 if [ ! -f /lib
/modules
/$kernel/$fmPath ]; then
151 if [ -n "$skiperrors" ]; then
155 # ignore the absence of the scsi modules
156 for n
in $PRESCSIMODS; do
157 if [ "$n" = "$modName" ]; then
162 if [ -n "$allowmissing" ]; then
163 echo "WARNING: No module $modName found for kernel $kernel, continuing anyway" >&2
167 echo "No module $modName found for kernel $kernel, aborting." >&2
171 # only need to add each module once
172 if ! echo $MODULES |
grep -q "$fmPath" 2>/dev
/null
; then
173 MODULES
="$MODULES $fmPath"
178 if [ "$#" != "2" ];then
179 echo "usage: inst <file> <destination>"
182 [ -n "$verbose" ] && echo "$1 -> $2"
186 while [ $# -gt 0 ]; do
189 if echo $1 |
grep -q '=' ; then
190 fstab
=`echo $1 | sed 's/^--fstab=//'`
202 if echo $1 |
grep -q '=' ; then
203 modname
=`echo $1 | sed 's/^--with=//'`
209 basicmodules
="$basicmodules $modname"
213 if echo $1 |
grep -q '=' ; then
214 modname
=`echo $1 | sed 's/^--builtin=//'`
219 builtins
="$builtins $modname"
223 echo "mkinitrd: version $VERSION"
251 if echo $1 |
grep -q '=' ; then
252 modname
=`echo $1 | sed 's/^--preload=//'`
257 PREMODS
="$PREMODS $modname"
279 if [ -z "$target" ]; then
281 elif [ -z "$kernel" ]; then
292 if [ -z "$target" -o -z "$kernel" ]; then
296 if [ -n "$img_vers" ]; then
297 target
="$target-$kernel"
300 if [ -z "$force" -a -f $target ]; then
301 echo "$target already exists." >&2
305 if [ ! -d /lib
/modules
/$kernel ]; then
306 echo "/lib/modules/$kernel is not a directory." >&2
310 if [ $UID != 0 ]; then
311 echo "mkinitrd must be run as root"
315 kernelmajor
=`echo $kernel | cut -d . -f 1,2`
317 #if [ "$kernelmajor" == "2.4" ]; then
318 if [ -n "$verbose" ]; then echo "Creating old-style initrd"; fi
321 # if [ -n "$verbose" ]; then echo "Creating initramfs"; fi
322 # modulefile=/etc/modprobe.conf
327 # if we're not using udev, don't set any of the other bits
328 [ -z "$USE_UDEV" ] && UDEV_TMPFS
= && UDEV_KEEP_DEV
=
330 # find a temporary directory which doesn't use tmpfs
332 for t
in /tmp
/var
/tmp
/root
${PWD}; do
333 if [ ! -d $t ]; then continue; fi
334 if ! echo access
-w $t |
/sbin
/nash
--quiet; then continue; fi
336 fs
=$
(df
-T $t 2>/dev
/null | gawk
'{line=$1;} END {printf $2;}')
337 if [ "$fs" != "tmpfs" ]; then
343 if [ -z "$TMPDIR" ]; then
344 echo "no temporary directory could be found" >&2
348 if [ $TMPDIR = "/root" -o $TMPDIR = "${PWD}" ]; then
349 echo "WARNING: using $TMPDIR for temporary files" >&2
352 for n
in $PREMODS; do
357 if [ -n "$withusb" ]; then
358 # If / or /boot is on a USB device include the driver. With root by
359 # label we could still get some odd behaviors
360 for fs
in / /boot
; do
361 esc
=$
(echo $fs |
sed 's,/,\\/,g')
362 dev
=$
(mount | gawk
"/ on ${esc} / { print \$1 }" |
sed 's/[0-9]*$//' | cut
-d/ -f3)
363 if [ "$(echo $dev | cut -c1-2)" = sd
]; then
364 if [ `which kudzu 2>/dev/null` ]; then
365 host=$
(kudzu
--probe -b scsi |
366 gawk
'/^device: '${dev}'/,/^host:/ { if (/^host/) { print $2; exit; } }')
367 if [ -d /proc
/scsi
/usb-storage-
${host} -o -f /proc
/scsi
/usb-storage
/${host} ]; then
375 if [ -n "$needusb" ]; then
376 drivers
=$
(gawk
'/^alias[[:space:]]+usb-controller[0-9]* / { print $3}' < $modulefile)
377 if [ -n "$drivers" ]; then
378 for driver
in $drivers; do
383 findmodule usb-storage
387 if [ -z "$noscsi" ]; then
388 if [ ! -f $modulefile ]; then
389 modulefile
=/etc
/conf.modules
392 if [ -f $modulefile ]; then
393 scsimodules
=`grep "alias[[:space:]]\+scsi_hostadapter" $modulefile | grep -v '^[ ]*#' | LC_ALL=C sort -u | gawk '{ print $3 }'`
395 if [ -n "$scsimodules" ]; then
396 for n
in $PRESCSIMODS; do
400 for n
in $scsimodules; do
401 # for now allow scsi modules to come from anywhere. There are some
402 # RAID controllers with drivers in block/
409 # If we have ide devices and module ide, do the right thing
411 if [ -n "$ide" ]; then
415 # If we use LVM, include lvm-mod
416 if [ -z "$nolvm" ]; then
417 if [ -f /proc
/lvm
/global
]; then
418 if grep -q '^VG:' /proc
/lvm
/global
; then
419 if [ "$kernelmajor" == "2.4" ]; then
427 if [ -x /sbin
/dmsetup
-a -e /dev
/mapper
/control
]; then
428 dmout
=$
(/sbin
/dmsetup
ls 2>/dev
/null
)
429 if [ "$dmout" != "No devices found" -a "$dmout" != "" ]; then
435 # If we have dasd devices, include the necessary modules (S/390)
436 if [ -d /proc
/dasd
]; then
438 findmodule
-dasd_eckd_mod
439 findmodule
-dasd_fba_mod
442 if [ -z "$noraid" -a -f /proc
/mdstat
]; then
443 # load appropriate raid devices if necessary -- we'll load whatever
444 # /proc/mdstat suggests
446 # note that the gawk below contains a space and a tab
447 for level
in $
(gawk
'/^md[0-9][0-9]*[ ]*:/ { print $4 }' \
448 /proc
/mdstat |
sort -u); do
463 echo "raid level $level (in /proc/mdstat) not recognized" >&2
468 if [ -n "$startraid" ]; then
469 raiddevices
=$
(gawk
'/^md[0-9][0-9]*[ ]*:/ { print $1 }' \
474 # check to see if we need to set up a loopback filesystem
475 rootdev
=$
(gawk
'/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $fstab)
476 if echo $rootdev | cut
-d/ -f3 |
grep -q loop
; then
477 key
="^# $(echo $rootdev | cut -d/ -f3 | tr '[a-z]' '[A-Z]'):"
478 if ! grep "$key" $fstab >> /dev
/null
; then
479 echo "The root filesystem is on a $rootdev, but there is no magic entry in $fstab" >&2
480 echo "for this device. Consult the mkinitrd man page for more information" >&2
484 line
=$
(grep "$key" $fstab)
485 loopDev
=$
(echo $line | gawk
'{print $3}')
486 loopFs
=$
(echo $line | gawk
'{print $4}')
487 loopFile
=$
(echo $line | gawk
'{print $5}')
489 basicmodules
="$basicmodules -loop"
490 if [ "$loopFs" = "vfat" -o "$loopFs" = "msdos" ]; then
491 basicmodules
="$basicmodules -fat"
493 basicmodules
="$basicmodules -${loopFs}"
494 # check if the root fs is on a logical volume
495 elif ! echo $rootdev | cut
-c1-6 |
grep -q "LABEL=" ; then
496 root_vg
=$
(echo $rootdev | cut
-d/ -f3)
497 rootdev
=$
(echo "readlink $rootdev" |
/sbin
/nash
--quiet)
498 major
=`ls -l $rootdev | sed -e "s/.* \\([0-9]\+\\), *[0-9]\+.*/\\1/"`
499 [ "$major" != "58" ] || root_lvm
=1
500 if echo $rootdev |
grep -q /dev
/mapper
2>/dev
/null
; then root_lvm
=1 ; fi
503 rootfs
=$
(gawk
'{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab)
504 rootopts
=$
(gawk
'{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' $fstab \
505 |
sed -e 's/\(^rw,\|rw,$\)//' -e 's/,rw,/,/' -e 's/^rw$/ro/')
507 # in case the root filesystem is modular
508 findmodule
-${rootfs}
510 if [ -n "$root_lvm" ]; then
511 if [ "$kernelmajor" == "2.4" ]; then
515 # DM requires all of these to be there in case someone used the
516 # feature. broken. (#132001)
517 findmodule
-dm-mirror
519 findmodule
-dm-snapshot
523 for n
in $basicmodules; do
527 if [ -n "$verbose" ]; then
528 echo "Using modules: $MODULES"
532 MNTIMAGE
=`mktemp -d ${TMPDIR}/initrd.XXXXXX`
533 IMAGE
=`mktemp ${TMPDIR}/initrd.img.XXXXXX`
534 if [ -z "$initramfs" ]; then
535 MNTPOINT
=`mktemp -d ${TMPDIR}/initrd.mnt.XXXXXX`
536 RCFILE
=$MNTIMAGE/linuxrc
538 RCFILE
=$MNTIMAGE/init
541 if [ -z "$MNTIMAGE" -o -z "$IMAGE" ]; then
542 echo "Error creating temporaries. Try again" >&2
546 if [ -z "$initramfs" ]; then
547 dd if=/dev
/zero of
=$IMAGE bs
=1k count
=$IMAGESIZE 2> /dev
/null ||
exit 1
549 LODEV
=$
(echo findlodev |
/sbin
/nash
--quiet)
551 if [ -z "$LODEV" ]; then
552 rm -rf $MNTIMAGE $MNTPOINT $IMAGE
553 echo "All of your loopback devices are in use." >&2
557 losetup
${LODEV} $IMAGE ||
exit 1
559 # We have to "echo y |" so that it doesn't complain about $IMAGE not
560 # being a block device
561 echo y | mkfs.minix
-i 100 $LODEV $IMAGESIZE >/dev
/null
2>/dev
/null
563 if [ -n "$verbose" ]; then
564 echo "Using loopback device $LODEV"
568 mount
-t minix
$LODEV $MNTPOINT ||
{
569 echo "Can't get a loopback device"
573 # We don't need this directory, so let's save space
574 rmdir $MNTPOINT/lost
+found
>/dev
/null
2>&1
578 mkdir
-p $MNTIMAGE/lib
579 mkdir
-p $MNTIMAGE/bin
580 mkdir
-p $MNTIMAGE/etc
581 mkdir
-p $MNTIMAGE/dev
582 mkdir
-p $MNTIMAGE/hd
583 mkdir
-p $MNTIMAGE/loopfs
584 mkdir
-p $MNTIMAGE/proc
585 mkdir
-p $MNTIMAGE/sys
586 mkdir
-p $MNTIMAGE/sysroot
587 ln -s bin
$MNTIMAGE/sbin
589 inst
/sbin
/nash
"$MNTIMAGE/bin/nash"
590 inst
/sbin
/insmod.static
"$MNTIMAGE/bin/insmod"
591 inst
/bin
/tar.static
"$MNTIMAGE/bin/tar"
592 inst
/usr
/bin
/lzmadec
"$MNTIMAGE/bin/lzmadec"
593 inst
/sbin
/fsck.minix.static
"$MNTIMAGE/bin/fsck.minix"
594 ln -s /sbin
/nash
$MNTIMAGE/sbin
/modprobe
596 if [ -n "$USE_UDEV" ]; then
597 inst
/sbin
/udev.static
$MNTIMAGE/sbin
/udev
598 inst
/sbin
/udevstart.static
$MNTIMAGE/sbin
/udevstart
599 mkdir
-p $MNTIMAGE/etc
/udev
600 inst
/etc
/udev
/udev.conf
$MNTIMAGE/etc
/udev
/udev.conf
601 ln -s /sbin
/nash
$MNTIMAGE/sbin
/hotplug
604 for MODULE
in $MODULES; do
605 if [ -x /usr
/bin
/strip
]; then
606 /usr
/bin
/strip
-g $verbose /lib
/modules
/$kernel/$MODULE -o $MNTIMAGE/lib
/$
(basename $MODULE)
608 cp $verbose -a /lib
/modules
/$kernel/$MODULE $MNTIMAGE/lib
612 # mknod'ing the devices instead of copying them works both with and
614 mknod
$MNTIMAGE/dev
/console c
5 1
615 mknod
$MNTIMAGE/dev
/null c
1 3
616 mknod
$MNTIMAGE/dev
/ram b
1 1
617 mknod
$MNTIMAGE/dev
/systty c
4 0
619 mknod
$MNTIMAGE/dev
/tty
$i c
4 $i
622 # FIXME -- this won't work if you're using devfs
623 if [ -n "$root_lvm" -a "$kernelmajor" == "2.4" ]; then
624 pvs
=$
(/sbin
/pvscan |
grep " PV " | gawk
{'print $5;'} |
sed 's/"//g')
626 cp $verbose --parents -a $pv $MNTIMAGE/
629 inst
/sbin
/vgwrapper
"$MNTIMAGE/bin/vgwrapper"
630 ln "$MNTIMAGE/bin/vgwrapper" "$MNTIMAGE/bin/vgscan"
631 ln "$MNTIMAGE/bin/vgwrapper" "$MNTIMAGE/bin/vgchange"
633 mknod
$MNTIMAGE/dev
/lvm b
109 0
636 if [ -n "$root_lvm" -a "$kernelmajor" == "2.6" ]; then
637 inst
/sbin
/lvm.static
"$MNTIMAGE/bin/lvm"
638 if [ -f /etc
/lvm
/lvm.conf
]; then
639 cp $verbose --parents /etc
/lvm
/lvm.conf
$MNTIMAGE/
643 echo "#!/bin/nash" >|
$RCFILE
646 echo "mount -t proc /proc /proc" >> $RCFILE
647 echo "setquiet" >> $RCFILE
648 echo "echo Mounted /proc filesystem" >> $RCFILE
650 if [ "$kernelmajor" != "2.4" ]; then
651 echo "echo Mounting sysfs" >> $RCFILE
652 echo "mount -t sysfs /sys /sys" >> $RCFILE
655 if [ -n "$USE_UDEV" ]; then
656 if [ -n "$UDEV_TMPFS" ]; then
659 mount -o mode=0755 -t tmpfs /dev /dev
660 mknod /dev/console c 5 1
661 mknod /dev/null c 1 3
662 mknod /dev/zero c 1 5
670 echo -n "/sbin/hotplug" > /proc/sys/kernel/hotplug
674 for MODULE
in $MODULES; do
676 module
=`echo $MODULE | sed "s|.*/||" | sed "s/.k\?o$//"`
677 fullmodule
=`echo $MODULE | sed "s|.*/||"`
679 options
=`sed -n -e "s/^options[ ][ ]*$module[ ][ ]*//p" $modulefile 2>/dev/null`
681 if [ -n "$verbose" ]; then
682 if [ -n "$options" ]; then
683 text
=" with options $options"
685 echo "Loading module $module$text"
687 echo "echo \"Loading $fullmodule module\"" >> $RCFILE
688 echo "insmod /lib/$fullmodule $options" >> $RCFILE
690 # Hack - we need a delay after loading usb-storage to give things
691 # time to settle down before we start looking a block devices
692 if [ "$module" = "usb-storage" ]; then
693 echo "sleep 8" >> $RCFILE
695 if [ "$module" = "zfcp" -a -f /etc
/zfcp.conf
]; then
696 echo "sleep 2" >> $RCFILE
697 cat /etc
/zfcp.conf |
grep -v "^#" |
tr "A-Z" "a-z" |
while read DEVICE SCSIID WWPN SCSILUN FCPLUN
; do
698 echo "echo -n $WWPN > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/port_add" >>$RCFILE
699 echo "echo -n $FCPLUN > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/$WWPN/unit_add" >>$RCFILE
700 echo "echo -n 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE/0x/}/online" >>$RCFILE
705 # HACK: module loading + device creation isn't necessarily synchronous...
706 # this will make sure that we have all of our devices before trying
707 # things like RAID or LVM
708 if [ -n "$USE_UDEV" ]; then
709 echo "/sbin/udevstart" >> $RCFILE
712 echo "sleep 2" >> $RCFILE
714 if [ -n "$startraid" ]; then
715 for dev
in $raiddevices; do
716 cp -a /dev
/${dev} $MNTIMAGE/dev
717 echo "raidautorun /dev/${dev}" >> $RCFILE
721 if [ -z "$USE_UDEV" ]; then
722 echo "echo Creating block devices" >> $RCFILE
723 echo "mkdevices /dev" >> $RCFILE
726 echo "mknod /dev/loop0 b 7 0" >> $RCFILE
728 if [ -n "$loopDev" ]; then
730 cp -a $loopDev $MNTIMAGE/dev
731 cp -a $rootdev $MNTIMAGE/dev
732 echo "echo Mounting device containing loopback root filesystem" >> $RCFILE
733 echo "mount -t $loopFs $loopDev /loopfs" >> $RCFILE
734 echo "echo Setting up loopback device $rootdev" >> $RCFILE
735 echo "losetup $rootdev /loopfs$loopFile" >> $RCFILE
736 elif [ -n "$root_lvm" ]; then
737 if [ "$kernelmajor" == "2.4" ]; then
738 echo "echo Scanning logical volumes" >> $RCFILE
739 echo "vgscan" >> $RCFILE
740 echo "echo Activating logical volumes" >> $RCFILE
741 echo "vgchange -ay" >> $RCFILE
743 echo "echo Making device-mapper control node" >> $RCFILE
744 echo "mkdmnod" >> $RCFILE
745 echo "echo Scanning logical volumes" >> $RCFILE
746 echo "lvm vgscan --ignorelockingfailure" >> $RCFILE
747 echo "echo Activating logical volumes" >> $RCFILE
748 echo "lvm vgchange -ay --ignorelockingfailure $root_vg" >> $RCFILE
752 echo "echo Creating root device" >> $RCFILE
753 echo "mkrootdev /dev/root" >> $RCFILE
756 if [ -n "$initramfs" ]; then
757 echo "echo Mounting root filesystem" >> $RCFILE
758 if [ -n "$squashfs" ]; then
759 echo "mount -o $rootopts --ro -t $rootfs $rootdev /sysroot" >> $RCFILE
761 echo "fsck.minix $rootdev" >> $RCFILE
762 echo "mount -o $rootopts -t minix $rootdev /hd" >> $RCFILE
763 echo "losetup /dev/loop0 /hd/ipcop-1.5.0a1.squashfs" >> $RCFILE
764 echo "mount --ro -t squashfs /dev/loop0 /sysroot" >> $RCFILE
765 echo "mount -t tmpfs none /sysroot/var" >> $RCFILE
766 echo "echo Unpacking IPCop configuration.. Please wait.." >> $RCFILE
767 echo "tar -C /sysroot -xjf /hd/ipcop.tbz2" >> $RCFILE
770 echo "echo Switching to new root" >> $RCFILE
771 if [ -n "$UDEV_KEEP_DEV" ]; then
772 echo "switchroot --movedev /sysroot" >> $RCFILE
774 echo "switchroot /sysroot" >> $RCFILE
777 if [ "$kernelmajor" != "2.4" ]; then
778 echo "umount /sys" >> $RCFILE
781 if [ -n "$pivot" ]; then
782 echo "echo 0x0100 > /proc/sys/kernel/real-root-dev" >> $RCFILE
784 echo "echo Mounting root filesystem" >> $RCFILE
785 if [ -n "$squashfs" ]; then
786 echo "mount -o $rootopts --ro -t $rootfs $rootdev /sysroot" >> $RCFILE
788 echo "fsck.minix $rootdev" >> $RCFILE
789 echo "mount -o $rootopts -t minix $rootdev /hd" >> $RCFILE
790 echo "losetup /dev/loop0 /hd/ipcop-1.5.0a1.squashfs" >> $RCFILE
791 echo "mount --ro -t squashfs /dev/loop0 /sysroot" >> $RCFILE
792 echo "mount -t tmpfs none /sysroot/var" >> $RCFILE
793 echo "echo Unpacking IPCop configuration.. Please wait.." >> $RCFILE
794 echo "tar -C /sysroot -xjf /hd/ipcop.tbz2" >> $RCFILE
797 echo "pivot_root /sysroot /sysroot/initrd" >> $RCFILE
798 echo "umount /initrd/proc" >> $RCFILE
800 echo "umount /proc" >> $RCFILE
803 [ -n "$UDEV_TMPFS" ] && echo "umount /initrd/dev" >> $RCFILE
807 if [ -z "$initramfs" ]; then
808 (cd $MNTIMAGE; tar cf
- .
) |
(cd $MNTPOINT; tar xf
-) ||
exit 1
813 (cd $MNTIMAGE; find . |
cpio --quiet -c -o) >|
$IMAGE ||
exit 1
816 if [ -n "$compress" ]; then
817 gzip -9 < $IMAGE >|
$target || rc
=1
819 cp -a $IMAGE $target || rc
=1
821 rm -rf $MNTIMAGE $IMAGE
822 if [ -n "$MNTPOINT" ]; then rm -rf $MNTPOINT ; fi