Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

eject static binary and support

  • Loading branch information...
commit 022a985b6e5a9d62ea4d0e1b9e77257124bd1f73 1 parent a8297a2
Tomas-M authored

Showing 3 changed files with 23 additions and 8 deletions. Show diff stats Hide diff stats

  1. +2 2 TODO
  2. +20 6 initramfs/cleanup
  3. +1 0  initramfs/static/update
4 TODO
... ... @@ -1,4 +1,4 @@
1 1 * copy DOC/* to Live Kit created
2 2 * describe meaning of special files in bundles
3   -
4   -* bootinst.sh - if extlinux is not found, echo error msg.
  3 +* support from=slax.iso
  4 +* noatime mount option for aufs?
26 initramfs/cleanup
@@ -78,19 +78,32 @@ if [ "$1" = "--init" ]; then
78 78
79 79 # then free up loop mounts, backwards
80 80 tac /proc/mounts | grep loop | cut -d " " -f 2 | while read LINE; do
81   - umount $LINE >/dev/console 2>&1
  81 + umount $LINE >/dev/console 2>&1 || \
82 82 umount -l $LINE
83 83 done
84 84
85   - # and free up memory mounts, backwards
  85 + # remember from which device we are started, do it now before we lose it
  86 + DEVICE="$(cat /proc/mounts | grep /memory/data | grep /dev/ | cut -d " " -f 1)"
  87 +
  88 + # free up memory mounts, backwards
86 89 tac /proc/mounts | grep memory | cut -d " " -f 2 | while read LINE; do
87 90 umount $LINE >/dev/console 2>&1
88   - umount -l $LINE
  91 + if [ $? -ne 0 ]; then
  92 + mount -o remount,ro $LINE >/dev/console 2>&1
  93 + umount -l $LINE
  94 + fi
89 95 done
90 96
91   - # make sure the data directory is at least remounted read-only,
92   - # if the previous unmount failed due to some busy err
93   - mount -o remount,ro /memory/data >/dev/console 2>/dev/null
  97 + # eject cdrom device if we were running from it
  98 + for i in $(cat /proc/sys/dev/cdrom/info | grep name); do
  99 + if [ "$DEVICE" = "/dev/$i" ]; then
  100 + echo "Attemptiong to eject /dev/$i..." >/dev/console
  101 + eject /dev/$i
  102 + echo "CD/DVD tray will close in 6 seconds..." >/dev/console
  103 + sleep 6
  104 + eject -t /dev/$i
  105 + fi
  106 + done
94 107
95 108 # and finally, last chance to run some commands by hand
96 109 if grep -q debug /proc/cmdline; then
@@ -98,6 +111,7 @@ if [ "$1" = "--init" ]; then
98 111 setsid sh -c 'exec sh < /dev/tty1 >/dev/tty1 2>&1'
99 112 fi
100 113
  114 + cat /lib/command >/dev/console
101 115 $(cat /lib/command 2>/dev/null)
102 116 reboot -f
103 117 fi
1  initramfs/static/update
@@ -26,3 +26,4 @@ fi
26 26 ln -f busybox-$MYARCH ./busybox
27 27 ln -f mount.ntfs-3g-$MYARCH ./mount.ntfs-3g
28 28 ln -f mount.dynfilefs-$MYARCH ./mount.dynfilefs
  29 +ln -f eject-$MYARCH ./eject

0 comments on commit 022a985

Please sign in to comment.
Something went wrong with that request. Please try again.