All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] update-rc.d: Fix enable/disable command
@ 2021-07-05  7:07 Einar Gunnarsson
  2021-07-05 19:41 ` [OE-core] " Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Einar Gunnarsson @ 2021-07-05  7:07 UTC (permalink / raw)
  To: openembedded-core; +Cc: Einar Gunnarsson

$[] is a bashism and does not work on POSIX shells.

enable/disable on links numbered 08 and 09 gave the error:
'bash: 100-08: value too great for base (error token is "08")'
Links numbered 91-99 created a single digit link.

Links numbered 91 or higher now create a double digit link
with a leading zero.

Signed-off-by: Einar Gunnarsson <tolvupostur@gmail.com>
---
 update-rc.d | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/update-rc.d b/update-rc.d
index c9355d7..95d1c22 100644
--- a/update-rc.d
+++ b/update-rc.d
@@ -114,7 +114,7 @@ renamelink()
         # or stop link to start link with a sequence number equal to the difference of 100 minus the original sequence number.
 	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]
+		newnn=$(printf "%02d" $((100-${oldnn#0})))
 		[ $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}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [OE-core] [PATCH] update-rc.d: Fix enable/disable command
  2021-07-05  7:07 [PATCH] update-rc.d: Fix enable/disable command Einar Gunnarsson
@ 2021-07-05 19:41 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2021-07-05 19:41 UTC (permalink / raw)
  To: Einar Gunnarsson; +Cc: openembedded-core

Hello,

This was actually applied on saturday:
https://git.yoctoproject.org/cgit/cgit.cgi/update-rc.d/commit/?id=8636cf478d426b568c1be11dbd9346f67e03adac

On 05/07/2021 09:07:40+0200, Einar Gunnarsson wrote:
> $[] is a bashism and does not work on POSIX shells.
> 
> enable/disable on links numbered 08 and 09 gave the error:
> 'bash: 100-08: value too great for base (error token is "08")'
> Links numbered 91-99 created a single digit link.
> 
> Links numbered 91 or higher now create a double digit link
> with a leading zero.
> 
> Signed-off-by: Einar Gunnarsson <tolvupostur@gmail.com>
> ---
>  update-rc.d | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/update-rc.d b/update-rc.d
> index c9355d7..95d1c22 100644
> --- a/update-rc.d
> +++ b/update-rc.d
> @@ -114,7 +114,7 @@ renamelink()
>          # or stop link to start link with a sequence number equal to the difference of 100 minus the original sequence number.
>  	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]
> +		newnn=$(printf "%02d" $((100-${oldnn#0})))
>  		[ $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}
> -- 
> 2.17.1
> 

> 
> 
> 


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-05 19:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05  7:07 [PATCH] update-rc.d: Fix enable/disable command Einar Gunnarsson
2021-07-05 19:41 ` [OE-core] " Alexandre Belloni

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.