diff mbox

[LEDE-DEV] Opkg: add --no-configure option patch.

Message ID 20170216011442.12750-1-daniel@dd-wrt.com
State Changes Requested
Delegated to: John Crispin
Headers show

Commit Message

Daniel Danzberger Feb. 16, 2017, 1:14 a.m. UTC
Calling opkg <cmd> with --no-configure prevents opkg
from running the configuration of the package (postinstall scripts ..etc)

This way opkg will only install the package, without restarting the service for example.

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
---
 .../opkg/patches/300-add-no-configure-option.patch | 64 ++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 package/system/opkg/patches/300-add-no-configure-option.patch

Comments

Jonas Gorski Feb. 17, 2017, 2:17 p.m. UTC | #1
Hi,

On 16 February 2017 at 02:14, Daniel Danzberger <daniel@dd-wrt.com> wrote:
> Calling opkg <cmd> with --no-configure prevents opkg
> from running the configuration of the package (postinstall scripts ..etc)
>
> This way opkg will only install the package, without restarting the service for example.

What's the use case for this? When would I want to do that?

> Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>


Regards
Jonas
Daniel Danzberger Feb. 17, 2017, 6:10 p.m. UTC | #2
Hi,

I am writing an auto update shell script with special install handlers
for some of my packages. The auto updater is a package itself and can
also be updated.

Without --no-configure, opkg would kill my auto updater while it is updating
itself.


On 02/17/2017 06:17 AM, Jonas Gorski wrote:
> Hi,
> 
> On 16 February 2017 at 02:14, Daniel Danzberger <daniel@dd-wrt.com> wrote:
>> Calling opkg <cmd> with --no-configure prevents opkg
>> from running the configuration of the package (postinstall scripts ..etc)
>>
>> This way opkg will only install the package, without restarting the service for example.
> 
> What's the use case for this? When would I want to do that?
> 
>> Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
> 
> 
> Regards
> Jonas
>
Daniel Danzberger Feb. 18, 2017, 12:05 a.m. UTC | #3
And I also do not want opkg to invoke the init scripts of the just upgraded
packages until I have finished all my checks and stuff.

I thought it might be useful for others too, if opkg has this option that let
you control the upgrade process a bit more.

What do you think ?
On 02/17/2017 06:17 AM, Jonas Gorski wrote:
> Hi,
> 
> On 16 February 2017 at 02:14, Daniel Danzberger <daniel@dd-wrt.com> wrote:
>> Calling opkg <cmd> with --no-configure prevents opkg
>> from running the configuration of the package (postinstall scripts ..etc)
>>
>> This way opkg will only install the package, without restarting the service for example.
> 
> What's the use case for this? When would I want to do that?
> 
>> Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
> 
> 
> Regards
> Jonas
>
Kevin Darbyshire-Bryant Feb. 18, 2017, 8:10 a.m. UTC | #4
> On 18 Feb 2017, at 00:06, daniel <daniel@dd-wrt.com> wrote:
> 
> And I also do not want opkg to invoke the init scripts of the just upgraded
> packages until I have finished all my checks and stuff.
> 
> I thought it might be useful for others too, if opkg has this option that let
> you control the upgrade process a bit more.

I think this is a useful tweak for very little code increase.  I was working on my own patches for dnsmasq the other day and found the opkg install 'copying & auto starting' behaviour annoying as it (initially) confused my testing.

> 
> What do you think ?
>> On 02/17/2017 06:17 AM, Jonas Gorski wrote:
>> Hi,
>> 
>>> On 16 February 2017 at 02:14, Daniel Danzberger <daniel@dd-wrt.com> wrote:
>>> Calling opkg <cmd> with --no-configure prevents opkg
>>> from running the configuration of the package (postinstall scripts ..etc)
>>> 
>>> This way opkg will only install the package, without restarting the service for example.
>> 
>> What's the use case for this? When would I want to do that?
>> 
>>> Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
>> 
>> 
>> Regards
>> Jonas
>> 
> 
> -- 
> Regards
> 
> Daniel Danzberger
> embeDD GmbH, Breitenweg 10, CH-6370 Stans
> 
> _______________________________________________
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
Jonas Gorski March 1, 2017, 9:20 a.m. UTC | #5
Hi,

On 17 February 2017 at 19:10, daniel <daniel@dd-wrt.com> wrote:
> Hi,
>
> I am writing an auto update shell script with special install handlers
> for some of my packages. The auto updater is a package itself and can
> also be updated.
>
> Without --no-configure, opkg would kill my auto updater while it is updating
> itself.

Please don't top post, it makes the discussion hard to follow.

Anyway this tidbit was all I was after, so LGTM.

Regards
Jonas

>
>
> On 02/17/2017 06:17 AM, Jonas Gorski wrote:
>> Hi,
>>
>> On 16 February 2017 at 02:14, Daniel Danzberger <daniel@dd-wrt.com> wrote:
>>> Calling opkg <cmd> with --no-configure prevents opkg
>>> from running the configuration of the package (postinstall scripts ..etc)
>>>
>>> This way opkg will only install the package, without restarting the service for example.
>>
>> What's the use case for this? When would I want to do that?
>>
>>> Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
>>
>>
>> Regards
>> Jonas
>>
>
> --
> Regards
>
> Daniel Danzberger
> embeDD GmbH, Breitenweg 10, CH-6370 Stans
>
Daniel Golle July 16, 2017, 9:17 p.m. UTC | #6
Hi everyone!

