diff mbox series

[OpenWrt-Devel,1/2] base-files: make USE_PROCD=1 default

Message ID 20190723133717.20010-1-ynezz@true.cz
State Deferred
Delegated to: Petr Štetiar
Headers show
Series [OpenWrt-Devel,1/2] base-files: make USE_PROCD=1 default | expand

Commit Message

Petr Štetiar July 23, 2019, 1:37 p.m. UTC
Transition period for init script migration was long enough, let's
make USE_PROCD=1 default now so there's enough time to convert the
remaining services/init scripts for the next release.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 package/base-files/files/etc/rc.common | 113 ++++++++++---------------
 1 file changed, 47 insertions(+), 66 deletions(-)

Comments

Stijn Tintel July 28, 2019, 7:37 p.m. UTC | #1
On 23/07/19 16:37, Petr Štetiar wrote:
> Transition period for init script migration was long enough, let's
> make USE_PROCD=1 default now so there's enough time to convert the
> remaining services/init scripts for the next release.
>
> Signed-off-by: Petr Štetiar <ynezz@true.cz>
> ---
>  package/base-files/files/etc/rc.common | 113 ++++++++++---------------
>  1 file changed, 47 insertions(+), 66 deletions(-)
>
Acked-by: Stijn Tintel <stijn@linux-ipv6.be>
Hauke Mehrtens Aug. 2, 2019, 2:42 p.m. UTC | #2
On 7/23/19 3:37 PM, Petr Štetiar wrote:
> Transition period for init script migration was long enough, let's
> make USE_PROCD=1 default now so there's enough time to convert the
> remaining services/init scripts for the next release.
> 
> Signed-off-by: Petr Štetiar <ynezz@true.cz>
> ---
>  package/base-files/files/etc/rc.common | 113 ++++++++++---------------
>  1 file changed, 47 insertions(+), 66 deletions(-)
> 

Do you know how many packages in the package feed and the main
repository are still not using procd?

External repositories, not the package feed, will probably be affected
most, but I think we do not have to care and there were many years to
convert.

Acked-by: Hauke Mehrtens <hauke@hauke-m.de>

Hauke
Hannu Nyman Aug. 2, 2019, 3 p.m. UTC | #3
Hauke Mehrtens kirjoitti 2.8.2019 klo 17.42:
> On 7/23/19 3:37 PM, Petr Štetiar wrote:
>> Transition period for init script migration was long enough, let's
>> make USE_PROCD=1 default now so there's enough time to convert the
>> remaining services/init scripts for the next release.
>>
>> Signed-off-by: Petr Štetiar <ynezz@true.cz>
>> ---
>>   package/base-files/files/etc/rc.common | 113 ++++++++++---------------
>>   1 file changed, 47 insertions(+), 66 deletions(-)
>>
> Do you know how many packages in the package feed and the main
> repository are still not using procd?
>
> External repositories, not the package feed, will probably be affected
> most, but I think we do not have to care and there were many years to
> convert.
>
> Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
>
> Hauke
>

I do not remember seeing ever a general call for converting the old packages 
to using procd. In that sense this proposed change to switch the default 
comes a bit surpise.

Quick search in the packages feed repo reveals that there are 281 instances 
of "/etc/rc.common" and only 205 instances of USE_PROCD. So, likely about 75 
packages in the packages feed repo only are using the old syntax without procd.

Has a decision been made to declare the old-style init file invalid? Will it 
be possible to still use the syntax? What is the new "override" to indicate 
the usage of the old syntax?

