Skip to content

Instantly share code, notes, and snippets.

@bademux
Last active August 8, 2021 23:11
Show Gist options
  • Save bademux/b3f8e9ae7d95f51f75307118ca6eb44a to your computer and use it in GitHub Desktop.
Save bademux/b3f8e9ae7d95f51f75307118ca6eb44a to your computer and use it in GitHub Desktop.
alpine pkg that let you run installation hook, please see package()
# pkg that let you run installation hook, please see package()
# to enable it please
# 1. Run pmbootstrap init and add pmbootstrap-install-hook to custom packages
# 2. pmbootstrap newapkbuild pmbootstrap-install-hook && curl https://gist.githubusercontent.com/bademux/b3f8e9ae7d95f51f75307118ca6eb44a/raw/APKBUILD > ~/.local/var/pmbootstrap/cache_git/pmaports/main/pmbootstrap-install-hook/APKBUILD
pkgname=pmbootstrap-install-hook
pkgver=1
pkgrel=0
pkgdesc="Install dependencies and configs for headless server"
url="https://gist.github.com/bademux/b3f8e9ae7d95f51f75307118ca6eb44a"
arch="all"
license="MIT"
depends="wireless-tools wpa_supplicant iw"
install="$pkgname.pre-install"
options="!archcheck !check !strip !tracedeps !dbg"
sanitycheck() {
:
}
package() {
#uncomment and replace SSID_NAME PASSWORD to autoconnect to wifi
mkdir -p "$pkgdir"
tee "$startdir/$pkgname.pre-install" <<EOF
#!/bin/sh
#wpa_passphrase SSID_NAME PASSWORD > /etc/wpa_supplicant/wpa_supplicant.conf
echo 'wpa_supplicant_if="wlan0"' >> /etc/conf.d/wpa_supplicant
tee "/etc/network/interfaces" <<EOFI
auto eth0
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet dhcp
EOFI
rc-update add wpa_supplicant default
rc-update add wpa_cli default
rc-update add udhcpd default
EOF
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment