alpinelinux / alpine-chroot-install

Install Alpine Linux in chroot with a breeze. Build ARM on Travis CI or any other x86_64 CI.
MIT License
290 stars 59 forks source link

Script is tied to Ubuntu/Debian when using different arch #20

Closed whitelynx closed 3 years ago

whitelynx commented 4 years ago

From alpine-chroot-install lines 9-11:

# If qemu-user and binfmt is needed, the script checks if both are available
# and qemu-user has version >= 2.6. If not, it tries to install them using
# apt-get. Beside this the script should work on any Linux system.

This isn't exactly true; when you specify an alternate arch, the script relies on dpkg (which is part of the APT system) for comparing versions, meaning it won't function on a non-Debian-based distro like Arch unless you also install dpkg.

Installing dpkg in Arch seems to be a usable workaround; it seems that is a requirement for using this script with an alternate arch.

msrd0 commented 3 years ago

After downloading the script to $install_script, you can use the following command to make it work on ArchLinux:

test ! -e /usr/bin/vercmp || sed -E -i 's,alias cmp_versions=.*$,cmp_versions() {\n\ttest $(vercmp $1 $3) -gt 0\n}\n,g' $install_script

Perhaps the original script could do something similar, where it checks for the existence of dpkg for Debian, vercmp for ArchLinux and possible other distributions?