One more suggestion:
remove the indentation from the lines in the Makefile prerm / postrm / postinst definitions. At least from the shebang line...
(Most of those function definitions in the source repo are without indentation)
Might be similar as with conffiles, that definitions should be done without indentation.
This did the trick. That said, I don't think the core issue is in the Makefile because same makefile with same postrm works fine with ipk. So first, IMO it's a regression. And second, probably the issue is either with the apk code or with the way package data is handed over to it.
Edit: I can file a Github issue if it's necessary.
You might file a GitHub issue, as the issue likely affects also the other (few) packages that have defined those sections with indentations (e.g. pbr from @stangri)
I would guess that the wrong script content handling mostly affects the shebang line, as other lines in a shell script can be indented in any case.
@robimarko did work on those package inst scripts with apk in November, so he mihgt have views on this.
Yeah, good eye, that's almost certainly it. I did a PR that strips leading blanks from those makefile sections, so it should fix issues without need to mess with the packages' makefiles. https://github.com/openwrt/openwrt/pull/17440
Thanks for the tag, I've updated all the Makefiles to ensure shebangs in the postinst/prerm scripts have no indentation, will be creating PRs for snapshots shortly.
i'm navigating apk, and most package manipulation and customizing things work for me. but im stuck on a basic step of replacing the apk-mbedtls binary wiht the apk-openssl version
what are the steps to move from mbedtls to openssl in the apk system?
on a vanilla snapshot build, the default apk is apk-mbedtls
i can successfully apk update, but
apk add apk-openssl yields this:
root@ap253:~# apk add apk-openssl
(1/2) Installing libopenssl3 (3.0.15-r1)
Executing libopenssl3-3.0.15-r1.post-install
(2/2) Installing apk-openssl (3.0.0_pre20241130-r2)
ERROR: apk-openssl-3.0.0_pre20241130-r2: trying to overwrite etc/apk/repositories.d/customfeeds.list owned by apk-mbedtls-3.0.0_pre20241130-r2.
ERROR: apk-openssl-3.0.0_pre20241130-r2: trying to overwrite usr/bin/apk owned by apk-mbedtls-3.0.0_pre20241130-r2.
Executing apk-openssl-3.0.0_pre20241130-r2.post-install
1 error; 42 MiB in 211 packages
if i apk delete apk-mbedtls, then there is no binary for apk.
thx
Yeah, these catch-22 situations are a pain. A scratch build using firmware selector will get you there, just change the package list and create a whole new image, but if you want to be adventurous...
You could try editing /etc/apk/world, change apk-mbedtls to apk-openssl, delete any references to mbedtls package (libmbedtls21? others?), then run apk fix and see what it does. Report back, I'm curious.
How about apk add --force-overwrite apk-openssl to allow overwriting ????
(quite similar as with opkg)
See apk add help:
root@router6000:~# apk add -h
apk-tools 3.0.0_pre20241130, compiled for aarch64.
usage: apk add [<OPTIONS>...] CONSTRAINTS...
Description:
apk add adds or updates given constraints to WORLD (see world) and commit
changes to disk. This usually involves installing new packages, but may also
cause other changes to the installed packages.
Global options:
-h, --help Print the list of all commands with descriptions
-f, --force Enable selected --force-* options (deprecated)
-i, --interactive Ask confirmation before performing certain
operations
-p, --root ROOT Manage file system at ROOT
-q, --quiet Print less information
-U, --update-cache Alias for '--cache-max-age 1'
-v, --verbose Print more information (can be specified twice)
-V, --version Print program version and exit
-X, --repository REPO
Specify additional package repository
--allow-untrusted Install packages with untrusted signature or no
signature
--arch ARCH Temporarily override architectures
--cache-dir CACHEDIR Temporarily override the cache directory
--cache-max-age AGE Maximum AGE (in minutes) for index in cache before
it's refreshed
--force-binary-stdout
Continue even if binary data will be printed to the
terminal
--force-broken-world DANGEROUS: Delete world constraints until a solution
without conflicts is found
--force-missing-repositories
Continue even if some of the repository indexes are
not available
--force-no-chroot Disable chroot for scripts
--force-non-repository
Continue even if packages may be lost on reboot
--force-old-apk Continue even if packages use unsupported features
--force-overwrite Overwrite files in other packages
--force-refresh Do not use cached files (local or from proxy)
--keys-dir KEYSDIR Override directory of trusted keys
--no-cache Do not use any local cache path
--no-check-certificate
Do not validate the HTTPS server certificates
--no-interactive Disable interactive mode
...
this problem arose because firmware-selector is not yet functional for the mx4300. so only the prebuilt image was available. once firmware selctor catches up, the immediate problem goes away, but i'm still curious about how to do this.
the apk add --force-overwrite errorred amd the apk command still pointed to apk-mbedtls. when i removed mbedtls, the apk command yielded 'ash: apk: not found.'
edit -
now - 18 hours later and after apk update, the fore-overwrite option succeeds. but i have not completely elimated mbedtls due to other binaries. i'm
not sure what the problem was before, an di'll report back with another attempt
from a skelton mbedtls build
owut - OpenWrt Upgrade Tool 2024.12.10~e38844ae-r1 (/usr/bin/owut)
ERROR: ubus: Not found: Failed to invoke function 'packagelist' on object 'rpc-sys'
from: 'ubus call rpc-sys packagelist { "all": true }'
This is a bug in 'owut/2024.12.10~e38844ae-r1', please report at
https://github.com/efahl/owut/issues
In [anonymous function](), file /usr/bin/owut, line 103, byte 24:
called from function [anonymous function] (/usr/bin/owut:245:58)
called from function [anonymous function] (/usr/bin/owut:250:74)
called from function collect_packages (/usr/bin/owut:981:67)
called from function collect_all (/usr/bin/owut:1373:19)
called from anonymous function (/usr/bin/owut:2065:15)
` ` ${issue_url}\n`);`
Near here -------------------^
That is symptomatic of a broken installation, specifically the ucode-mod-ubus package is not installed. It is a hard dependency of owut and should have been installed as part of the owut installation.
That probably reinstalled owut and its dependencies, fixing the issue.