User:Afontain/Draft:Darkhttpd

From postmarketOS

Darkhttpd is a very simple http server. It is trivial to setup and serves static content over HTTP and nothing more. Turns out, that's exactly what we need to create an Alpine repository. Here are some tricks with that program.


Have your packages automatically upgradable

You can have your package served automatically so that an apk upgrade -U is all you need to install your home-built packages. For that to work, you need to:

initial setup

  • Add your keys to /etc/apk/keys on your phone. For that, you can use something like this:
scp /etc/apk/keys/antoine.fontaine@epfl.ch-* 172.16.42.1:~
ssh 172.16.42.1
sudo mv antoine.fontaine@epfl.ch-* /etc/apk/keys/
  • Add the repository on your phone
echo http://172.16.42.2:8080/ >>/etc/apk/repositories
# could be some other ip, and you could choose some other port


then, when you want to dev

  • Start darkhttpd started on your computer and to serve the repo. Just leave it running in a terminal somewhere
darkhttpd ~/.local/var/pmchroot/packages  # for pmbootstrap
darkhttpd ~/packages  # alternatively, for abuild
  • pmbootstrap build and apk upgrade -U a package when you want made a change
  • pmbootstrap build --force and apk fix -U pkgname to force an upgrade when you don't change the pkgrel
  • Enjoy!


An example automatic setup

on alpine

/etc/

on something else

You can probably do the same with a runit or systemd service. If you do, please share here!