On 18:58 Wed 03 Nov 2010, Kay Sievers wrote:
On Wed, 2010-11-03 at 14:35 +0100, Ludwig Nussel wrote:
Andreas Jaeger wrote:
Testing today's version, I noticed that the following directories were not
created:
d /var/run/screens 0755 root root -
d /var/run/uscreens 1777 root root -
d /var/run/vi.recover 1777 root root -
d /var/run/PolicyKit 0770 polkituser polkituser -
Kay, does
systemd-tmpfiles-setup.service replace boot.cleanup? If yes, I'm curious where
this is configured... Otherwise, I wonder why it did not get executed...
I guess the right solution would be to create
/etc/tmpfiles.d/{screen,vi,PolicyKit} for these?
What about getting rid of the ugly /etc/tmpdirs.d/ then?
boot.cleanup could read /etc/tmpfiles.d just as well.
Sounds good, yeah. The Debian guys want to do the same.
Here is a quick implementation of a shell script to do the
/etc/tmpfiles.d/ work that we can merge into aaa_base. It implements the
verbs that we care about right now: create and remove.
I can send a patch to fix aaa_base to call this script and remove the
screen specific stuff too as the Factory version of screen now ships a
/etc/tmpfiles.d file.
Eventually it would be great to move all of the magic for tmp files in
aaa_base and have packages ship /etc/tmpfiles.d. This is a place to
start.
Thoughts?
Cheers,
Brandon
#!/bin/sh
# Limited implementation of /lib/systemd/systemd-tmpfiles in shell
# Copyright 2010 (C) Brandon Philips
#
# Licensed under GPLv2
# This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
# them in the file system. This is intended to be used to create
# properly owned directories beneath /tmp, /var/tmp, /var/run and
# /var/lock which are volatile and hence need to be recreated on
# bootup.
if [ $# -lt 1 ]; then
echo "aaa-tmpfiles (--create|--clean|--remove)+"
exit 1
fi
for arg in $*; do
case "$arg" in
--create)
arg_create=true
;;
--remove)
arg_remove=true
;;
--clean)
arg_clean=true
;;
*)
echo "Unknown option '$arg'"
exit 1
;;
esac
done
function create_item() {
case "$type" in
# IGNORE_PATH | REMOVE_PATH | RECURSIVE_REMOVE_PATH
x|r|R)
return
;;
#CREATE_FILE
f)
touch $file
;;
#TRUNCATE_FILE
F)
cat /dev/null > $file
;;
# CREATE_DIRECTORY | TRUNCATE_DIRECTORY
D|d)
mkdir $file
;;
esac
[ $mode ] && [ $mode != '-' ] && chmod $mode $file
[ $user ] && [ $user != '-' ] && chown $user $file
[ $group ] && [ $group != '-' ] && chown :$group $file
}
function clean_item {
case "$type" in
# CREATE_DIRECTORY | TRUNCATE_DIRECTORY | IGNORE_PATH
d|D|x)
# Stub not implemented
;;
esac
}
function remove_item {
case "$type" in
# CREATE_FILE | TRUNCATE_FILE | CREATE_DIRECTORY | IGNORE_PATH
f|F|d|x)
;;
# RECURSIVE_REMOVE_PATH | TRUNCATE_DIRECTORY
D|R)
rm -Rf $file
;;
# REMOVE_PATH
r)
rm $file
;;
esac
}
#
# parse all of the tmpfiles configs
# example line:
# d /var/lock/subsys 0755 root root -
#
cat /etc/tmpfiles.d/* | sed -e '/^#.*$/d' -e '/^\s*$/d' | while read line; do
eval $(echo $line |\
sed -n "s/\(.\)\s\(.*\)\s\(.*\)\s\(.*\)\s\(.*\)\s\(.*\)/type=\1\nfile=\2\nmode=\3\nuser=\4\ngroup=\5\nage=\6/p")
if [ ! $type ] || [ ! $file ]; then
echo "Error: no type or file"
echo $line
exit 1
fi
[ $arg_create ] && create_item
[ $arg_remove ] && remove_item
[ $arg_clean ] && clean_item
done
--
To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-factory+help@opensuse.org