s243a

SHARE TWEET init usbwait patch s243a (tahrpup6.0.6 - initrd

Jan 28th, 2018
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- /mnt/home/clean2/initrd-expanded/init   2017-02-16 05:03:46.000000000 +0800
  2. +++ ./initrd-expanded/init  2018-01-28 00:59:20.000000000 +0800
  3. @@ -91,7 +91,27 @@
  4.  #=============================================================
  5.  #                        FUNCTIONS
  6.  #=============================================================
  7. -
  8. +function wait_for_usb_part(){
  9. +  echo "entering wait_for_usb_part() " #s243a remove
  10. +  xIFS=$IFS
  11. +  IFS=' ' #This should be the default but just to be double certain
  12. +  [ -e /tmp/flag-usb-ready ] || wait_for_usb #Call wait_for_usb if it hasn't been called yet.
  13. +  for i in $(seq 1 $USB_TRIES); do
  14. +     echo "i=$1 < $USB_TRIES" #s243a remove    
  15. +     BLKIDOUT='' #not sure if this is necessary but it will force blkid to be called again.
  16. +     decode_id $1 #Convert uuid's to partition name
  17. +     part_name="$ONE_PART" #this is the result (i.e. the partiation name) returned from decode_id.
  18. +     echo "part_name=$part_name"
  19. +     if [ $part_name ]; then
  20. +       for p in cat /tmp/flag-usb-ready; do #flag-usb-ready conatins the name of all the partitions which are ready for use
  21. +         [ $p != $part_name ] || break 2
  22. +       done;
  23. +     fi
  24. +     rm /tmp/flag-usb-ready #we got to clear this flag or wait_for_usb won't do anything.
  25. +     wait_for_usb    
  26. +  done
  27. +  IFS=$xIFS
  28. +}
  29.  fsck_func() {
  30.  # "$1" - partition device - ex: /dev/sdb2
  31.  # "$2" - fstype - ex: ext2
  32. @@ -858,6 +878,13 @@
  33.  PDEBUG=1
  34.  TOTAL_SIZEK_SFS_RAM=0
  35.  
  36. +#Specifies how long to wait for the USB drive
  37. +[ $waitdev ] && WAITDEV=$waitdev #added by s243a
  38. + export WAITDEV="${WAITDEV:-3}"
  39. +#Specifies how how many times to try finding all USB drives
  40. +[ $USBTRIES ] && USBTRIES=$usb_tries
  41. +USBTRIES="${USBTRIES:-3}"
  42. +
  43.  # show menu with pupsaves
  44.  [ $psavemenu ] && PSAVEMENU=$psavemenu
  45.  
  46. @@ -927,13 +954,14 @@
  47.  #establish PDRV
  48.  P_PART=""; LOOK_PUP=""; LOOK_SAVE=""
  49.  if [ "$P_BP_ID" ];then #specified as parameter
  50. - decode_id "$P_BP_ID"
  51. + wait_for_usb_part  "$P_BP_ID"
  52. + #decode_id "$P_BP_ID"
  53.   [ "$ONE_PART" ] && { P_PART="$ONE_PART"; P_BP_ID=""; }
  54.   if [ "$P_PART"  = "" ];then
  55. -  wait_for_usb
  56. -  decode_id "$P_BP_ID"
  57. +   wait_for_usb_part  "$P_BP_ID"
  58.    [ "$ONE_PART" ] && { P_PART="$ONE_PART"; P_BP_ID=""; }
  59.   fi
  60. + #wait_for_usb_part  "$P_BP_ID"  
  61.   find_onepupdrv "$P_PART" "$P_BP_FN" "$P_DEF_FN" "p"
  62.   [ "$ONE_FN" ] && { PDRV="$ONE_PART,$ONE_FS,$ONE_FN"; P_MP="$ONE_MP"; }
  63.   [ "$PDEBUG" ] && echo "2: ONE_PART=$ONE_PART ONE_FN=$ONE_FN ONE_MP=$ONE_MP"
Add Comment
Please, Sign In to add comment