Skip to content

Instantly share code, notes, and snippets.

@oerdnj
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oerdnj/c68327f8c7a5725645ea to your computer and use it in GitHub Desktop.
Save oerdnj/c68327f8c7a5725645ea to your computer and use it in GitHub Desktop.
do_tmpfiles() {
local type path mode user group
if [ -r "$1" ]; then
if [ -x /bin/systemd-tmpfiles ]; then
/bin/systemd-tmpfiles --create "$1"
else
while read type path mode user group; do
case "$type" in
d)
mkdir -p "$path";
chmod "$mode" "$path";
chown "$user:$group" "$path";
;;
*)
log_warning_msg "tmpfile.d type '$type' is not supported yet"
;;
esac
done < "$1"
else
log_warning_msg "tmpfiles.d file '$1' doesn't exist or is not readable"
fi
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment