* [PATCH] update-rc.d: support enable/disable function
@ 2018-11-09 9:44 changqing.li
2018-11-09 9:44 ` [PATCH] ref-variables.xml: update manual page for update-rc.d changqing.li
2018-11-26 3:35 ` [PATCH] update-rc.d: support enable/disable function Changqing Li
0 siblings, 2 replies; 5+ messages in thread
From: changqing.li @ 2018-11-09 9:44 UTC (permalink / raw)
To: yocto
From: Changqing Li <changqing.li@windriver.com>
Add support of enable/disable function, so that user can keep
previous config after upgrade package
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
update-rc.d | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/update-rc.d b/update-rc.d
index e07cf85..1ba97d3 100644
--- a/update-rc.d
+++ b/update-rc.d
@@ -27,6 +27,7 @@ usage()
usage: update-rc.d [-n] [-f] [-r <root>] <basename> remove
update-rc.d [-n] [-r <root>] [-s] <basename> defaults [NN | sNN kNN]
update-rc.d [-n] [-r <root>] [-s] <basename> start|stop NN runlvl [runlvl] [...] .
+ update-rc.d [-n] [-r <root>] [-s] <basename> enable|disable [S|2|3|4|5]
-n: not really
-f: force
-v: verbose
@@ -101,6 +102,43 @@ makelinks()
done
}
+renamelink()
+{
+ local oldstartstop newstartstop lev oldnn newnn
+ if [ "x$1" = "xS" ]; then
+ oldstartstop="K"
+ newstartstop="S"
+ else
+ oldstartstop="S"
+ newstartstop="K"
+ fi
+
+ lev=$2
+ if ls ${etcd}${lev}.d/${oldstartstop}*${bn} >/dev/null 2>&1; then
+ oldnn=`basename ${etcd}${lev}.d/${oldstartstop}*${bn}|cut -c2-3`
+ newnn=$[100-$oldnn]
+ [ $verbose -eq 1 ] && echo "rename ${etcd}${lev}.d/${oldstartstop}${oldnn}${bn} -> ${etcd}${lev}.d/${newstartstop}${newnn}${bn}"
+ if [ $notreally -eq 0 ];then
+ mv ${etcd}${lev}.d/${oldstartstop}${oldnn}${bn} ${etcd}${lev}.d/${newstartstop}${newnn}${bn}
+ fi
+ if [ $dostart -eq 1 ] && [ $newstartstop = "S" ] && [ $lev = $RUNLEVEL ]; then
+ $fn start || true
+ fi
+ fi
+
+}
+
+renamelinks()
+{
+ if [ $# -eq 2 ]; then
+ renamelink $1 $2
+ else
+ for i in 2 3 4 5 S; do
+ renamelink $1 $i
+ done
+ fi
+}
+
while [ $# -gt 0 ]; do
case $1 in
-n) notreally=1
@@ -221,6 +259,13 @@ case $1 in
;;
start | stop)
+ if [ $# -lt 4 ]
+ then
+ echo "Not enough arguments"
+ usage
+ exit 1
+ fi
+
while [ $# -gt 0 ]; do
if [ $1 = "start" ]; then
letter=S
@@ -251,6 +296,31 @@ case $1 in
makelinks
;;
+ enable | disable)
+ if [ $1 = "enable" ]; then
+ letter=S
+ elif [ $1 = "disable" ]; then
+ letter=K
+ else
+ usage
+ exit 1
+ fi
+ shift
+ if [ $# -gt 0 ]
+ then
+ case $1 in
+ S|2|3|4|5)
+ renamelinks $letter $1
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+ esac
+ else
+ renamelinks $letter
+ fi
+ ;;
*)
usage
exit 1
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] ref-variables.xml: update manual page for update-rc.d
2018-11-09 9:44 [PATCH] update-rc.d: support enable/disable function changqing.li
@ 2018-11-09 9:44 ` changqing.li
2018-11-26 3:35 ` [PATCH] update-rc.d: support enable/disable function Changqing Li
1 sibling, 0 replies; 5+ messages in thread
From: changqing.li @ 2018-11-09 9:44 UTC (permalink / raw)
To: yocto
From: Changqing Li <changqing.li@windriver.com>
Currently, yocto doc refer link http://www.tin.org/bin/man.cgi?
section=8&topic=update-rc.d. as man page of update-rc.d, but lastest
debian udpate-rc.d have big difference with ours, they need insserv
and all the initscripts support LSB comment header.
change to new link which is more similar to ours.
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
documentation/ref-manual/ref-variables.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/documentation/ref-manual/ref-variables.xml b/documentation/ref-manual/ref-variables.xml
index 595f2db..fc7e087 100644
--- a/documentation/ref-manual/ref-variables.xml
+++ b/documentation/ref-manual/ref-variables.xml
@@ -7116,7 +7116,7 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3"
to the <filename>update-rc.d</filename> command.
For more information on valid parameters, please see the
<filename>update-rc.d</filename> manual page at
- <ulink url='http://www.tin.org/bin/man.cgi?section=8&topic=update-rc.d'></ulink>.
+ <ulink url='https://manpages.debian.org/wheezy/sysv-rc/update-rc.d.8.en.html'></ulink>.
</para>
</glossdef>
</glossentry>
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] update-rc.d: support enable/disable function
2018-11-09 9:44 [PATCH] update-rc.d: support enable/disable function changqing.li
2018-11-09 9:44 ` [PATCH] ref-variables.xml: update manual page for update-rc.d changqing.li
@ 2018-11-26 3:35 ` Changqing Li
2018-12-05 8:13 ` Changqing Li
1 sibling, 1 reply; 5+ messages in thread
From: Changqing Li @ 2018-11-26 3:35 UTC (permalink / raw)
To: yocto
Ping
On 11/9/18 5:44 PM, changqing.li@windriver.com wrote:
> From: Changqing Li <changqing.li@windriver.com>
>
> Add support of enable/disable function, so that user can keep
> previous config after upgrade package
>
> Signed-off-by: Changqing Li <changqing.li@windriver.com>
> ---
> update-rc.d | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 70 insertions(+)
>
> diff --git a/update-rc.d b/update-rc.d
> index e07cf85..1ba97d3 100644
> --- a/update-rc.d
> +++ b/update-rc.d
> @@ -27,6 +27,7 @@ usage()
> usage: update-rc.d [-n] [-f] [-r <root>] <basename> remove
> update-rc.d [-n] [-r <root>] [-s] <basename> defaults [NN | sNN kNN]
> update-rc.d [-n] [-r <root>] [-s] <basename> start|stop NN runlvl [runlvl] [...] .
> + update-rc.d [-n] [-r <root>] [-s] <basename> enable|disable [S|2|3|4|5]
> -n: not really
> -f: force
> -v: verbose
> @@ -101,6 +102,43 @@ makelinks()
> done
> }
>
> +renamelink()
> +{
> + local oldstartstop newstartstop lev oldnn newnn
> + if [ "x$1" = "xS" ]; then
> + oldstartstop="K"
> + newstartstop="S"
> + else
> + oldstartstop="S"
> + newstartstop="K"
> + fi
> +
> + lev=$2
> + if ls ${etcd}${lev}.d/${oldstartstop}*${bn} >/dev/null 2>&1; then
> + oldnn=`basename ${etcd}${lev}.d/${oldstartstop}*${bn}|cut -c2-3`
> + newnn=$[100-$oldnn]
> + [ $verbose -eq 1 ] && echo "rename ${etcd}${lev}.d/${oldstartstop}${oldnn}${bn} -> ${etcd}${lev}.d/${newstartstop}${newnn}${bn}"
> + if [ $notreally -eq 0 ];then
> + mv ${etcd}${lev}.d/${oldstartstop}${oldnn}${bn} ${etcd}${lev}.d/${newstartstop}${newnn}${bn}
> + fi
> + if [ $dostart -eq 1 ] && [ $newstartstop = "S" ] && [ $lev = $RUNLEVEL ]; then
> + $fn start || true
> + fi
> + fi
> +
> +}
> +
> +renamelinks()
> +{
> + if [ $# -eq 2 ]; then
> + renamelink $1 $2
> + else
> + for i in 2 3 4 5 S; do
> + renamelink $1 $i
> + done
> + fi
> +}
> +
> while [ $# -gt 0 ]; do
> case $1 in
> -n) notreally=1
> @@ -221,6 +259,13 @@ case $1 in
> ;;
>
> start | stop)
> + if [ $# -lt 4 ]
> + then
> + echo "Not enough arguments"
> + usage
> + exit 1
> + fi
> +
> while [ $# -gt 0 ]; do
> if [ $1 = "start" ]; then
> letter=S
> @@ -251,6 +296,31 @@ case $1 in
> makelinks
> ;;
>
> + enable | disable)
> + if [ $1 = "enable" ]; then
> + letter=S
> + elif [ $1 = "disable" ]; then
> + letter=K
> + else
> + usage
> + exit 1
> + fi
> + shift
> + if [ $# -gt 0 ]
> + then
> + case $1 in
> + S|2|3|4|5)
> + renamelinks $letter $1
> + ;;
> + *)
> + usage
> + exit 1
> + ;;
> + esac
> + else
> + renamelinks $letter
> + fi
> + ;;
> *)
> usage
> exit 1
--
BRs
Sandy(Li Changqing)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] update-rc.d: support enable/disable function
2018-11-26 3:35 ` [PATCH] update-rc.d: support enable/disable function Changqing Li
@ 2018-12-05 8:13 ` Changqing Li
2018-12-27 3:01 ` Changqing Li
0 siblings, 1 reply; 5+ messages in thread
From: Changqing Li @ 2018-12-05 8:13 UTC (permalink / raw)
To: yocto
ping
On 11/26/18 11:35 AM, Changqing Li wrote:
> Ping
>
> On 11/9/18 5:44 PM, changqing.li@windriver.com wrote:
>> From: Changqing Li <changqing.li@windriver.com>
>>
>> Add support of enable/disable function, so that user can keep
>> previous config after upgrade package
>>
>> Signed-off-by: Changqing Li <changqing.li@windriver.com>
>> ---
>> update-rc.d | 70
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 70 insertions(+)
>>
>> diff --git a/update-rc.d b/update-rc.d
>> index e07cf85..1ba97d3 100644
>> --- a/update-rc.d
>> +++ b/update-rc.d
>> @@ -27,6 +27,7 @@ usage()
>> usage: update-rc.d [-n] [-f] [-r <root>] <basename> remove
>> update-rc.d [-n] [-r <root>] [-s] <basename> defaults [NN |
>> sNN kNN]
>> update-rc.d [-n] [-r <root>] [-s] <basename> start|stop NN
>> runlvl [runlvl] [...] .
>> + update-rc.d [-n] [-r <root>] [-s] <basename> enable|disable
>> [S|2|3|4|5]
>> -n: not really
>> -f: force
>> -v: verbose
>> @@ -101,6 +102,43 @@ makelinks()
>> done
>> }
>> +renamelink()
>> +{
>> + local oldstartstop newstartstop lev oldnn newnn
>> + if [ "x$1" = "xS" ]; then
>> + oldstartstop="K"
>> + newstartstop="S"
>> + else
>> + oldstartstop="S"
>> + newstartstop="K"
>> + fi
>> +
>> + lev=$2
>> + if ls ${etcd}${lev}.d/${oldstartstop}*${bn} >/dev/null 2>&1; then
>> + oldnn=`basename ${etcd}${lev}.d/${oldstartstop}*${bn}|cut
>> -c2-3`
>> + newnn=$[100-$oldnn]
>> + [ $verbose -eq 1 ] && echo "rename
>> ${etcd}${lev}.d/${oldstartstop}${oldnn}${bn} ->
>> ${etcd}${lev}.d/${newstartstop}${newnn}${bn}"
>> + if [ $notreally -eq 0 ];then
>> + mv ${etcd}${lev}.d/${oldstartstop}${oldnn}${bn}
>> ${etcd}${lev}.d/${newstartstop}${newnn}${bn}
>> + fi
>> + if [ $dostart -eq 1 ] && [ $newstartstop = "S" ] && [ $lev =
>> $RUNLEVEL ]; then
>> + $fn start || true
>> + fi
>> + fi
>> +
>> +}
>> +
>> +renamelinks()
>> +{
>> + if [ $# -eq 2 ]; then
>> + renamelink $1 $2
>> + else
>> + for i in 2 3 4 5 S; do
>> + renamelink $1 $i
>> + done
>> + fi
>> +}
>> +
>> while [ $# -gt 0 ]; do
>> case $1 in
>> -n) notreally=1
>> @@ -221,6 +259,13 @@ case $1 in
>> ;;
>> start | stop)
>> + if [ $# -lt 4 ]
>> + then
>> + echo "Not enough arguments"
>> + usage
>> + exit 1
>> + fi
>> +
>> while [ $# -gt 0 ]; do
>> if [ $1 = "start" ]; then
>> letter=S
>> @@ -251,6 +296,31 @@ case $1 in
>> makelinks
>> ;;
>> + enable | disable)
>> + if [ $1 = "enable" ]; then
>> + letter=S
>> + elif [ $1 = "disable" ]; then
>> + letter=K
>> + else
>> + usage
>> + exit 1
>> + fi
>> + shift
>> + if [ $# -gt 0 ]
>> + then
>> + case $1 in
>> + S|2|3|4|5)
>> + renamelinks $letter $1
>> + ;;
>> + *)
>> + usage
>> + exit 1
>> + ;;
>> + esac
>> + else
>> + renamelinks $letter
>> + fi
>> + ;;
>> *)
>> usage
>> exit 1
>
--
BRs
Sandy(Li Changqing)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] update-rc.d: support enable/disable function
2018-12-05 8:13 ` Changqing Li
@ 2018-12-27 3:01 ` Changqing Li
0 siblings, 0 replies; 5+ messages in thread
From: Changqing Li @ 2018-12-27 3:01 UTC (permalink / raw)
To: yocto
Ping
On 12/5/18 4:13 PM, Changqing Li wrote:
> ping
>
> On 11/26/18 11:35 AM, Changqing Li wrote:
>> Ping
>>
>> On 11/9/18 5:44 PM, changqing.li@windriver.com wrote:
>>> From: Changqing Li <changqing.li@windriver.com>
>>>
>>> Add support of enable/disable function, so that user can keep
>>> previous config after upgrade package
>>>
>>> Signed-off-by: Changqing Li <changqing.li@windriver.com>
>>> ---
>>> update-rc.d | 70
>>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> 1 file changed, 70 insertions(+)
>>>
>>> diff --git a/update-rc.d b/update-rc.d
>>> index e07cf85..1ba97d3 100644
>>> --- a/update-rc.d
>>> +++ b/update-rc.d
>>> @@ -27,6 +27,7 @@ usage()
>>> usage: update-rc.d [-n] [-f] [-r <root>] <basename> remove
>>> update-rc.d [-n] [-r <root>] [-s] <basename> defaults [NN |
>>> sNN kNN]
>>> update-rc.d [-n] [-r <root>] [-s] <basename> start|stop NN
>>> runlvl [runlvl] [...] .
>>> + update-rc.d [-n] [-r <root>] [-s] <basename> enable|disable
>>> [S|2|3|4|5]
>>> -n: not really
>>> -f: force
>>> -v: verbose
>>> @@ -101,6 +102,43 @@ makelinks()
>>> done
>>> }
>>> +renamelink()
>>> +{
>>> + local oldstartstop newstartstop lev oldnn newnn
>>> + if [ "x$1" = "xS" ]; then
>>> + oldstartstop="K"
>>> + newstartstop="S"
>>> + else
>>> + oldstartstop="S"
>>> + newstartstop="K"
>>> + fi
>>> +
>>> + lev=$2
>>> + if ls ${etcd}${lev}.d/${oldstartstop}*${bn} >/dev/null 2>&1; then
>>> + oldnn=`basename ${etcd}${lev}.d/${oldstartstop}*${bn}|cut
>>> -c2-3`
>>> + newnn=$[100-$oldnn]
>>> + [ $verbose -eq 1 ] && echo "rename
>>> ${etcd}${lev}.d/${oldstartstop}${oldnn}${bn} ->
>>> ${etcd}${lev}.d/${newstartstop}${newnn}${bn}"
>>> + if [ $notreally -eq 0 ];then
>>> + mv ${etcd}${lev}.d/${oldstartstop}${oldnn}${bn}
>>> ${etcd}${lev}.d/${newstartstop}${newnn}${bn}
>>> + fi
>>> + if [ $dostart -eq 1 ] && [ $newstartstop = "S" ] && [ $lev
>>> = $RUNLEVEL ]; then
>>> + $fn start || true
>>> + fi
>>> + fi
>>> +
>>> +}
>>> +
>>> +renamelinks()
>>> +{
>>> + if [ $# -eq 2 ]; then
>>> + renamelink $1 $2
>>> + else
>>> + for i in 2 3 4 5 S; do
>>> + renamelink $1 $i
>>> + done
>>> + fi
>>> +}
>>> +
>>> while [ $# -gt 0 ]; do
>>> case $1 in
>>> -n) notreally=1
>>> @@ -221,6 +259,13 @@ case $1 in
>>> ;;
>>> start | stop)
>>> + if [ $# -lt 4 ]
>>> + then
>>> + echo "Not enough arguments"
>>> + usage
>>> + exit 1
>>> + fi
>>> +
>>> while [ $# -gt 0 ]; do
>>> if [ $1 = "start" ]; then
>>> letter=S
>>> @@ -251,6 +296,31 @@ case $1 in
>>> makelinks
>>> ;;
>>> + enable | disable)
>>> + if [ $1 = "enable" ]; then
>>> + letter=S
>>> + elif [ $1 = "disable" ]; then
>>> + letter=K
>>> + else
>>> + usage
>>> + exit 1
>>> + fi
>>> + shift
>>> + if [ $# -gt 0 ]
>>> + then
>>> + case $1 in
>>> + S|2|3|4|5)
>>> + renamelinks $letter $1
>>> + ;;
>>> + *)
>>> + usage
>>> + exit 1
>>> + ;;
>>> + esac
>>> + else
>>> + renamelinks $letter
>>> + fi
>>> + ;;
>>> *)
>>> usage
>>> exit 1
>>
--
BRs
Sandy(Li Changqing)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-12-27 3:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-09 9:44 [PATCH] update-rc.d: support enable/disable function changqing.li
2018-11-09 9:44 ` [PATCH] ref-variables.xml: update manual page for update-rc.d changqing.li
2018-11-26 3:35 ` [PATCH] update-rc.d: support enable/disable function Changqing Li
2018-12-05 8:13 ` Changqing Li
2018-12-27 3:01 ` Changqing Li
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.