Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d5d9cba73 | ||
|
|
a6afa01456 | ||
|
|
b305a092f4 | ||
|
|
4dd3a688cd | ||
|
|
8976287ba9 | ||
|
|
22e587b8c4 | ||
|
|
e95c5509b0 |
No files matched your search
@@ -1,66 +0,0 @@
|
||||
From 0bda547b2d7694ab40e0237ea6ae8a25a237ee50 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Pablo=20Correa=20G=C3=B3mez?= <ablocorrea@hotmail.com>
|
||||
Date: Thu, 11 Apr 2024 13:57:26 +0200
|
||||
Subject: [PATCH 1/2] abuild: add systemd splitfunc
|
||||
|
||||
Co-authored-by: Caleb Connolly <caleb@postmarketos.org>
|
||||
---
|
||||
abuild.in | 28 ++++++++++++++++++++++++++++
|
||||
1 file changed, 28 insertions(+)
|
||||
|
||||
diff --git a/abuild.in b/abuild.in
|
||||
index 36317d6..74e47f1 100644
|
||||
--- a/abuild.in
|
||||
+++ b/abuild.in
|
||||
@@ -815,6 +815,11 @@ 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 /usr/lib/systemd
|
||||
+ if [ -e "$dir"/usr/lib/systemd ] \
|
||||
+ && ! is_systemd_pkg "$name"; then
|
||||
+ warning "Found systemd directory (/usr/lib/systemd) but it's not in a systemd package"
|
||||
+ fi
|
||||
# look for /usr/share/doc
|
||||
if [ -e "$dir"/usr/share/doc ] \
|
||||
&& ! is_doc_pkg "$name"; then
|
||||
@@ -1371,6 +1376,11 @@ is_openrc_pkg() {
|
||||
test "${1%-openrc}" != "$1"
|
||||
}
|
||||
|
||||
+# returns true if this is the -systemd package
|
||||
+is_systemd_pkg() {
|
||||
+ test "${1%-systemd}" != "$1" || test "systemd" == "$1"
|
||||
+}
|
||||
+
|
||||
# returns true if this is the -bash-completion package
|
||||
is_bashcomp_pkg() {
|
||||
test "${1%-bash-completion}" != "$1"
|
||||
@@ -2143,6 +2153,24 @@ openrc() {
|
||||
default_openrc
|
||||
}
|
||||
|
||||
+# predefined splitfunc systemd
|
||||
+default_systemd() {
|
||||
+ depends="$depends_systemd"
|
||||
+ pkgdesc="$pkgdesc (systemd files)"
|
||||
+ install_if="systemd ${subpkgname%-systemd}=$pkgver-r$pkgrel"
|
||||
+
|
||||
+ if [ -d lib/systemd ]; then
|
||||
+ error "Detected /lib/systemd dir, should be installed to /usr/lib/systemd"
|
||||
+ return 1
|
||||
+ fi
|
||||
+
|
||||
+ amove usr/lib/systemd
|
||||
+}
|
||||
+
|
||||
+systemd() {
|
||||
+ default_systemd
|
||||
+}
|
||||
+
|
||||
default_devhelp() {
|
||||
depends=""
|
||||
pkgdesc="$pkgname - devhelp files"
|
||||
--
|
||||
2.45.2
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
From df135fd1a709ea27cb36d60f7d992e10170ed838 Mon Sep 17 00:00:00 2001
|
||||
From: Clayton Craft <clayton@craftyguy.net>
|
||||
Date: Fri, 17 Jan 2025 08:43:57 -0800
|
||||
Subject: [PATCH 1/4] prepare_metafiles: install scripts in controldir checking
|
||||
deps
|
||||
|
||||
A future patch will make it possible that some scripts are generated
|
||||
when they are "installed" to the controldir, and in this case they will
|
||||
not exist yet when script dependencies are checked and added to the
|
||||
package. By "installing" the scripts sooner, the dependencies for these
|
||||
generated scripts can be accounted for.
|
||||
---
|
||||
abuild.in | 29 +++++++++++++++--------------
|
||||
1 file changed, 15 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/abuild.in b/abuild.in
|
||||
index b834e73..83439c5 100644
|
||||
--- a/abuild.in
|
||||
+++ b/abuild.in
|
||||
@@ -1118,6 +1118,20 @@ prepare_metafiles() {
|
||||
mkdir -p "$controldir"
|
||||
local builddate="$SOURCE_DATE_EPOCH"
|
||||
|
||||
+ local metafiles=".PKGINFO"
|
||||
+ for i in $install $triggers; do
|
||||
+ local f=${i%=*}
|
||||
+ local n=${f%.*}
|
||||
+ if [ "$n" != "$name" ]; then
|
||||
+ continue
|
||||
+ fi
|
||||
+ script=${f#$name}
|
||||
+ msg "Adding $script"
|
||||
+ cp "$startdir/$f" "$controldir/$script" || return 1
|
||||
+ chmod +x "$controldir/$script"
|
||||
+ metafiles="$metafiles $script"
|
||||
+ done
|
||||
+
|
||||
# Fix package size on several filesystems
|
||||
case "$(stat -f -c "%T" .)" in
|
||||
btrfs|ecryptfs|zfs)
|
||||
@@ -1176,7 +1190,7 @@ prepare_metafiles() {
|
||||
for i in $install $triggers; do
|
||||
local s=${i%=*}
|
||||
[ "$name" != "${s%.*}" ] && continue
|
||||
- if head -n 1 "$startdir/$s" | grep -E '^#!\s*/bin/sh' >/dev/null ; then
|
||||
+ if head -n 1 "$controldir/$s" | grep -E '^#!\s*/bin/sh' >/dev/null ; then
|
||||
msg "Script found. /bin/sh added as a dependency for $pkg"
|
||||
deps="$deps /bin/sh"
|
||||
break
|
||||
@@ -1227,19 +1241,6 @@ prepare_metafiles() {
|
||||
echo "install_if = $(echo $install_if)" >> "$pkginfo"
|
||||
fi
|
||||
|
||||
- local metafiles=".PKGINFO"
|
||||
- for i in $install $triggers; do
|
||||
- local f=${i%=*}
|
||||
- local n=${f%.*}
|
||||
- if [ "$n" != "$name" ]; then
|
||||
- continue
|
||||
- fi
|
||||
- script=${f#$name}
|
||||
- msg "Adding $script"
|
||||
- cp "$startdir/$f" "$controldir/$script" || return 1
|
||||
- chmod +x "$controldir/$script"
|
||||
- metafiles="$metafiles $script"
|
||||
- done
|
||||
printf %s "$metafiles" | tr ' ' '\0' > "$controldir"/.metafiles
|
||||
}
|
||||
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
From 4aecd931f4b911211194c3018d029330d6aed38e Mon Sep 17 00:00:00 2001
|
||||
From: Clayton Craft <clayton@craftyguy.net>
|
||||
Date: Tue, 21 Jan 2025 11:50:06 -0800
|
||||
Subject: [PATCH 2/4] tests: add tests for systemd splitfunc
|
||||
|
||||
---
|
||||
tests/abuild_systemdsplit_test | 110 ++++++++++++++++++
|
||||
.../systemd_existing_install_scripts/APKBUILD | 32 +++++
|
||||
...sting-install-scripts-systemd.post-install | 1 +
|
||||
...isting-install-scripts-systemd.pre-install | 1 +
|
||||
.../systemd_no_install_scripts/APKBUILD | 27 +++++
|
||||
tests/testrepo/systemd_pkg/APKBUILD | 24 ++++
|
||||
6 files changed, 195 insertions(+)
|
||||
create mode 100755 tests/abuild_systemdsplit_test
|
||||
create mode 100644 tests/testrepo/systemd_existing_install_scripts/APKBUILD
|
||||
create mode 100644 tests/testrepo/systemd_existing_install_scripts/sd-existing-install-scripts-systemd.post-install
|
||||
create mode 100644 tests/testrepo/systemd_existing_install_scripts/sd-existing-install-scripts-systemd.pre-install
|
||||
create mode 100644 tests/testrepo/systemd_no_install_scripts/APKBUILD
|
||||
create mode 100644 tests/testrepo/systemd_pkg/APKBUILD
|
||||
|
||||
diff --git a/tests/abuild_systemdsplit_test b/tests/abuild_systemdsplit_test
|
||||
new file mode 100755
|
||||
index 0000000..2a9f1cb
|
||||
--- /dev/null
|
||||
+++ b/tests/abuild_systemdsplit_test
|
||||
@@ -0,0 +1,110 @@
|
||||
+#!/usr/bin/env atf-sh
|
||||
+
|
||||
+. $(atf_get_srcdir)/test_env.sh
|
||||
+init_tests \
|
||||
+ abuild_systemdsplit_pkg \
|
||||
+ abuild_systemdsplit_no_install_scripts \
|
||||
+ abuild_systemdsplit_existing_install_scripts
|
||||
+
|
||||
+testrepo=$(atf_get_srcdir)/testrepo
|
||||
+
|
||||
+export ABUILD_SHAREDIR=$(atf_get_srcdir)/..
|
||||
+export ABUILD_CONF=/dev/null
|
||||
+export ABUILD_APK_INDEX_OPTS="--allow-untrusted"
|
||||
+export REPODEST="$PWD"/packages
|
||||
+
|
||||
+init_keys() {
|
||||
+ cp -ra "$(atf_get_srcdir)"/testdata/.abuild "$PWD"
|
||||
+}
|
||||
+
|
||||
+abuild_systemdsplit_pkg_body() {
|
||||
+ init_keys
|
||||
+ cp -ra "$testrepo" .
|
||||
+ cd testrepo/systemd_pkg
|
||||
+
|
||||
+ atf_check -s exit:0 -o ignore \
|
||||
+ -e not-match:"WARNING" \
|
||||
+ -e not-match:"fatal" \
|
||||
+ -e match:"Running split function systemd" \
|
||||
+ abuild
|
||||
+
|
||||
+ arch=$(abuild -A)
|
||||
+ tar -zxf "$REPODEST"/testrepo/$arch/sd-pkg-systemd-1.0-r0.apk
|
||||
+
|
||||
+ if [ ! -f usr/lib/systemd/system/foo.service ]; then
|
||||
+ atf_fail "usr/lib/systemd/system/*.service should exist"
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+abuild_systemdsplit_no_install_scripts_body() {
|
||||
+ init_keys
|
||||
+ cp -ra "$testrepo" .
|
||||
+ cd testrepo/systemd_no_install_scripts
|
||||
+
|
||||
+ atf_check -s exit:0 -o ignore \
|
||||
+ -e not-match:"WARNING" \
|
||||
+ -e not-match:"fatal" \
|
||||
+ -e match:"Adding .post-install" \
|
||||
+ -e match:"Adding .pre-deinstall" \
|
||||
+ abuild
|
||||
+
|
||||
+ arch=$(abuild -A)
|
||||
+ tar -zxf "$REPODEST"/testrepo/$arch/sd-no-install-scripts-systemd-1.0-r0.apk
|
||||
+
|
||||
+ # post-install
|
||||
+ if [ ! -f .post-install ]; then
|
||||
+ atf_fail ".post-install script should exist"
|
||||
+ fi
|
||||
+ if ! grep -Eq "systemd_service_post_install system.*foo.service" .post-install; then
|
||||
+ atf_fail ".post-install script missing preset logic"
|
||||
+ fi
|
||||
+
|
||||
+ # pre-deinstall
|
||||
+ if [ ! -f .pre-deinstall ]; then
|
||||
+ atf_fail ".pre-deinstall script should exist"
|
||||
+ fi
|
||||
+ if ! grep -Eq "systemd_service_pre_deinstall system.*foo.service" .pre-deinstall; then
|
||||
+ atf_fail ".pre-deinstall script missing preset logic"
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+abuild_systemdsplit_existing_install_scripts_body() {
|
||||
+ init_keys
|
||||
+ cp -ra "$testrepo" .
|
||||
+ cd testrepo/systemd_existing_install_scripts
|
||||
+
|
||||
+ atf_check -s exit:0 -o ignore \
|
||||
+ -e not-match:"WARNING" \
|
||||
+ -e not-match:"fatal" \
|
||||
+ -e match:"Adding .pre-install" \
|
||||
+ -e match:"Adding .post-install" \
|
||||
+ -e match:"Adding .pre-deinstall" \
|
||||
+ abuild
|
||||
+
|
||||
+ arch=$(abuild -A)
|
||||
+ tar -zxf "$REPODEST"/testrepo/$arch/sd-existing-install-scripts-systemd-1.0-r0.apk
|
||||
+
|
||||
+ # post-install
|
||||
+ if [ ! -f .post-install ]; then
|
||||
+ atf_fail ".post-install script should exist"
|
||||
+ fi
|
||||
+ if ! grep -Eq "systemd_service_post_install system.*foo.service" .post-install; then
|
||||
+ atf_fail ".post-install script missing preset logic"
|
||||
+ fi
|
||||
+ if ! grep -Eq "# DO NOT OVERWRITE" .post-install; then
|
||||
+ atf_fail ".post-install was overwritten by the preset logic"
|
||||
+ fi
|
||||
+
|
||||
+ # pre-deinstall
|
||||
+ if [ ! -f .pre-deinstall ]; then
|
||||
+ atf_fail ".pre-deinstall script should exist"
|
||||
+ fi
|
||||
+ if ! grep -Eq "systemd_service_pre_deinstall system.*foo.service" .pre-deinstall; then
|
||||
+ atf_fail ".pre-deinstall script missing preset logic"
|
||||
+ fi
|
||||
+
|
||||
+ # pre-install
|
||||
+ if ! grep -Eq "# THIS SHOULD EXIST" .pre-install; then
|
||||
+ atf_fail ".pre-install script was overwritten"
|
||||
+ fi
|
||||
+}
|
||||
diff --git a/tests/testrepo/systemd_existing_install_scripts/APKBUILD b/tests/testrepo/systemd_existing_install_scripts/APKBUILD
|
||||
new file mode 100644
|
||||
index 0000000..0f15530
|
||||
--- /dev/null
|
||||
+++ b/tests/testrepo/systemd_existing_install_scripts/APKBUILD
|
||||
@@ -0,0 +1,32 @@
|
||||
+# Maintainer: postmarketOS <team@postmarketos.org>
|
||||
+pkgname="sd-existing-install-scripts"
|
||||
+pkgver="1.0"
|
||||
+pkgrel=0
|
||||
+pkgdesc="Dummy test package w/ systemd ([Install] section in service and custom install script)"
|
||||
+url="https://gitlab.alpinelinux.org/alpine/aports"
|
||||
+arch="noarch"
|
||||
+license="MIT"
|
||||
+subpackages="$pkgname-systemd"
|
||||
+source=""
|
||||
+builddir="$srcdir/pkg1-1.0"
|
||||
+options="!check"
|
||||
+
|
||||
+prepare() {
|
||||
+ mkdir -p "$builddir"
|
||||
+}
|
||||
+
|
||||
+package() {
|
||||
+ mkdir -p "$pkgdir/usr/lib/systemd/system"
|
||||
+ cat <<-EOF > "$pkgdir/usr/lib/systemd/system/foo.service"
|
||||
+ [Service]
|
||||
+ ExecStart=/usr/bin/foo
|
||||
+
|
||||
+ [Install]
|
||||
+ Wanted-by=default.target
|
||||
+ EOF
|
||||
+}
|
||||
+
|
||||
+systemd() {
|
||||
+ default_systemd
|
||||
+ install="$install $subpkgname.pre-install"
|
||||
+}
|
||||
diff --git a/tests/testrepo/systemd_existing_install_scripts/sd-existing-install-scripts-systemd.post-install b/tests/testrepo/systemd_existing_install_scripts/sd-existing-install-scripts-systemd.post-install
|
||||
new file mode 100644
|
||||
index 0000000..2931eeb
|
||||
--- /dev/null
|
||||
+++ b/tests/testrepo/systemd_existing_install_scripts/sd-existing-install-scripts-systemd.post-install
|
||||
@@ -0,0 +1 @@
|
||||
+# DO NOT OVERWRITE
|
||||
diff --git a/tests/testrepo/systemd_existing_install_scripts/sd-existing-install-scripts-systemd.pre-install b/tests/testrepo/systemd_existing_install_scripts/sd-existing-install-scripts-systemd.pre-install
|
||||
new file mode 100644
|
||||
index 0000000..9e66ed7
|
||||
--- /dev/null
|
||||
+++ b/tests/testrepo/systemd_existing_install_scripts/sd-existing-install-scripts-systemd.pre-install
|
||||
@@ -0,0 +1 @@
|
||||
+# THIS SHOULD EXIST
|
||||
diff --git a/tests/testrepo/systemd_no_install_scripts/APKBUILD b/tests/testrepo/systemd_no_install_scripts/APKBUILD
|
||||
new file mode 100644
|
||||
index 0000000..6af4652
|
||||
--- /dev/null
|
||||
+++ b/tests/testrepo/systemd_no_install_scripts/APKBUILD
|
||||
@@ -0,0 +1,27 @@
|
||||
+# Maintainer: postmarketOS <team@postmarketos.org>
|
||||
+pkgname="sd-no-install-scripts"
|
||||
+pkgver="1.0"
|
||||
+pkgrel=0
|
||||
+pkgdesc="Dummy test package w/ systemd support ([Install] section in service)"
|
||||
+url="https://gitlab.alpinelinux.org/alpine/aports"
|
||||
+arch="noarch"
|
||||
+license="MIT"
|
||||
+subpackages="$pkgname-systemd"
|
||||
+source=""
|
||||
+builddir="$srcdir/pkg1-1.0"
|
||||
+options="!check"
|
||||
+
|
||||
+prepare() {
|
||||
+ mkdir -p "$builddir"
|
||||
+}
|
||||
+
|
||||
+package() {
|
||||
+ mkdir -p "$pkgdir/usr/lib/systemd/system"
|
||||
+ cat <<-EOF > "$pkgdir/usr/lib/systemd/system/foo.service"
|
||||
+ [Service]
|
||||
+ ExecStart=/usr/bin/foo
|
||||
+
|
||||
+ [Install]
|
||||
+ Wanted-by=default.target
|
||||
+ EOF
|
||||
+}
|
||||
diff --git a/tests/testrepo/systemd_pkg/APKBUILD b/tests/testrepo/systemd_pkg/APKBUILD
|
||||
new file mode 100644
|
||||
index 0000000..a5446a9
|
||||
--- /dev/null
|
||||
+++ b/tests/testrepo/systemd_pkg/APKBUILD
|
||||
@@ -0,0 +1,24 @@
|
||||
+# Maintainer: postmarketOS <team@postmarketos.org>
|
||||
+pkgname="sd-pkg"
|
||||
+pkgver="1.0"
|
||||
+pkgrel=0
|
||||
+pkgdesc="Dummy test package w/ systemd (no [Install] section in service)"
|
||||
+url="https://gitlab.alpinelinux.org/alpine/aports"
|
||||
+arch="noarch"
|
||||
+license="MIT"
|
||||
+subpackages="$pkgname-systemd"
|
||||
+source=""
|
||||
+builddir="$srcdir/pkg1-1.0"
|
||||
+options="!check"
|
||||
+
|
||||
+prepare() {
|
||||
+ mkdir -p "$builddir"
|
||||
+}
|
||||
+
|
||||
+package() {
|
||||
+ mkdir -p "$pkgdir/usr/lib/systemd/system"
|
||||
+ cat <<-EOF > "$pkgdir/usr/lib/systemd/system/foo.service"
|
||||
+ [Service]
|
||||
+ ExecStart=/usr/bin/foo
|
||||
+ EOF
|
||||
+}
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
From cb613d0d1a9dbb687fef3cf0c78adb367ef35188 Mon Sep 17 00:00:00 2001
|
||||
From: Clayton Craft <clayton@craftyguy.net>
|
||||
Date: Tue, 21 Jan 2025 11:50:43 -0800
|
||||
Subject: [PATCH 3/4] abuild: add systemd splitfunc
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This adds support for splitting systemd-related stuff into a -systemd
|
||||
subpkg, and installing it by default ***only*** when systemd is
|
||||
installed.
|
||||
|
||||
There's a bit more logic in default_systemd than "normal" because we
|
||||
want to use systemd "presets" downstream to configure services to start
|
||||
by default. Using this feature requires running `systemctl preset`
|
||||
at install time (only!) and cleaning up on de-install, so two install
|
||||
scripts are generated by default when default_systemd detects it is
|
||||
packaging sytemd unit files that *could* have presets configured for
|
||||
them. It's the responsibility of downstream distros and/or users to
|
||||
provide presets for stuff, abuild is only including the machinery to
|
||||
*apply* those presets at an appropriate time.
|
||||
|
||||
The approach here is very similar to what Fedora and Debian (and
|
||||
probably others) do.
|
||||
|
||||
The install scripts depend on a macro file to implement the actual
|
||||
logic that calls `systemctl preset` the appropriate way for system vs
|
||||
user session. The idea is that downstream distros that support systemd
|
||||
can provide this macro. Or it can be included in aports, or rolled into
|
||||
abuild (but will make the install scripts a bit longer)
|
||||
|
||||
Co-authored-by: Caleb Connolly <caleb@postmarketos.org>
|
||||
Co-authored-by: jane400 <pmos@j4ne.de>
|
||||
Co-authored-by: Oliver Smith <ollieparanoid@postmarketos.org>
|
||||
Co-authored-by: Pablo Correa Gómez <ablocorrea@hotmail.com>
|
||||
---
|
||||
abuild.in | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 110 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/abuild.in b/abuild.in
|
||||
index 83439c5..937c3e9 100644
|
||||
--- a/abuild.in
|
||||
+++ b/abuild.in
|
||||
@@ -833,6 +833,11 @@ 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 /usr/lib/systemd
|
||||
+ if [ -e "$dir"/usr/lib/systemd ] \
|
||||
+ && ! is_systemd_pkg "$name"; then
|
||||
+ warning "Found systemd directory (/usr/lib/systemd) but name doesn't end with -systemd"
|
||||
+ fi
|
||||
# look for /usr/share/doc
|
||||
if [ -e "$dir"/usr/share/doc ] \
|
||||
&& ! is_doc_pkg "$name"; then
|
||||
@@ -1105,6 +1110,53 @@ check_depver() {
|
||||
return 1
|
||||
}
|
||||
|
||||
+prepare_systemd_install_script() {
|
||||
+ # Generate install scripts for applying presets if the systemd subpkg has
|
||||
+ # installable unit files. If existing install scripts are found in the pkg, then
|
||||
+ # merge them.
|
||||
+
|
||||
+ local file="$1"
|
||||
+ local script="$2"
|
||||
+ if [ -f "$file" ]; then
|
||||
+ cp "$file" "$controldir/$script" || return 1
|
||||
+ else
|
||||
+ touch "$controldir/$script"
|
||||
+ fi
|
||||
+
|
||||
+ # convert e.g. ".post-install" --> "post_install"
|
||||
+ local type="${script:1}"
|
||||
+ type="${type//-/_}"
|
||||
+
|
||||
+ # Generate/add logic for applying preset(s) to the install script
|
||||
+ if [ -n "$systemd_system_units" ] || [ -n "$systemd_user_units" ]; then
|
||||
+ cat <<-EOF >> "$controldir/$script.header"
|
||||
+ #!/bin/sh -e
|
||||
+
|
||||
+ ### auto-generated systemd preset configuration start ###
|
||||
+ trap "systemd_configure_presets" EXIT
|
||||
+ _systemd_configure_presets_did_run=false
|
||||
+
|
||||
+ systemd_configure_presets() {
|
||||
+ [[ "$_systemd_configure_presets_did_run" ]] && return
|
||||
+ if [ ! -f /usr/lib/systemd/systemd-apk-macros.sh ]; then
|
||||
+ echo "WARNING: unable to apply presets, missing systemd-apk-macros.sh"
|
||||
+ exit 0
|
||||
+ fi
|
||||
+ . /usr/lib/systemd/systemd-apk-macros.sh
|
||||
+
|
||||
+ [ -n "$systemd_user_units" ] && systemd_service_$type user $systemd_user_units
|
||||
+ [ -n "$systemd_system_units" ] && systemd_service_$type system $systemd_system_units
|
||||
+
|
||||
+ _systemd_configure_presets_did_run=true
|
||||
+ }
|
||||
+ ### auto-generated systemd preset configuration end ###
|
||||
+ EOF
|
||||
+
|
||||
+ cat "$controldir/$script.header" "$controldir/$script" > "$controldir/$script.tmp"
|
||||
+ mv "$controldir/$script.tmp" "$controldir/$script"
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
prepare_metafiles() {
|
||||
local name=${subpkgname:-$pkgname}
|
||||
[ -z "${name##* *}" ] && die "package name contains spaces"
|
||||
@@ -1127,7 +1179,15 @@ prepare_metafiles() {
|
||||
fi
|
||||
script=${f#$name}
|
||||
msg "Adding $script"
|
||||
- cp "$startdir/$f" "$controldir/$script" || return 1
|
||||
+ if is_systemd_pkg "$name"; then
|
||||
+ # special handling for certain install scripts
|
||||
+ case "$script" in
|
||||
+ .post-install|.pre-deinstall) prepare_systemd_install_script "$startdir/$f" "$script";;
|
||||
+ *) cp "$startdir/$f" "$controldir/$script" || return 1 ;;
|
||||
+ esac
|
||||
+ else
|
||||
+ cp "$startdir/$f" "$controldir/$script" || return 1
|
||||
+ fi
|
||||
chmod +x "$controldir/$script"
|
||||
metafiles="$metafiles $script"
|
||||
done
|
||||
@@ -1400,6 +1460,13 @@ is_openrc_pkg() {
|
||||
test "${1%-openrc}" != "$1"
|
||||
}
|
||||
|
||||
+# returns true if this is the -systemd package
|
||||
+is_systemd_pkg() {
|
||||
+ # NOTE: remove ' || test "systemd" == "$1"' before upstreaming to Alpine
|
||||
+ # NOTE: pma!6055 needs to be merged before removing this
|
||||
+ test "${1%-systemd}" != "$1" || test "systemd" == "$1"
|
||||
+}
|
||||
+
|
||||
# check that noarch is set if needed
|
||||
archcheck() {
|
||||
options_has "!archcheck" && return 0
|
||||
@@ -2133,6 +2200,48 @@ openrc() {
|
||||
default_openrc
|
||||
}
|
||||
|
||||
+# predefined splitfunc systemd
|
||||
+default_systemd() {
|
||||
+ depends="$depends_systemd"
|
||||
+ pkgdesc="$pkgdesc (systemd files)"
|
||||
+ install_if="systemd ${subpkgname%-systemd}=$pkgver-r$pkgrel"
|
||||
+
|
||||
+ if [ -d lib/systemd ]; then
|
||||
+ error "Detected /lib/systemd dir, should be installed to /usr/lib/systemd"
|
||||
+ return 1
|
||||
+ fi
|
||||
+
|
||||
+ amove usr/lib/systemd
|
||||
+
|
||||
+ # Find user and system unit files, for use later when generating install scripts
|
||||
+ # that apply presets
|
||||
+ systemd_user_units=""
|
||||
+ if [ -d "$subpkgdir/usr/lib/systemd/user" ]; then
|
||||
+ for file in $(find "$subpkgdir/usr/lib/systemd/user" -type f); do
|
||||
+ # Only units with [Install] section
|
||||
+ grep -q "\[Install\]" "$file" || continue
|
||||
+ systemd_user_units="$systemd_user_units $(basename "$file") "
|
||||
+ done
|
||||
+ fi
|
||||
+ systemd_system_units=""
|
||||
+ if [ -d "$subpkgdir/usr/lib/systemd/system" ]; then
|
||||
+ for file in $(find "$subpkgdir/usr/lib/systemd/system" -type f); do
|
||||
+ # Only units with [Install] section
|
||||
+ grep -q "\[Install\]" "$file" || continue
|
||||
+ systemd_system_units="$systemd_system_units $(basename "$file") "
|
||||
+ done
|
||||
+ fi
|
||||
+ if [ -n "$systemd_system_units" ] || [ -n "$systemd_user_units" ]; then
|
||||
+ # These install scripts will be created in prepare_systemd_install_script later,
|
||||
+ # or merged with any existing install script(s) if exists
|
||||
+ install="$subpkgname.post-install $subpkgname.pre-deinstall"
|
||||
+ fi
|
||||
+}
|
||||
+
|
||||
+systemd() {
|
||||
+ default_systemd
|
||||
+}
|
||||
+
|
||||
default_devhelp() {
|
||||
depends=""
|
||||
pkgdesc="$pkgname - devhelp files"
|
||||
--
|
||||
2.48.1
|
||||
|
||||
+9
-9
@@ -1,7 +1,7 @@
|
||||
From d27596cd67928e4795dc99dbc139b231354c3381 Mon Sep 17 00:00:00 2001
|
||||
From 3b8ae546bc9f7e911f9dce04f219c621d6220baf Mon Sep 17 00:00:00 2001
|
||||
From: Clayton Craft <clayton@craftyguy.net>
|
||||
Date: Fri, 5 Jul 2024 10:38:50 -0700
|
||||
Subject: [PATCH 2/2] abuild: add warning in -systemd split func about
|
||||
Subject: [PATCH 4/4] abuild: add warning in -systemd split func about
|
||||
non-usr-merged birs
|
||||
|
||||
---
|
||||
@@ -9,20 +9,20 @@ Subject: [PATCH 2/2] abuild: add warning in -systemd split func about
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/abuild.in b/abuild.in
|
||||
index 74e47f1..e5f9be0 100644
|
||||
index 937c3e9..e0a4e63 100644
|
||||
--- a/abuild.in
|
||||
+++ b/abuild.in
|
||||
@@ -2165,6 +2165,10 @@ default_systemd() {
|
||||
@@ -2211,6 +2211,10 @@ default_systemd() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
amove usr/lib/systemd
|
||||
+
|
||||
+ if [ -d bin ] || [ -d lib ] || [ -d usr/sbin ]; then
|
||||
+ warning "Files should be installed to /usr/bin or /usr/lib, not /bin, /lib, or /usr/sbin"
|
||||
+ fi
|
||||
}
|
||||
+
|
||||
amove usr/lib/systemd
|
||||
|
||||
systemd() {
|
||||
# Find user and system unit files, for use later when generating install scripts
|
||||
--
|
||||
2.45.2
|
||||
2.48.1
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
# APKBUILDs at once.
|
||||
|
||||
pkgname=abuild
|
||||
pkgver=99993.12.0
|
||||
_pkgver=3.12.0
|
||||
pkgrel=4
|
||||
pkgver=99993.14.1
|
||||
_pkgver=3.14.1
|
||||
pkgrel=0
|
||||
pkgdesc="Script to build Alpine Packages"
|
||||
url="https://git.alpinelinux.org/cgit/abuild/"
|
||||
arch="all"
|
||||
@@ -27,8 +27,10 @@ options="suid !check" # tests are SLOW in qemu
|
||||
pkggroups="abuild"
|
||||
source="
|
||||
https://gitlab.alpinelinux.org/alpine/abuild/-/archive/$_pkgver/abuild-$_pkgver.tar.gz
|
||||
0001-abuild-add-systemd-splitfunc.patch
|
||||
0002-abuild-add-warning-in-systemd-split-func-about-non-u.patch
|
||||
0001-prepare_metafiles-install-scripts-in-controldir-chec.patch
|
||||
0002-tests-add-tests-for-systemd-splitfunc.patch
|
||||
0003-abuild-add-systemd-splitfunc.patch
|
||||
0004-abuild-add-warning-in-systemd-split-func-about-non-u.patch
|
||||
"
|
||||
builddir="$srcdir/$pkgname-$_pkgver"
|
||||
|
||||
@@ -104,7 +106,9 @@ _rootbld() {
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
00fac67aa96a83f33406dde60bd9526bfa5fdff690b84dbe867b6ed197f147b2afafcdfbda900c005e00a64a42bcb98ca425ffc8bf2158b9540cbb67d935577d abuild-3.12.0.tar.gz
|
||||
52cc5857b3c93bd4595de1d06c3c600b88871c68f7a1ea51e10d720ddd9c8fb7f0f63cd2f4fe280c0d9adaf607de8b858f4add3e46b1a5a28cc6c711359f6c60 0001-abuild-add-systemd-splitfunc.patch
|
||||
3782341dac814ecbcb7d2b4242d85f03ca2e4bf9eeb3b1e9524b2c434b05c864f5a4b5b8abc4031085e7e943e90780fe07b1e99d4cfadf0695340ad321647cac 0002-abuild-add-warning-in-systemd-split-func-about-non-u.patch
|
||||
49e243114933f3013884f0014fc8e5f142ff146de3d9ddb62e5ad98689cb1bf2bc8172da0331943f44b106dca4fd6fcdd917f5439e82facbb97eccc0f3459f37 abuild-3.14.1.tar.gz
|
||||
6d566504df6458bae91b3cb0e270193fbfbdf687d1d81262004c9ce5dacb371ccd7099f730990cd598f3c90b1bad12234fdfaa0e387fe6eb6b2d37c660201b41 0001-prepare_metafiles-install-scripts-in-controldir-chec.patch
|
||||
86d750862850c30d3ed5aeaf4279992cffbc6b61e2f1a4891d97e9f5b836c8d41cac802a9b91cd36444fd53951a6f8c57ca588234bdd5a41210a1331327af999 0002-tests-add-tests-for-systemd-splitfunc.patch
|
||||
4734b10fc9d247132a34d17a94dd2707dd94a545c855e052dd4db246b9a287b9dc9a3c6efe3b1bf900ef379cfe2809da1e57f5a5961dfd4bf9066f6b2d3085aa 0003-abuild-add-systemd-splitfunc.patch
|
||||
895b50380cd178c7d65cb6e77957a2f2367a3637a519e3c33310b1d0ef732953bf1a9d0fb7eda1005d2d4b8ab6a60b5f59c4962d03b46bd27692e504c14661c4 0004-abuild-add-warning-in-systemd-split-func-about-non-u.patch
|
||||
"
|
||||
@@ -4,7 +4,7 @@ maintainer="Jane Rachinger <jane400+pmaports@postmarketos.org>"
|
||||
pkgname=cups
|
||||
pkgver=99992.4.11
|
||||
_pkgver=2.4.11
|
||||
pkgrel=0
|
||||
pkgrel=1
|
||||
pkgdesc="The CUPS Printing System"
|
||||
url="https://github.com/OpenPrinting/cups/"
|
||||
arch="all"
|
||||
@@ -97,11 +97,6 @@ package() {
|
||||
find usr/share/cups/model -name "*.ppd" -exec gzip -n9f {} +
|
||||
}
|
||||
|
||||
systemd() {
|
||||
install="$subpkgname.post-install $subpkgname.pre-deinstall"
|
||||
default_systemd
|
||||
}
|
||||
|
||||
dev() {
|
||||
default_dev
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/lib/systemd/systemd-apk-macros.sh
|
||||
systemd_service_post_install system cups.path cups.socket cups.service
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/lib/systemd/systemd-apk-macros.sh
|
||||
systemd_service_pre_deinstall system cups.path cups.socket cups.service
|
||||
@@ -3,7 +3,7 @@
|
||||
pkgname=gdm
|
||||
pkgver=99947.0
|
||||
_pkgver=47.0
|
||||
pkgrel=0
|
||||
pkgrel=1
|
||||
pkgdesc="GNOME display manager"
|
||||
url="https://wiki.gnome.org/Projects/GDM"
|
||||
# blocked by gnome-shell
|
||||
@@ -76,11 +76,6 @@ package() {
|
||||
install -m755 -D "$srcdir/Xsession" "$pkgdir"/etc/gdm
|
||||
}
|
||||
|
||||
systemd() {
|
||||
install="$subpkgname.post-install $subpkgname.pre-deinstall"
|
||||
default_systemd
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
5578b2839ec78ef0b155a6ef6b82384495ef0f3ceb49f4bc7c656bf9dafa95b260148c7fc9b8295b71d4a2d33f6fe6c4a47485cd9eba5c0929f0492ba06e0893 gdm-47.0.tar.xz
|
||||
c5c57ee93f5a33db154632f0f81fa2e62a48635cfa5e51ada9cc969478df0ce15878446c639c8647c53d439f2eb4173e7fca0069eae31fbdcec541cc5f28cd28 0001-DOWNSTREAM-use-bin-touch-instead-of-usr-bin-touch.patch
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/lib/systemd/systemd-apk-macros.sh
|
||||
systemd_service_post_install system gdm.service
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/lib/systemd/systemd-apk-macros.sh
|
||||
systemd_service_pre_deinstall system gdm.service
|
||||
@@ -4,7 +4,7 @@
|
||||
pkgname=gnome-keyring
|
||||
pkgver=99946.2
|
||||
_pkgver=46.2
|
||||
pkgrel=0
|
||||
pkgrel=1
|
||||
pkgdesc="GNOME keyring"
|
||||
url="https://wiki.gnome.org//Projects/GnomeKeyring"
|
||||
arch="all"
|
||||
@@ -67,11 +67,6 @@ package() {
|
||||
make DESTDIR="$pkgdir" install
|
||||
}
|
||||
|
||||
systemd() {
|
||||
install="$subpkgname.post-install $subpkgname.pre-deinstall"
|
||||
default_systemd
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
4229ca0606bdd1b84a3c737288df7f1fc1f8715734e3001964babd882201c3d818deabb3a7662dbf9b67316f03b234de84da3128fb991a500ef8305c2f962ba2 gnome-keyring-46.2.tar.xz
|
||||
53e04eade3579fe5d65d11d6cde6c5fdffc9f73a3a7f372b1f4dbc7437212e753123c12854d3a5a7a22f3beb1b00604eec0371615ceb0f7024cb38cf35e33065 0001-build-Use-p11_module_configs-as-default-pkcs11-confi.patch
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/lib/systemd/systemd-apk-macros.sh
|
||||
systemd_service_post_install user gnome-keyring-daemon
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/lib/systemd/systemd-apk-macros.sh
|
||||
systemd_service_pre_deinstall user gnome-keyring-daemon
|
||||
@@ -5,7 +5,7 @@ maintainer="Jane Rachinger <jane400+pmaports@postmarketos.org>"
|
||||
pkgname=networkmanager
|
||||
pkgver=9991.50.1
|
||||
_pkgver=1.50.1
|
||||
pkgrel=0
|
||||
pkgrel=1
|
||||
pkgdesc="Network Management daemon"
|
||||
url="https://wiki.gnome.org/Projects/NetworkManager"
|
||||
arch="all"
|
||||
@@ -232,11 +232,6 @@ _default_plugin() {
|
||||
amove $_plugindir/libnm*-${subpkgname#"$pkgname"-}.so
|
||||
}
|
||||
|
||||
systemd() {
|
||||
install="$subpkgname.post-install $subpkgname.pre-deinstall"
|
||||
default_systemd
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
8adfe5781db90d7993286e298f6ed87da2387b706269de47e31073c29b78e8bc965cdbbebd8627af2c3e0ec8e2ea807629832853e31a0fa29db7a80eeed8e92d NetworkManager-1.50.1.tar.gz
|
||||
0f79016bf717dea43830962f524deae8d1cedc274376e40bd912ebe63208c5b1c3b7a5aa14379da19020c587dbd5588df2f0066ca1540070a226983a43e4159b networkmanager.conf
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/lib/systemd/systemd-apk-macros.sh
|
||||
systemd_service_post_install system NetworkManager.service
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/lib/systemd/systemd-apk-macros.sh
|
||||
systemd_service_pre_deinstall system NetworkManager.service
|
||||
@@ -1,6 +1,6 @@
|
||||
pkgname=msm-firmware-loader
|
||||
pkgver=1.5.0
|
||||
pkgrel=3
|
||||
pkgrel=4
|
||||
pkgdesc="Set of init services to automatically load firmware from device partitions"
|
||||
url="https://postmarketos.org/"
|
||||
subpackages="$pkgname-openrc $pkgname-systemd $pkgname-wcnss"
|
||||
@@ -40,11 +40,6 @@ openrc() {
|
||||
default_openrc
|
||||
}
|
||||
|
||||
systemd() {
|
||||
install="$subpkgname.post-install $subpkgname.pre-deinstall"
|
||||
default_systemd
|
||||
}
|
||||
|
||||
wcnss() {
|
||||
pkgdesc="Use WiFi/BT firmware from stock firmware partition using $pkgname"
|
||||
provides="firmware-qcom-msm8916-wcnss=$pkgver-r$pkgrel"
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/lib/systemd/systemd-apk-macros.sh
|
||||
systemd_service_post_install system msm-firmware-loader msm-firmware-loader-unpack
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/lib/systemd/systemd-apk-macros.sh
|
||||
systemd_service_pre_deinstall system msm-firmware-loader msm-firmware-loader-unpack
|
||||
Reference in new issue
Block a user