Or will the proposed change disable the packages using the old init file 
syntax totally?
Kevin 'ldir' Darbyshire-Bryant Aug. 2, 2019, 4:18 p.m. UTC | #4
> On 2 Aug 2019, at 16:00, Hannu Nyman <hannu.nyman@iki.fi> wrote:
> 
> Hauke Mehrtens kirjoitti 2.8.2019 klo 17.42:
>> On 7/23/19 3:37 PM, Petr Štetiar wrote:
>>> Transition period for init script migration was long enough, let's
>>> make USE_PROCD=1 default now so there's enough time to convert the
>>> remaining services/init scripts for the next release.
>>> 
>>> Signed-off-by: Petr Štetiar <ynezz@true.cz>
>>> ---
>>>  package/base-files/files/etc/rc.common | 113 ++++++++++---------------
>>>  1 file changed, 47 insertions(+), 66 deletions(-)
>>> 
>> Do you know how many packages in the package feed and the main
>> repository are still not using procd?
>> 
>> External repositories, not the package feed, will probably be affected
>> most, but I think we do not have to care and there were many years to
>> convert.
>> 
>> Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
>> 
>> Hauke
>> 
> 
> I do not remember seeing ever a general call for converting the old packages to using procd. In that sense this proposed change to switch the default comes a bit surpise.
> 
> Quick search in the packages feed repo reveals that there are 281 instances of "/etc/rc.common" and only 205 instances of USE_PROCD. So, likely about 75 packages in the packages feed repo only are using the old syntax without procd.
> 
> Has a decision been made to declare the old-style init file invalid? Will it be possible to still use the syntax? What is the new "override" to indicate the usage of the old syntax?
> 
> Or will the proposed change disable the packages using the old init file syntax totally?

My reading of the change is that old syntax is basically dropped.

Wish for:  We should be using procd and to that end I started looking at converting the ‘important to me’ packages: ddns & miniupnpd.

Real life: Documentation is confusing vs real life which is just plain different. See adblock startup script as an excellent example of **** that just isn’t documented.

I gave up and left the process feeling very angry.


KDB
Reiner Karlsberg Aug. 2, 2019, 4:38 p.m. UTC | #5
Although not a developer of openwrt itself, but a happy (?) user, I have to agree to the statement below.

PROCD=1 default is a NOGO for me.

Simple reason,as mentioned already: Software, which is not documented, does not exist.
Which is a requirement, we had to obey to already half a century ago. When I wrote my first Assembler code.

For me, this is another step of openwrt into bloatware, as it becomes more and more "obfuscated",
the simple user like me not giving any idea, how it is supposed to work.

Which breaks another old principle of software development: Egoless programming.
Not only the coder should understand, how it works.

Open Source is heading into Closed Source.
Back to the roots.


My few cents.

Reiner Karlsberg







Am 02.08.2019 um 18:18 schrieb Kevin 'ldir' Darbyshire-Bryant:
> 
> 
>> On 2 Aug 2019, at 16:00, Hannu Nyman <hannu.nyman@iki.fi> wrote:
>>
>> Hauke Mehrtens kirjoitti 2.8.2019 klo 17.42:
>>> On 7/23/19 3:37 PM, Petr Štetiar wrote:
>>>> Transition period for init script migration was long enough, let's
>>>> make USE_PROCD=1 default now so there's enough time to convert the
>>>> remaining services/init scripts for the next release.
>>>>
>>>> Signed-off-by: Petr Štetiar <ynezz@true.cz>
>>>> ---
>>>>   package/base-files/files/etc/rc.common | 113 ++++++++++---------------
>>>>   1 file changed, 47 insertions(+), 66 deletions(-)
>>>>
>>> Do you know how many packages in the package feed and the main
>>> repository are still not using procd?
>>>
>>> External repositories, not the package feed, will probably be affected
>>> most, but I think we do not have to care and there were many years to
>>> convert.
>>>
>>> Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
>>>
>>> Hauke
>>>
>>
>> I do not remember seeing ever a general call for converting the old packages to using procd. In that sense this proposed change to switch the default comes a bit surpise.
>>
>> Quick search in the packages feed repo reveals that there are 281 instances of "/etc/rc.common" and only 205 instances of USE_PROCD. So, likely about 75 packages in the packages feed repo only are using the old syntax without procd.
>>
>> Has a decision been made to declare the old-style init file invalid? Will it be possible to still use the syntax? What is the new "override" to indicate the usage of the old syntax?
>>
>> Or will the proposed change disable the packages using the old init file syntax totally?
> 
> My reading of the change is that old syntax is basically dropped.
> 
> Wish for:  We should be using procd and to that end I started looking at converting the ‘important to me’ packages: ddns & miniupnpd.
> 
> Real life: Documentation is confusing vs real life which is just plain different. See adblock startup script as an excellent example of **** that just isn’t documented.
> 
> I gave up and left the process feeling very angry.
> 
> 
> KDB
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
John Crispin Aug. 2, 2019, 7:40 p.m. UTC | #6
Hi,

