delayedrun handling of USB warning message

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

delayedrun handling of USB warning message

Karl Godt
Administrator
This post was updated on .
The handling of the warning message is a bit too simple for me .

1) It only uses pmedia variable , but what if that bootparameter is missing ?
2) It does not test for PUPMODE 12 or 13 , when it would necessary .
3) placement under mouse could prevent it from popping up or user close it accidentally too early
4) timeout of 3 seconds are a bit short to read

So does it look for me at the moment ( made into a function ) :

_say_usb_warning(){
#v2.16 popup a warning if booting from usb flash...
#if [ "$PMEDIA" = "usbflash" ];then
case $PUPMODE in
12|13) :;;
*) return 0;;
esac

if test -f /proc/mounts; then
grep $Q -E ' /initrd/mnt/dev_ro2 | /initrd/mnt/dev_save ' /proc/mounts || return 0
fi

[ "$PDEV1" ] || return 0
BOOTP=`find /sys/class/block -name "$PDEV1"`
[ "$BOOTP" ] || return 0
if readlink "$BOOTP" | grep $Q usb; then
 /usr/lib/gtkdialog/box_splash -placement top -close never -fontsize large -bg yellow -timeout 6 -text "$(gettext 'WARNING! Do not unplug USB Flash drive!')" & #101009
fi
#fi
}
_say_usb_warning

Edit : Since PUPMODE 5 could boot with the 'pfix=ram,nocopy' parameter think have to change
case $PUPMODE in
5|12|13) :;;
*) return 0;;
esac
below greping for /initrd/mnt/dev_ro2 should handle PUPMODE 5 correctly .

Loading...