From 0161d0dd7de853da1f86bb3b6f27adf25977c785 Mon Sep 17 00:00:00 2001 From: freaj Date: Mon, 23 Mar 2015 11:27:55 +0100 Subject: openrc-base: add missing files --- pcr/openrc-base/udev-postmount | 55 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 pcr/openrc-base/udev-postmount (limited to 'pcr/openrc-base/udev-postmount') diff --git a/pcr/openrc-base/udev-postmount b/pcr/openrc-base/udev-postmount new file mode 100644 index 000000000..e433736db --- /dev/null +++ b/pcr/openrc-base/udev-postmount @@ -0,0 +1,55 @@ +#!/sbin/runscript +# 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 -- cgit v1.2.3-2-g168b