ignoring the ranting and putting  the enlightening philantrophic 
comments aside, on a pure technical level, being the author of procd, I 
dont think this is a good idea. procd is an opt-in feature for those 
that want to use it. there has never been a requirement to make it 
baseline. USE_PROCD=1 is only intended for the owrt specific core 
services that want to make use of the advanced features. owrt is a linux 
system and thus should by default be able to run SYSV init style rc.d 
scripts. anything else would be a very daring thing to do. To be honest 
I dont even understand the motivation of wanting to make this opt-out.

     John

On 02/08/2019 18:38, Reiner Karlsberg wrote:
> Although not a developer of openwrt itself, but a happy (?) user, I 
> have to agree to the statement below.
>
> PROCD=1 default is a NOGO for me.
>
> Simple reason,as mentioned already: Software, which is not documented, 
> does not exist.
> Which is a requirement, we had to obey to already half a century ago. 
> When I wrote my first Assembler code.
>
> For me, this is another step of openwrt into bloatware, as it becomes 
> more and more "obfuscated",
> the simple user like me not giving any idea, how it is supposed to work.
>
> Which breaks another old principle of software development: Egoless 
> programming.
> Not only the coder should understand, how it works.
>
> Open Source is heading into Closed Source.
> Back to the roots.
>
>
> My few cents.
>
> Reiner Karlsberg
>
>
>
>
>
>
>
> Am 02.08.2019 um 18:18 schrieb Kevin 'ldir' Darbyshire-Bryant:
>>
>>
>>> On 2 Aug 2019, at 16:00, Hannu Nyman <hannu.nyman@iki.fi> wrote:
>>>
>>> Hauke Mehrtens kirjoitti 2.8.2019 klo 17.42:
>>>> On 7/23/19 3:37 PM, Petr Štetiar wrote:
>>>>> Transition period for init script migration was long enough, let's
>>>>> make USE_PROCD=1 default now so there's enough time to convert the
>>>>> remaining services/init scripts for the next release.
>>>>>
>>>>> Signed-off-by: Petr Štetiar <ynezz@true.cz>
>>>>> ---
>>>>>   package/base-files/files/etc/rc.common | 113 
>>>>> ++++++++++---------------
>>>>>   1 file changed, 47 insertions(+), 66 deletions(-)
>>>>>
>>>> Do you know how many packages in the package feed and the main
>>>> repository are still not using procd?
>>>>
>>>> External repositories, not the package feed, will probably be affected
>>>> most, but I think we do not have to care and there were many years to
>>>> convert.
>>>>
>>>> Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
>>>>
>>>> Hauke
>>>>
>>>
>>> I do not remember seeing ever a general call for converting the old 
>>> packages to using procd. In that sense this proposed change to 
>>> switch the default comes a bit surpise.
>>>
>>> Quick search in the packages feed repo reveals that there are 281 
>>> instances of "/etc/rc.common" and only 205 instances of USE_PROCD. 
>>> So, likely about 75 packages in the packages feed repo only are 
>>> using the old syntax without procd.
>>>
>>> Has a decision been made to declare the old-style init file invalid? 
>>> Will it be possible to still use the syntax? What is the new 
>>> "override" to indicate the usage of the old syntax?
>>>
>>> Or will the proposed change disable the packages using the old init 
>>> file syntax totally?
>>
>> My reading of the change is that old syntax is basically dropped.
>>
>> Wish for:  We should be using procd and to that end I started looking 
>> at converting the ‘important to me’ packages: ddns & miniupnpd.
>>
>> Real life: Documentation is confusing vs real life which is just 
>> plain different. See adblock startup script as an excellent example 
>> of **** that just isn’t documented.
>>
>> I gave up and left the process feeling very angry.
>>
>>
>> KDB
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Petr Štetiar Aug. 3, 2019, 10:01 p.m. UTC | #7
Hannu Nyman <hannu.nyman@iki.fi> [2019-08-02 18:00:30]:

