[LEDE-DEV] [PATCH 1/2] procd/base-files: move init.d locking to rc.common

Roman Yeryomin roman at advem.lv
Thu Jan 25 16:26:08 PST 2018


On 2018-01-18 10:30, John Crispin wrote:
> On 18/01/18 09:14, John Crispin wrote:
>> rather than using flock for procd enabled services we add locking to 
>> the
>> rc.common code.
>> 
>> Signed-off-by: John Crispin <john at phrozen.org>
>> ---
>>   package/base-files/files/etc/rc.common |  6 ++++++
>>   package/system/procd/files/procd.sh    | 15 ---------------
>>   2 files changed, 6 insertions(+), 15 deletions(-)
>> 
>> diff --git a/package/base-files/files/etc/rc.common 
>> b/package/base-files/files/etc/rc.common
>> index 3e237170b4..180ee83acd 100755
>> --- a/package/base-files/files/etc/rc.common
>> +++ b/package/base-files/files/etc/rc.common
>> @@ -148,4 +148,10 @@ ${INIT_TRACE:+set -x}
>>     ALL_COMMANDS="start stop reload restart boot shutdown enable 
>> disable enabled depends ${EXTRA_COMMANDS}"
>>   list_contains ALL_COMMANDS "$action" || action=help
>> +
>> +local basescript=$(readlink "$initscript")
>> +local service_name="$(basename ${basescript:-$initscript})"
>> +
>> +lock -w /var/lock/init.d_${service_name}.lock
> 
> the -w is wrong here and needs to be removed
> 

Hi John,
the lock command here is OpenWrt custom patch, implementing flock (in a 
different way).
Maybe we can use busybox flock and migrate all other scripts to flock? 
Can it do something what flock cannot?
I have done this already in one of my branches but didn't do testing so 
didn't submit.

Regards,
Roman




More information about the Lede-dev mailing list