Skip to contentSkip to conversation

update-rc.d: Fix enable/disable command

PATCH Einar Gunnarsson 2 participants 3 messages Jul 2, 2021 – Jul 3, 2021 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

I forgot the third error in this line:
Links numbered 91 or higher will create a single digit link.

# update-rc.d -v  -n smack disable
rename /etc/rc2.d/S91smack -> /etc/rc2.d/K9smack

I guess this fixes all three:

printf -v newnn "%02d" $((100-${oldnn#0}))

How do I resubmit a patch?

Quoted 35 lines · Einar Gunnarsson via lists.openembedded.org

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

enable/disable on links numbered 08 and 09 gives the error:
'bash: 100-08: value too great for base (error token is "08")'

---
 update-rc.d | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
update-rc.d +0 -0
index c9355d7..24ac752 100644
@@ -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
update-rc.d +1 -2
-c2-3`
-               newnn=$[100-$oldnn]
+               newnn=$((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

Signature · 3 lines
Regards
Einar Jón
+31 610 957234
#2 lore raw
Quoted 12 lines · Einar Gunnarsson

I forgot the third error in this line:
Links numbered 91 or higher will create a single digit link.

# update-rc.d -v  -n smack disable
rename /etc/rc2.d/S91smack -> /etc/rc2.d/K9smack

I guess this fixes all three:

printf -v newnn "%02d" $((100-${oldnn#0}))

How do I resubmit a patch?

Simply send the new patch with [PATCH v2] instead of [PATCH].

Quoted 48 lines
Quoted 35 lines · Einar Gunnarsson via lists.openembedded.org

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

enable/disable on links numbered 08 and 09 gives the error:
'bash: 100-08: value too great for base (error token is "08")'

---
 update-rc.d | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
update-rc.d +0 -0
index c9355d7..24ac752 100644
@@ -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
update-rc.d +1 -2
-c2-3`
-               newnn=$[100-$oldnn]
+               newnn=$((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

Signature · 3 lines
Regards
Einar Jón
+31 610 957234
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

Ok.
I messed up the prefix, so the mail is separate...
https://lists.openembedded.org/g/openembedded-core/message/153509

Quoted 74 lines · Alexandre Belloni
Quoted 12 lines · Einar Gunnarsson

I forgot the third error in this line:
Links numbered 91 or higher will create a single digit link.

# update-rc.d -v  -n smack disable
rename /etc/rc2.d/S91smack -> /etc/rc2.d/K9smack

I guess this fixes all three:

printf -v newnn "%02d" $((100-${oldnn#0}))

How do I resubmit a patch?

Simply send the new patch with [PATCH v2] instead of [PATCH].

Quoted 14 lines
Quoted 10 lines · Einar Gunnarsson via lists.openembedded.org

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

enable/disable on links numbered 08 and 09 gives the error:
'bash: 100-08: value too great for base (error token is "08")'

---
 update-rc.d | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 6 lines

update-rc.d renamelink() · line 114

Quoted 6 lines
update-rc.d +0 -0
index c9355d7..24ac752 100644
@@ -114,7 +114,7 @@ renamelink()
         # or stop link to start link with a sequence number equal to

the

Quoted 2 lines
Quoted 2 lines

difference of 100 minus the original sequence number.

        if ls ${etcd}${lev}.d/${oldstartstop}*${bn} >/dev/null 2>&1;

then

Quoted 1 line
Quoted 1 line

oldnn=`basename

${etcd}${lev}.d/${oldstartstop}*${bn}|cut

Quoted 17 lines
Quoted 4 lines
update-rc.d +1 -2
-c2-3`
-               newnn=$[100-$oldnn]
+               newnn=$((100-${oldnn#0}))
                [ $verbose -eq 1 ] && echo "rename
Quoted 12 lines

${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

Quoted 8 lines

--
Regards
Einar Jón
+31 610 957234

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

Signature · 3 lines
Regards
Einar Jón
+31 610 957234