topgrade-rs / topgrade

Upgrade all the things
GNU General Public License v3.0
1.88k stars 122 forks source link

Support for apk #370

Open m4lin opened 1 year ago

m4lin commented 1 year ago

I want to suggest a new step

Which tool is this about? Where is its repository?

https://github.com/alpinelinux/apk-tools

Which operating systems are supported by this tool?

Linux: Alpine linux (https://www.alpinelinux.org/) and ~Chimera Linux (https://chimera-linux.org/) as far as i know~, but can be installed in other distros PS Chimera is still in pre alpha hence not to be considered yet

What should Topgrade do to figure out if the tool needs to be invoked?

apk command exists apk --version

Which exact commands should Topgrade run?

apk update apk upgrade apk fix (if any error above)

thanks

SteveLauC commented 1 year ago

This was already implemented: https://github.com/topgrade-rs/topgrade/blob/14753a14e70d2931ec71eebf23f93e7060288e58/src/steps/os/linux.rs#L184-L190

Have you encountered some problems with it?

Pr0Ger commented 3 weeks ago

@SteveLauC Problem is that alpine doesn't have sudo by default and topgrade fails silently without any warning even when executed with root privileges:

log without sudo ``` alpine-vm:~# whoami root alpine-vm:~# topgrade ── 18:46:24 - System update ──────────────── ── 18:46:24 - Containers ─────────────────── ── 18:46:24 - Summary ────────────────────── Containers: OK alpine-vm:~# topgrade --verbose ... DEBUG Cannot find "doas" DEBUG Cannot find "sudo" DEBUG Cannot find "gsudo" DEBUG Cannot find "pkexec" DEBUG Cannot find "please" DEBUG Step "packer.nu" DEBUG Step "System update" ── 18:49:14 - System update ──────────────── DEBUG Detected "/sbin/apk" as "apk" DEBUG Step "config-update" ```
log with sudo ``` alpine-vm:~# apk add sudo fetch http://dl-cdn.alpinelinux.org/alpine/latest-stable/main/aarch64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/aarch64/APKINDEX.tar.gz (1/1) Installing sudo (1.9.15_p5-r0) Executing busybox-1.36.1-r29.trigger OK: 279 MiB in 119 packages alpine-vm:~# topgrade --verbose ... DEBUG Cannot find "doas" DEBUG Detected "/usr/bin/sudo" as "sudo" DEBUG Step "packer.nu" DEBUG Step "System update" ── 23:59:41 - System update ──────────────── DEBUG Detected "/sbin/apk" as "apk" DEBUG Executing command `/usr/bin/sudo /sbin/apk update` fetch http://dl-cdn.alpinelinux.org/alpine/latest-stable/main/aarch64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/latest-stable/community/aarch64/APKINDEX.tar.gz v3.20.2-83-g7d5818fe8a5 [http://dl-cdn.alpinelinux.org/alpine/latest-stable/main] v3.20.2-89-g4bb1241cadc [http://dl-cdn.alpinelinux.org/alpine/latest-stable/community] OK: 24062 distinct packages available DEBUG Executing command `/usr/bin/sudo /sbin/apk upgrade` OK: 279 MiB in 119 packages DEBUG Step "config-update" ```
SteveLauC commented 3 weeks ago

Looks like in the original feature request issue, sudo is not required: https://github.com/r-darwish/topgrade/issues/736