Hi,

> I do not remember seeing ever a general call for converting the old packages
> to using procd.

I'm not aware about any of such rules (even unwritten). I mean, this is change
proposed against master/development branch, so it's likely, that it might
cause some havoc. We can still fix/revert it, right?

> Has a decision been made to declare the old-style init file invalid?

It depends on how you look at it. If you take the Acks into the account, then
it might be considered as a decisison made by a few "signed" developers under
that commit.

Anyway, it's much simpler, I just touched that part of the tree with recent
changes (mainly related to service_running stuff), so I've simply thought,
that USE_PROCD=1 should be implicit, because:

 * it would make the code in rc.common cleaner
 * everything in the master tree has USE_PROCD=1 set explicitly
 * it's unlikely, that anyone is using OpenWrt services/packages without procd

-- ynezz
Petr Štetiar Aug. 3, 2019, 10:10 p.m. UTC | #8
John Crispin <john@phrozen.org> [2019-08-02 21:40:03]:

Hi,

> owrt is a linux system and thus should by default be able to run SYSV init
> style rc.d scripts.

fair enough, but USE_PROCD=1 is in fact almost default now, we don't even
consider new services without USE_PROCD=1 (if I didn't misread something
again).

-- ynezz
Alberto Bursi Aug. 4, 2019, 2:27 a.m. UTC | #9
On 02/08/19 18:18, Kevin 'ldir' Darbyshire-Bryant wrote:
>
>> On 2 Aug 2019, at 16:00, Hannu Nyman <hannu.nyman@iki.fi> wrote:
>>
>> Hauke Mehrtens kirjoitti 2.8.2019 klo 17.42:
>>> On 7/23/19 3:37 PM, Petr Štetiar wrote:
>>>> Transition period for init script migration was long enough, let's
>>>> make USE_PROCD=1 default now so there's enough time to convert the
>>>> remaining services/init scripts for the next release.
>>>>
>>>> Signed-off-by: Petr Štetiar <ynezz@true.cz>
>>>> ---
>>>>   package/base-files/files/etc/rc.common | 113 ++++++++++---------------
>>>>   1 file changed, 47 insertions(+), 66 deletions(-)
>>>>
>>> Do you know how many packages in the package feed and the main
>>> repository are still not using procd?
>>>
>>> External repositories, not the package feed, will probably be affected
>>> most, but I think we do not have to care and there were many years to
>>> convert.
>>>
>>> Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
>>>
>>> Hauke
>>>
>> I do not remember seeing ever a general call for converting the old packages to using procd. In that sense this proposed change to switch the default comes a bit surpise.
>>
>> Quick search in the packages feed repo reveals that there are 281 instances of "/etc/rc.common" and only 205 instances of USE_PROCD. So, likely about 75 packages in the packages feed repo only are using the old syntax without procd.
>>
>> Has a decision been made to declare the old-style init file invalid? Will it be possible to still use the syntax? What is the new "override" to indicate the usage of the old syntax?
>>
>> Or will the proposed change disable the packages using the old init file syntax totally?
> My reading of the change is that old syntax is basically dropped.
>
> Wish for:  We should be using procd and to that end I started looking at converting the ‘important to me’ packages: ddns & miniupnpd.
>
> Real life: Documentation is confusing vs real life which is just plain different. See adblock startup script as an excellent example of **** that just isn’t documented.
>
> I gave up and left the process feeling very angry.
>
>
> KDB
>

I had a look at that init script and I see that more or less everything 
it does is documented in the wiki 
https://openwrt.org/docs/guide-developer/procd-init-scripts

and the example here 
https://openwrt.org/docs/guide-developer/procd-init-script-example


Main things missing are the boot() function and the use of 
EXTRA_COMMANDS and EXTRA_HELP to add more commands you can find as 
functions under the normal ones.

I think it should still be enough to port over the ddns as it's 
basically just starting and stopping an external script, but for 
miniupnpd you would probably have to move

