Check-in [20181a4a05]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:20181a4a059783d903196a2fceb055117e6be4ac
Date: 2012-10-15 00:51:50
User: BarryK
Comment:rerwin: improve pup_event_backend_modprobe_protect and functions4puppy4, see forum t=76961&start=720

Tags And Properties
Changes

Changes to woof-code/rootfs-skeleton/etc/rc.d/functions4puppy4

@@ -6,20 +6,22 @@
 #110722 usb drive, LED light briefly flashes after unmounted, so wait a bit. 110828 remove.
 #120209 slight changes so that SSS mechanism can substitute translations. (see /usr/share/sss/script_strings)
 #120828 rerwin: record firmware installed in /etc/modules/firmware.dep.inst.${KERNVER}
 #120828 grep needs -E option, as expression is extended regular expression.
 #120831 rerwin: Obtain firmware from all-firmware directories as well as tarballs.
+#121004 rerwin: /etc/modules/firmware.dep.inst.${KERNVER} now has names of firmware tarballs, not modules.
 
 #101119 called from rc.sysinit...
 #global $MODULE is name of module, global $KERNVER.
 firmware_tarball_func() {
  MODULEx="`echo -n "$MODULE" | tr '_' '-'`"
- iPATTERN='^'"${MODULE}"'$|^'"${MODULEx}"'$'
- if [ "`grep -E "${iPATTERN}" /etc/modules/firmware.dep.inst.${KERNVER}`" = "" ];then #120828 extended-reg-expr
-  fPATTERN='[:,]'"${MODULE}"'\.ko|[:,]'"${MODULEx}"'\.ko'
-  FIRMPKG="`cat /etc/modules/firmware.dep.${KERNVER}  | grep -v '^#' | grep ':' | grep -E "$fPATTERN" | cut -f 1 -d ':' | head -n 1`"
-  if [ "$FIRMPKG" != "" ];then
+#121004 ...
+ fPATTERN='[:,]'"${MODULE}"'\.ko|[:,]'"${MODULEx}"'\.ko'
+ FIRMPKG="`cat /etc/modules/firmware.dep.${KERNVER}  | grep -v '^#' | grep ':' | grep -E "$fPATTERN" | cut -f 1 -d ':' | head -n 1`"
+ if [ "$FIRMPKG" != "" ];then
+  iPATTERN='^'"${FIRMPKG}"'$'
+  if [ "`grep "$iPATTERN" /etc/modules/firmware.dep.inst.${KERNVER}`" = "" ];then
    #120831 rerwin: ...
    FLAGFIRM='no'
    if [ -d /lib/modules/all-firmware/${FIRMPKG} ];then #support firmware directories.
     cp -a -f --remove-destination /lib/modules/all-firmware/${FIRMPKG}/* /
     FLAGFIRM='yes'

Changes to woof-code/rootfs-skeleton/sbin/pup_event_backend_modprobe_protect

@@ -1,15 +1,52 @@
 #!/bin/ash
 #101121 --modcheck=<module> call is in rerwin's firmware scripts.
+#121003 rerwin: rewritten to wait for loading delays & accept --modcheck wildcard (e.g., hsf*).
 
 PARAM1="$1"
 
+write_delay_log() {
+ echo "$(date +%H:%M:%S.%N | cut -c 1-12) ${$} $MODULE - $1" >> /tmp/pup_event_backend/delay.log
+}
+
 case $PARAM1 in
  --modcheck*)
-  MODULE="`echo "$PARAM1" | cut -f 2 -d '='`"
-  lsmod | grep "^${MODULE} " > /dev/null 2>&1
-  exit $?
+  MODULE="$(echo "$PARAM1" | cut -f 2 -d '=')"
+  if [ "$(echo $MODULE | grep '\*')" ];then
+   MODBASE="$(echo $MODULE | grep -o '^[^\*]*')"
+   MODULE="$(cat /tmp/pup_event_backend/protect1-* | grep -w -o -s "${MODBASE}[^ ]*" | tail -n 1)"
+   [ "${MODULE}" ] || exit 1
+  fi
+  lsmod | grep -q -s "^${MODULE} " && exit 0
+  [ "$(grep -s " ${MODULE} " /tmp/pup_event_backend/protect1-*)" = "" ] \
+   && [ "$(grep '^ADDLIST=' /etc/rc.d/MODULESCONFIG | grep " ${MODULE} ")" = "" ] \
+   && exit 1
+  write_delay_log "Began wait for loading"
+  FIRMWARE="$(grep -w "${MODULE}.ko" /etc/modules/firmware.dep.$(uname -r)| grep '^[^:]*')"
+  BRKCNT=0; STATUS=1; MODPATH=""
+  while [ $BRKCNT -lt 10 ];do
+   if [ "$FIRMWARE" ] && [ -f /pinstall.${FIRMWARE}.sh ];then
+    sleep 1
+   else #any pinstall completed
+    if [ "$MODPATH" = "" ];then
+     MODPATH="$(find /lib/modules/$(uname -r)/ -maxdepth 6 -type f -name ${MODULE}.ko)"
+     if [ "$MODPATH" = "" ];then
+      write_delay_log "Not installed"
+      STATUS=2; break
+     fi
+    else #module installed
+     sleep 1
+     if lsmod | grep -q -s "^${MODULE} ";then
+      write_delay_log "Ended wait for loading"
+      STATUS=0; break
+     fi
+    fi
+   fi
+   BRKCNT=$(($BRKCNT + 1))
+  done
+  [ $STATUS -eq 1 ] && write_delay_log "Wait for loading exceeded timeout limit"
+  exit $STATUS
  ;;
 esac
 
 exit 0
 ###END###