luci-app-opkg: fix passing wrong option on opkg update/install
authorChristian Marangi <ansuelsmth@gmail.com>
Tue, 22 Oct 2024 22:21:35 +0000 (00:21 +0200)
committerPaul Donald <newtwen+github@gmail.com>
Wed, 23 Oct 2024 22:04:46 +0000 (00:04 +0200)
Fix passing wrong option on opkg update/install. While starting to
introduce support for APK in the opkg module, it was notice that
--force-removal-of-dependent-packages was always passed even with update
and install command.

This was probably a leftover/oversight of old one. To fix this, limit
this option only on remove and also update the acl.d to support single
call to update or install.

Fixes: 9b25031cb29b ("luci-app-opkg: rework backend operations")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js
applications/luci-app-opkg/root/usr/share/rpcd/acl.d/luci-app-opkg.json

index 053d74729f151b902255b3a35553a92287f813f3..1ed27447f1b4fc46b952c001757b401f27ae88c8 100644 (file)
@@ -984,7 +984,10 @@ function handleOpkg(ev)
                                _('Waiting for the <em>opkg %h</em> command to complete…').format(cmd))
                ]);
 
-               var argv = [ cmd, '--force-removal-of-dependent-packages' ];
+               var argv = [ cmd ];
+
+               if (cmd == 'remove')
+                       argv.push('--force-removal-of-dependent-packages')
 
                if (rem && rem.checked)
                        argv.push('--autoremove');
index d6531a58e44040e18092db6954dc3108f14b0d2c..649666c26034b0b7d781e5e258fb3cbff6c8fdcc 100644 (file)
                },
                "write": {
                        "file": {
+                               "/usr/libexec/opkg-call install": [ "exec" ],
                                "/usr/libexec/opkg-call install *": [ "exec" ],
                                "/usr/libexec/opkg-call remove *": [ "exec" ],
-                               "/usr/libexec/opkg-call update *": [ "exec" ],
+                               "/usr/libexec/opkg-call update": [ "exec" ],
                                "/etc/opkg.conf": [ "write" ],
                                "/etc/opkg/*.conf": [ "write" ],
                                "/tmp/upload.ipk": [ "write" ]