all the logic from the initscript to an external helper script you call 
from procd, similar to what ddns package does.


Although yes I agree on the concept, procd has jails and other 
functionality that isn't documented anywhere.

I've seen commits for stuff but not found packages using it.


-Alberto
diff mbox series

Patch

diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common
index 4fdf7485096c..b8dbe123ca18 100755
--- a/package/base-files/files/etc/rc.common
+++ b/package/base-files/files/etc/rc.common
@@ -1,25 +1,15 @@ 
 #!/bin/sh
 # Copyright (C) 2006-2012 OpenWrt.org
 
+initscript=$1
+
 . $IPKG_INSTROOT/lib/functions.sh
 . $IPKG_INSTROOT/lib/functions/service.sh
+. $IPKG_INSTROOT/lib/functions/procd.sh
 
-initscript=$1
 action=${2:-help}
 shift 2
 
-start() {
-	return 0
-}
-
-stop() {
-	return 0
-}
-
-reload() {
-	restart
-}
-
 restart() {
 	trap '' TERM
 	stop "$@"
@@ -73,11 +63,10 @@  Available commands:
 	reload	Reload configuration files (or restart if service does not implement reload)
 	enable	Enable service autostart
 	disable	Disable service autostart
-$EXTRA_HELP
+	running	Check if service is running
 EOF
 }
 
-# for procd
 start_service() {
 	return 0
 }
@@ -104,57 +93,49 @@  ${INIT_TRACE:+set -x}
 
 . "$initscript"
 
-[ -n "$USE_PROCD" ] && {
-	EXTRA_COMMANDS="${EXTRA_COMMANDS} running trace"
-	EXTRA_HELP="\
-	running	Check if service is running
-	"
-
-	. $IPKG_INSTROOT/lib/functions/procd.sh
-	basescript=$(readlink "$initscript")
-	rc_procd() {
-		local method="set"
-		[ -n "$2" ] && method="add"
-		procd_open_service "$(basename ${basescript:-$initscript})" "$initscript"
-		"$@"
-		procd_close_service "$method"
-	}
-
-	start() {
-		rc_procd start_service "$@"
-		if eval "type service_started" 2>/dev/null >/dev/null; then
-			service_started
-		fi
-	}
-
-	trace() {
-		TRACE_SYSCALLS=1
-		start "$@"
-	}
-
-	stop() {
+basescript=$(readlink "$initscript")
+rc_procd() {
+	local method="set"
+	[ -n "$2" ] && method="add"
+	procd_open_service "$(basename ${basescript:-$initscript})" "$initscript"
+	"$@"
+	procd_close_service "$method"
+}
+
+start() {
+	rc_procd start_service "$@"
+	if eval "type service_started" 2>/dev/null >/dev/null; then
+		service_started
+	fi
+}
+
+trace() {
+	TRACE_SYSCALLS=1
+	start "$@"
+}
+
+stop() {
+	procd_lock
+	stop_service "$@"
+	procd_kill "$(basename ${basescript:-$initscript})" "$1"
+	if eval "type service_stopped" 2>/dev/null >/dev/null; then
+		service_stopped
+	fi
+}
+
+reload() {
+	if eval "type reload_service" 2>/dev/null >/dev/null; then
 		procd_lock
-		stop_service "$@"
-		procd_kill "$(basename ${basescript:-$initscript})" "$1"
-		if eval "type service_stopped" 2>/dev/null >/dev/null; then
-			service_stopped
-		fi
-	}
-
-	reload() {
-		if eval "type reload_service" 2>/dev/null >/dev/null; then
-			procd_lock
-			reload_service "$@"
-		else
-			start
-		fi
-	}
-
-	running() {
-		service_running "$@"
-	}
-}
-
-ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends ${EXTRA_COMMANDS}"
+		reload_service "$@"
+	else
+		start
+	fi
+}
+
+running() {
+	service_running "$@"
+}
+
+ALL_COMMANDS="start stop reload restart boot shutdown enable disable enabled depends running trace"
 list_contains ALL_COMMANDS "$action" || action=help
 $action "$@"