On Sat, Feb 18, 2017 at 08:10:22AM +0000, Kevin Darbyshire-Bryant wrote:
> > On 18 Feb 2017, at 00:06, daniel <daniel@dd-wrt.com> wrote:
> > 
> > And I also do not want opkg to invoke the init scripts of the just upgraded
> > packages until I have finished all my checks and stuff.
> > 
> > I thought it might be useful for others too, if opkg has this option that let
> > you control the upgrade process a bit more.
> 
> I think this is a useful tweak for very little code increase.  I was
> working on my own patches for dnsmasq the other day and found the
> opkg install 'copying & auto starting' behaviour annoying as it
> (initially) confused my testing.

I bumped into this submission while browsing through patchwork and it
partially solves another problem I have: The need to generate images
using the ImageBuilder which do have certain packages installed with
their init scripts being disabled (uci-defaults and the rest of
default-postinst should be processed in that cause though)...
I went on and simply set an environment variable which can be checked
for in the postinst script which inherits it. In that way I didn't
need to patch opkg.
Could such a solution be helpful to you as well?
Because if so, that would simply be a matter of convention, similar
to PKG_UPGRADE (see package/base-files/files/lib/functions.sh)


> 
> > 
> > What do you think ?
> >> On 02/17/2017 06:17 AM, Jonas Gorski wrote:
> >> Hi,
> >> 
> >>> On 16 February 2017 at 02:14, Daniel Danzberger <daniel@dd-wrt.com> wrote:
> >>> Calling opkg <cmd> with --no-configure prevents opkg
> >>> from running the configuration of the package (postinstall scripts ..etc)
> >>> 
> >>> This way opkg will only install the package, without restarting the service for example.
> >> 
> >> What's the use case for this? When would I want to do that?
> >> 
> >>> Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
> >> 
> >> 
> >> Regards
> >> Jonas
> >> 
> > 
> > -- 
> > Regards
> > 
> > Daniel Danzberger
> > embeDD GmbH, Breitenweg 10, CH-6370 Stans
> > 
> > _______________________________________________
> > Lede-dev mailing list
> > Lede-dev@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/lede-dev
> 
> _______________________________________________
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
diff mbox

Patch

diff --git a/package/system/opkg/patches/300-add-no-configure-option.patch b/package/system/opkg/patches/300-add-no-configure-option.patch
new file mode 100644
index 0000000000..2d69063c65
--- /dev/null
+++ b/package/system/opkg/patches/300-add-no-configure-option.patch
@@ -0,0 +1,64 @@ 
+diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
+index d2adc31..23f49a7 100644
+--- a/libopkg/opkg_cmd.c
++++ b/libopkg/opkg_cmd.c
+@@ -361,6 +361,9 @@ opkg_configure_packages(char *pkg_name)
+      opkg_intercept_t ic;
+      int r, err = 0;
+ 
++     if (conf->no_configure)
++	     return 0;
++
+      opkg_msg(INFO, "Configuring unpacked packages.\n");
+ 
+      all = pkg_vec_alloc();
+diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h
+index ab629ea..cbbdc82 100644
+--- a/libopkg/opkg_conf.h
++++ b/libopkg/opkg_conf.h
+@@ -88,6 +88,7 @@ struct opkg_conf
+      int query_all;
+      int verbosity;
+      int noaction;
++     int no_configure;
+      int size;
+      int download_only;
+      char *cache;
+diff --git a/src/opkg-cl.c b/src/opkg-cl.c
+index 8a39578..8b86098 100644
+--- a/src/opkg-cl.c
++++ b/src/opkg-cl.c
+@@ -46,6 +46,7 @@ enum {
+ 	ARGS_OPT_ADD_ARCH,
+ 	ARGS_OPT_ADD_DEST,
+ 	ARGS_OPT_NOACTION,
++	ARGS_OPT_NO_CONFIGURE,
+ 	ARGS_OPT_DOWNLOAD_ONLY,
+ 	ARGS_OPT_NODEPS,
+ 	ARGS_OPT_NOCASE,
+@@ -92,6 +93,7 @@ static struct option long_options[] = {
+ 	{"force-signature", 0, 0, ARGS_OPT_FORCE_SIGNATURE},
+ 	{"force_signature", 0, 0, ARGS_OPT_FORCE_SIGNATURE},
+ 	{"noaction", 0, 0, ARGS_OPT_NOACTION},
++	{"no-configure", 0, 0, ARGS_OPT_NO_CONFIGURE},
+ 	{"download-only", 0, 0, ARGS_OPT_DOWNLOAD_ONLY},
+ 	{"nodeps", 0, 0, ARGS_OPT_NODEPS},
+ 	{"nocase", 0, 0, ARGS_OPT_NOCASE},
+@@ -220,6 +222,9 @@ args_parse(int argc, char *argv[])
+ 		case ARGS_OPT_NOACTION:
+ 			conf->noaction = 1;
+ 			break;
++		case ARGS_OPT_NO_CONFIGURE:
++			conf->no_configure = 1;
++			break;
+         case ARGS_OPT_DOWNLOAD_ONLY:
+ 			conf->download_only = 1;
+ 			break;
+@@ -317,6 +322,7 @@ usage()
+ 	printf("\t--force-remove	Remove package even if prerm script fails\n");
+ 	printf("\t--force-checksum	Don't fail on checksum mismatches\n");
+ 	printf("\t--noaction		No action -- test only\n");
++	printf("\t--no-configure	No configure -- install only\n");
+ 	printf("\t--download-only	No action -- download only\n");
+ 	printf("\t--nodeps		Do not follow dependencies\n");
+ 	printf("\t--nocase		Perform case insensitive pattern matching\n");