X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=etc%2Finit.d%2Fgrml-reboot;h=7e2bf0e277681094625495de264e6e5ec447cc6e;hb=1e5a53133d1a28f21eaf9cdc3c940a6db6c46877;hp=81ab23aebaba47a7b2eb9cb0200e278251f96b98;hpb=a216e231483af45806a84360a4d7bfa97efb28e6;p=grml-etc.git diff --git a/etc/init.d/grml-reboot b/etc/init.d/grml-reboot index 81ab23a..7e2bf0e 100755 --- a/etc/init.d/grml-reboot +++ b/etc/init.d/grml-reboot @@ -5,6 +5,13 @@ # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. ################################################################################ +### BEGIN INIT INFO +# Provides: grml-reboot +# Required-Start: +# Required-Stop: +# Default-Start: +# Default-Stop: +### END INIT INFO export PATH=/sbin:/bin:/usr/bin:/usr/sbin @@ -36,14 +43,13 @@ grep -qe 'toram' -qe '2ram' -qe 'usb' -qe 'serial' \ # detect cdrom device if ! $INSTALLED ; then - # new live-initramfs layout: - if [ -d /live/image ] ; then - CDROM="$(awk '/ \/live\/image /{print $1;exit 0;}' /proc/mounts)" - MOUNTPATH="/live/image" - else # old unionfs layout: - CDROM="$(awk '/ \/cdrom /{print $1;exit 0;}' /proc/mounts)" - MOUNTPATH="/cdrom" - fi + if [ -d /run/live/medium ] ; then # live-boot layout since Dec 2018 + CDROM="$(awk '/ \/run\/live\/medium /{print $1;exit 0;}' /proc/mounts)" + MOUNTPATH="/run/live/medium" + elif [ -d /lib/live/mount/medium ] ; then # live-boot layout between 2012 and Dec 2018 + CDROM="$(awk '/ \/lib\/live\/mount\/medium /{print $1;exit 0;}' /proc/mounts)" + MOUNTPATH="/lib/live/mount/medium" + fi # try to remove only removable devices DEVICE="" @@ -79,8 +85,8 @@ case "$0" in esac mysleep() { - for i in $(seq 1 40) ; do - usleep 75000 + for i in $(seq 1 30) ; do + sleep 0.1 echo -n "$1.${NORMAL}" done echo "" @@ -149,6 +155,13 @@ esac [ -r /etc/noprompt ] && NOPROMPT=true [ -r /etc/noeject ] && NOPROMPT=true && NOEJECT=true +VIRT_WHAT=$(/usr/sbin/virt-what 2>/dev/null) +if [ -n "$VIRT_WHAT" ] ; then + log_begin_msg "System seems to be a virtual machine, assuming noprompt as default." + NOPROMPT=true + log_end_msg 0 +fi + # Turn on autoeject of CD-ROMs if $NOEJECT ; then for dev in /proc/sys/dev/cdrom*/lock; do [ -f "$dev" ] && echo 0 > "$dev"; done @@ -196,7 +209,7 @@ $INSTALLED && mount -n -o remount,ro / 2>/dev/null # Prompt for removal of live system device if ! $INSTALLED && ! $NOPROMPT ; then # do not prompt for removal when running in grml2ram mode: - if ! mount | grep -qe 'on /cdrom' -qe 'on /live/image' ; then + if ! mount | grep -qe 'on /run/live/medium' -qe 'on /lib/live/mount/medium' ; then echo "Live System not mounted, nothing to eject therefore." else [ -d "$MOUNTPATH" ] && umount -l "$MOUNTPATH"