Implement BOOTDELAY option to wait for boot process to complete. Fix devd(8) config (thanks to LARKIND) to match all needed devices and their partitions.
This commit is contained in:
parent
83e22eb923
commit
4506edf751
32
automount
32
automount
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Copyright (c) 2012 Slawomir Wojciech Wojtczak (vermaden)
|
||||
# Copyright (c) 2012-2013 Slawomir Wojciech Wojtczak (vermaden)
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -107,10 +107,16 @@ TIMEOUT (set to 8 by default)
|
|||
|
||||
example: TIMEOUT="8"
|
||||
|
||||
DELAY (set to 0.3 seconds by default)
|
||||
DELAY (set to 1 second by default)
|
||||
How often to check for device availability.
|
||||
|
||||
example: DELAY="2.5"
|
||||
|
||||
BOOTDELAY (set to 45 seconds by default)
|
||||
How long to wait for boot process to complete.
|
||||
|
||||
example: BOOTDELAY="30"
|
||||
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
|
@ -143,7 +149,8 @@ fi
|
|||
: ${USER="0"} # which user to use for popup
|
||||
: ${FM="0"} # which file manager to use
|
||||
: ${TIMEOUT="8"} # stop waiting for device after that time
|
||||
: ${DELAY="0.3"} # check for the device node that often
|
||||
: ${DELAY="1"} # check for the device node that often
|
||||
: ${BOOTDELAY="45"} # wait for boot process to complete
|
||||
|
||||
if [ "${USERUMOUNT}" = YES ]
|
||||
then
|
||||
|
|
@ -232,6 +239,25 @@ __wait_for_device() { # 1=DEV
|
|||
done
|
||||
}
|
||||
|
||||
__wait_for_boot() {
|
||||
local BOOTTIME=$( sysctl -n kern.boottime | awk -F',' '{print $1}' | awk '{print $NF }' )
|
||||
local CURRTIME=$( date +%s )
|
||||
local UPTIME=$(( ${CURRTIME} - ${BOOTTIME} ))
|
||||
while [ ${UPTIME} -lt ${BOOTDELAY} ]
|
||||
do
|
||||
sleep 1
|
||||
local WAIT=1
|
||||
local CURRTIME=$( date +%s )
|
||||
local UPTIME=$(( ${CURRTIME} - ${BOOTTIME} ))
|
||||
done
|
||||
if [ ${WAIT} -eq 1 ]
|
||||
then
|
||||
__log "${DEV}: wait for boot process completed after '${BOOTDELAY}' seconds"
|
||||
fi
|
||||
}
|
||||
|
||||
__wait_for_boot
|
||||
|
||||
DEV=/dev/${1}
|
||||
|
||||
case ${2} in
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
notify 100 {
|
||||
match "system" "DEVFS";
|
||||
match "type" "CREATE";
|
||||
match "cdev" "(da|mmcsd)[0-9]+";
|
||||
match "cdev" "(da|mmcsd)[0-9]+.*";
|
||||
action "/usr/local/sbin/automount $cdev attach";
|
||||
};
|
||||
|
||||
notify 100 {
|
||||
match "system" "DEVFS";
|
||||
match "type" "DESTROY";
|
||||
match "cdev" "(da|mmcsd)[0-9]+";
|
||||
match "cdev" "(da|mmcsd)[0-9]+.*";
|
||||
action "/usr/local/sbin/automount $cdev detach";
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
notify 200 {
|
||||
match "system" "DEVFS";
|
||||
match "type" "CREATE";
|
||||
match "cdev" "(da|mmcsd)[0-9]+";
|
||||
match "cdev" "(da|mmcsd)[0-9]+.*";
|
||||
action "/bin/sh -xe /usr/local/sbin/automount $cdev attach >> /root/DEBUG.$cdev.attach 2>&1";
|
||||
};
|
||||
|
||||
notify 200 {
|
||||
match "system" "DEVFS";
|
||||
match "type" "DESTROY";
|
||||
match "cdev" "(da|mmcsd)[0-9]+";
|
||||
match "cdev" "(da|mmcsd)[0-9]+.*";
|
||||
action "/bin/sh -xe /usr/local/sbin/automount $cdev detach >> /root/DEBUG.$cdev.detach 2>&1";
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue