aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/util-linux/APKBUILD12
-rw-r--r--main/util-linux/rfkill.confd13
-rw-r--r--main/util-linux/rfkill.initd50
3 files changed, 72 insertions, 3 deletions
diff --git a/main/util-linux/APKBUILD b/main/util-linux/APKBUILD
index 5a59926885..1d0338c824 100644
--- a/main/util-linux/APKBUILD
+++ b/main/util-linux/APKBUILD
@@ -9,7 +9,7 @@ case $pkgver in
*.*) _v=$pkgver;;
esac
-pkgrel=0
+pkgrel=1
pkgdesc="Random collection of Linux utilities"
url="https://git.kernel.org/cgit/utils/util-linux/util-linux.git"
arch="all"
@@ -21,8 +21,10 @@ makedepends_host="zlib-dev ncurses-dev linux-headers libcap-ng-dev"
options="suid"
source="https://www.kernel.org/pub/linux/utils/util-linux/v$_v/util-linux-$pkgver.tar.xz
ttydefaults.h
+ rfkill.confd
+ rfkill.initd
"
-subpackages="$pkgname-doc $pkgname-dev $pkgname-bash-completion:bashcomp:noarch
+subpackages="$pkgname-doc $pkgname-dev $pkgname-bash-completion:bashcomp:noarch $pkgname-openrc
libblkid:_mv_lib
libfdisk:_mv_lib
libmount:_mv_lib
@@ -80,6 +82,8 @@ build() {
package() {
make -j1 DESTDIR="$pkgdir" -C "$builddir" install
# use pkg-config
+ install -D -m755 "$srcdir"/rfkill.initd "$pkgdir"/etc/init.d/rfkill
+ install -D -m644 "$srcdir"/rfkill.confd "$pkgdir"/etc/conf.d/rfkill
}
_mv_bin() {
@@ -141,4 +145,6 @@ _py3() {
}
sha512sums="cbb4975da8d99a1edd45514171d59ea7b019ce0f77a81e88b447a733f725e91c53540d9dc78bc626dc011dca129b8b150aaf9e64ccf62a4202ae816581acf4fd util-linux-2.36.tar.xz
-876bb9041eca1b2cca1e9aac898f282db576f7860aba690a95c0ac629d7c5b2cdeccba504dda87ff55c2a10b67165985ce16ca41a0694a267507e1e0cafd46d9 ttydefaults.h"
+876bb9041eca1b2cca1e9aac898f282db576f7860aba690a95c0ac629d7c5b2cdeccba504dda87ff55c2a10b67165985ce16ca41a0694a267507e1e0cafd46d9 ttydefaults.h
+401d2ccbdbfb0ebd573ac616c1077e2c2b79ff03e9221007759d8ac25eb522c401f705abbf7daac183d5e8017982b8ec5dd0a5ebad39507c5bb0a9f31f04ee97 rfkill.confd
+c4e7ba6d257496c99934add2ca532db16fb070ea2367554587c9fb4e24ab1d80b8ba3fd0fd4fdd5ef1374c3ec6414007369b292ee334ef23171d0232ef709db2 rfkill.initd"
diff --git a/main/util-linux/rfkill.confd b/main/util-linux/rfkill.confd
new file mode 100644
index 0000000000..29e9c9800c
--- /dev/null
+++ b/main/util-linux/rfkill.confd
@@ -0,0 +1,13 @@
+# RESTORE_ON_START:
+# Do you want to apply rfkill device configuration on startup?
+# no - Do not restore configuration
+# yes - Restore configuration
+
+RESTORE_ON_START="yes"
+
+# SAVE_ON_STOP:
+# Do you want to save rfkill device configuration?
+# no - Do not save configuration
+# yes - Save configuration
+
+SAVE_ON_STOP="yes"
diff --git a/main/util-linux/rfkill.initd b/main/util-linux/rfkill.initd
new file mode 100644
index 0000000000..1cc0335e45
--- /dev/null
+++ b/main/util-linux/rfkill.initd
@@ -0,0 +1,50 @@
+#!/sbin/openrc-run
+
+description="Save/Restore rfkill configuration"
+
+rfkillstatedir=/var/lib/rfkill
+
+extra_commands="save restore"
+
+depend() {
+ need localmount
+ after bootmisc modules isapnp coldplug hotplug
+}
+
+restore() {
+ ebegin "Restoring rfkill configuration"
+ for type in "$rfkillstatedir"/*; do
+ status=$(cat "$type")
+ type=$(basename "$type")
+ rfkill "$status" "$type"
+ done
+ eend 0
+}
+
+save() {
+ ebegin "Storing rfkill configuration"
+ mkdir -p "$rfkillstatedir"
+ OLDIFS="$IFS"
+ IFS=$'\n'
+ for line in $(rfkill -r -n); do
+ type=$(echo "$line" | cut -d' ' -f2)
+ status=$(echo "$line" | cut -d' ' -f4 | tr -d 'ed')
+ echo "$status" > "$rfkillstatedir"/"$type"
+ done
+ IFS="$OLDIFS"
+ eend 0
+}
+
+start() {
+ if [ "${RESTORE_ON_START}" = "yes" ]; then
+ restore
+ fi
+ return 0
+}
+
+stop() {
+ if [ "${SAVE_ON_STOP}" = "yes" ]; then
+ save
+ fi
+ return 0
+}