summaryrefslogtreecommitdiff
path: root/sys-fs/eudev/files/udev-postmount
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-08-07 19:44:57 +0100
committerV3n3RiX <venerix@redcorelinux.org>2021-08-07 19:44:57 +0100
commit32ef67ae3bb68f3648581b2f0aafeadf405698cf (patch)
treee2d20d930d1c7362dedcaa2c3ff708c66e6b3dd7 /sys-fs/eudev/files/udev-postmount
parenta5870f45c1e4afdfecb4a3d2f3765f2ce5e7a66d (diff)
sys-fs/eudev : import from gentoo, add missing acct-group/usb dependency
Diffstat (limited to 'sys-fs/eudev/files/udev-postmount')
-rw-r--r--sys-fs/eudev/files/udev-postmount55
1 files changed, 55 insertions, 0 deletions
diff --git a/sys-fs/eudev/files/udev-postmount b/sys-fs/eudev/files/udev-postmount
new file mode 100644
index 00000000..f1f94f48
--- /dev/null
+++ b/sys-fs/eudev/files/udev-postmount
@@ -0,0 +1,55 @@
+#!/sbin/openrc-run
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend()
+{
+ need localmount
+ keyword -vserver -lxc
+}
+
+dir_writeable()
+{
+ touch "$1"/.test.$$ 2>/dev/null && rm "$1"/.test.$$
+}
+
+# store persistent-rules that got created while booting
+# when / was still read-only
+store_persistent_rules()
+{
+ # create /etc/udev/rules.d if it does not exist and /etc/udev is writable
+ [ -d /etc/udev/rules.d ] || \
+ dir_writeable /etc/udev && \
+ mkdir -p /etc/udev/rules.d
+
+ # only continue if rules-directory is writable
+ dir_writeable /etc/udev/rules.d || return 0
+
+ local file dest
+ for file in /run/udev/tmp-rules--*; do
+ dest=${file##*tmp-rules--}
+ [ "$dest" = '*' ] && break
+ type=${dest##70-persistent-}
+ type=${type%%.rules}
+ ebegin "Saving udev persistent ${type} rules to /etc/udev/rules.d"
+ cat "$file" >> /etc/udev/rules.d/"$dest" && rm -f "$file"
+ eend $? "Failed moving persistent rules!"
+ done
+}
+
+start()
+{
+ # check if this system uses udev
+ [ -d /run/udev ] || return 0
+
+ # store persistent-rules that got created while booting
+ # when / was still read-only
+ store_persistent_rules
+}
+
+stop()
+{
+ return 0
+}
+
+# vim:ts=4