0

I couldn't find any guide or documentation referring on how to add files to a custom Alpine Linux ISO, the nearest i could find is this page on the Alpine Wiki about creating a custom ISO image with mkimage

I would prefer to have my automated installation scripts and answer files directly on the ISO instead of having to download them through wget

2 Answers 2

0

Make a package containing your files and add it, like any other package in that instruction, to your image, by adding it to the apks list in your profile script.

(In the end, you're building an alpine-derived distro here. So you should use the distro-building tools that they have: APKs.)

5
  • I've tried understanding Alpine's wiki guides on how to create a package and the APKBUILD reference documentation, and even getting some simpler examples from their aports at gitlab, but all of them seem overkill for what i'm trying to do (which makes sense, as they are compiled applications), do you know a simple way to just package some static plain-text files and shell scripts and send them to /usr/local/bin? Apr 25, 2022 at 19:48
  • It is the simple way. Apr 26, 2022 at 6:31
  • What do you mean by the simple way? Apr 26, 2022 at 15:37
  • building an APK to include files in an Alpine image. It's the easy way. I don't think there's an easier way. Apr 26, 2022 at 17:01
  • I know, that's what i'm trying to do, but Alpine's documentation on that is not clear enough, and the available examples that i've found are all for compiled packages, if you could point out a package that is only composed of static files which i could use as an example, that would be helpful Apr 26, 2022 at 21:57
0

After researching for examples on Alpine Linux repositories and carefully reading the APKBUILD reference on the Alpine's official wiki, i've managed to create my own APKBUILD that simply copies two static files to /usr/bin

# Maintainer: henriquehbr <henriqueborgeshbr@gmail.com>
pkgname=alpine.sh
pkgver=0.1.0
pkgrel=1
pkgdesc="An answerfile and automated post-install script for Alpine Linux"
url="https://git.sr.ht/~henriquehbr/alpine.sh"
arch="all"
license="GPL-3.0-or-later"
source="answerfile post-install"
options="!check"

package() {
    installation_path="$pkgdir"/usr/bin
    mkdir -p "$installation_path"
    cp -f post-install "$installation_path"
    cp -f answerfile "$installation_path"
    chmod 755 "$installation_path"/post-install
}

Both the answerfile and post-install script are on the same directory of the APKBUILD

In order to build an .apk for it, it's required to generate the checksums by running:

abuild checksum

And then build it with:

abuild -r

An .apk file of your package will be created at $HOME/packages/$USER/x86_64/$pkgname-$pkgver.apk, this path might vary depending on your settings/system, and also, i used the x86_64 architecture here as an example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.