diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2024-08-22 09:42:27 -0500 |
---|---|---|
committer | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2024-08-22 09:42:27 -0500 |
commit | 9562f576c22b48f180d562437701f8e5b14f83ff (patch) | |
tree | 20e6b7c0e67d4e5e51d561fa9ab13fe777053aa4 | |
parent | 9919a69180a8b2edd9368e1e5fa0ba2e80af70ae (diff) | |
download | abuild-9562f576c22b48f180d562437701f8e5b14f83ff.tar.gz abuild-9562f576c22b48f180d562437701f8e5b14f83ff.tar.bz2 abuild-9562f576c22b48f180d562437701f8e5b14f83ff.tar.xz abuild-9562f576c22b48f180d562437701f8e5b14f83ff.zip |
abuild: Add default splitpkgs for service managers
This adds splitpkg support for the dinit and systemd service managers.
-rw-r--r-- | abuild.in | 56 |
1 files changed, 55 insertions, 1 deletions
@@ -505,7 +505,7 @@ subpkg_set() { subpkgarch=${_splitarch#*:} if [ "$subpkgarch" = "$_splitarch" -o -z "$subpkgarch" ]; then case "$subpkgname" in - *-doc | *-lang | *-lang-* | *-openrc) subpkgarch="noarch" ;; + *-doc | *-lang | *-lang-* | *-openrc | *-systemd | *-dinit) subpkgarch="noarch" ;; *) subpkgarch="$pkgarch" ;; esac fi @@ -689,6 +689,16 @@ postcheck() { && ! is_openrc_pkg "$name"; then warning "Found OpenRC directory (/etc/conf.d or /etc/init.d) but name doesn't end with -openrc" fi + # look for dinit files + if [ -e "$dir"/etc/dinit.d -o -e "$dir"/lib/dinit.d -o -e "$dir"/usr/lib/dinit.d ] \ + && ! is_dinit_pkg "$name"; then + warning "Found dinit files but name doesn't end with -dinit" + fi + # look for systemd units + if [ -e "$dir"/lib/systemd -o -e "$dir"/usr/lib/systemd -o -e "$dir"/etc/systemd ] \ + && ! is_systemd_pkg "$name"; then + warning "Found systemd directory but name doesn't end with -systemd" + fi # look for /usr/share/doc if [ -e "$dir"/usr/share/doc ] \ && ! is_doc_pkg "$name"; then @@ -1113,6 +1123,16 @@ is_openrc_pkg() { test "${1%-openrc}" != "$1" } +# returns true if this is the -dinit package +is_dinit_pkg() { + test "${1%-dinit}" != "$1" +} + +# returns true if this is the -systemd package +is_systemd_pkg() { + test "${1%-systemd}" != "$1" +} + # check that noarch is set if needed archcheck() { options_has "!archcheck" && return 0 @@ -1768,6 +1788,40 @@ openrc() { default_openrc } +# predefined splitfunc systemd +default_systemd() { + pkgdesc="$pkgdesc (systemd unit files)" + install_if="systemd $pkgname=$pkgver-r$pkgrel" + for _dir in etc/systemd lib/systemd usr/lib/systemd; do + if [ -d "$pkgdir"/$_dir ]; then + mkdir -p "$subpkgdir"/$_dir + mv "$pkgdir"/$_dir/* "$subpkgdir"/$_dir/ + rmdir "$pkgdir"/$_dir + fi + done + return 0 +} + +systemd() { + default_systemd +} + +# predefined splitfunc dinit +default_dinit() { + pkgdesc="$pkgdesc (dinit scripts)" + install_if="dinit $pkgname=$pkgver-r$pkgrel" + for _dir in etc lib usr/lib; do + if [ -d "$pkgdir"/$_dir/dinit.d ]; then + mkdir -p "$subpkgdir"/$_dir + mv "$pkgdir"/$_dir/dinit.d "$subpkgdir"/$_dir/ + fi + done + return 0 +} + +dinit() { + default_dinit +} is_function() ( unset -f "$1" >/dev/null 2>&1 || true |