| File: meta/root.bin/files/init | |
|---|---|
| base-0 | patch-1 |
| Line 12 | Line 12 |
| # echo "Couldn't run a shell!" # fi | # echo "Couldn't run a shell!" # fi |
| args="$*" | # The default mounting location MEDIA=/mnt/media |
| export PATH=/bin:/mnt/initrd/bin echo echo "Mounting /proc." mkdir /proc mount -t proc none /proc | export PATH=/bin:/mnt/initrd/bin echo echo "Mounting /proc." mkdir /proc mount -t proc none /proc |
| echo "Trying to mount LNX media." mkdir -p /mnt/media | |
| echo "Unpacking modules." gunzip modules.tar.gz tar -xf modules.tar # if test -f usb-uhci.o; then insmod usb-uhci.o; fi # if test -f usb-ohci.o; then insmod usb-ohci.o; fi | unset RUNINRAM args while test ! -z "$1" ; do if test "$1" = "rir" || test "$1" = "runinram" || test "$1" = "toram" ; then RUNINRAM=yes MEDIA=/mnt/cd else args = "$args $1" fi shift 1 done |
| # wait for hotplug # sleep 3 | if test ${RUNINRAM} = "yes" ; then echo "Migrating image to ram" else echo "Running image off the media" fi |
| echo "Trying to mount LNX media." mkdir -p $MEDIA | |
| # /dev/cdroms/cdrom* are the CD-ROM devices | # /dev/cdroms/cdrom* are the CD-ROM devices |
| # /dev/scsi/host*/bus0/target0/lun0/part1 are (sometimes) USB storage devices | |
| # /dev/ubd0 is some UML thing | # /dev/ubd0 is some UML thing |
| set -- /dev/cdroms/cdrom* /dev/scsi/host*/bus0/target0/lun0/part1 /dev/ubd0 while test ! -z "$1" && test ! -f /mnt/media/singularity; do umount /mnt/media 2> /dev/null | set -- /dev/cdroms/cdrom* /dev/ubd0 while test ! -z "$1" && test ! -f $MEDIA/singularity; do umount $MEDIA 2> /dev/null |
| echo "Trying to mount $1" | echo "Trying to mount $1" |
| mount -o ro -t auto $1 /mnt/media 2> /dev/null | mount -o ro -t auto $1 $MEDIA 2> /dev/null |
| # goddammit why couldn't fat have had "long" filenames from the beginning | # goddammit why couldn't fat have had "long" filenames from the beginning |
| test -f /mnt/media/singul~1 && umount /mnt/media && mount -o ro -t vfat $1 /mnt/media | test -f $MEDIA/singul~1 && umount $MEDIA && mount -o ro -t vfat $1 $MEDIA |
| shift done | shift done |
| if test ! -f /mnt/media/singularity; then | if test ! -f $MEDIA/singularity; then |
| cat <<UHOH Sorry, but the LNX media could not be found. If you have removed the media or not yet inserted or attached it, please insert or attach it now and reboot. UHOH exec ash; exec sh fi | cat <<UHOH Sorry, but the LNX media could not be found. If you have removed the media or not yet inserted or attached it, please insert or attach it now and reboot. UHOH exec ash; exec sh fi |
| if test ${RUNINRAM} = "yes" ; then echo -e "\nPerforming move to ram" mkdir -p /mnt/media mount -n -t tmpfs none /mnt/media for target in singularity lnx.img cloop.o ; do echo " ... moving $target" cp $MEDIA/$target /mnt/media/$target done mkdir -p /mnt/media/mnt/cloop /mnt/media/mnt/initrd /mnt/media/dev echo " ... unmounting media" umount $MEDIA fi | |
| echo "Unmounting /proc." umount /proc echo "Trying to pivot_root the LNX media" | echo "Unmounting /proc." umount /proc echo "Trying to pivot_root the LNX media" |
| Line 80 | Line 102 |
| echo "Exec'ing singularity-init!" exec chroot . /sbin/singularity-init $args < dev/console > dev/console 2>&1 #end dave's mods | echo "Exec'ing singularity-init!" exec chroot . /sbin/singularity-init $args < dev/console > dev/console 2>&1 #end dave's mods |
| #echo "Exiting /linuxrc and proceeding to /sbin/init on the singularity" | |