create the default XDG_RUNTIME dirs

This commit is contained in:
Jack L. Frost 2015-08-17 17:10:19 +03:00
parent 79bccd989e
commit 90c8943782

11
rc.in Executable file → Normal file
View File

@ -17,6 +17,14 @@ cfg_tmpdirs+=( '/run/lock' '/run/lock/lvm' '/run/lvm' '/run/user' )
# And temporary files # And temporary files
cfg_tmpfiles+=( '/run/utmp' ) cfg_tmpfiles+=( '/run/utmp' )
# Default XDG_RUNTIME_DIR for all non-system users
# rtkit:x:133:133:RealtimeKit:/proc:/sbin/nologin
while IFS=':' _ _ uid gid _; do
if (( uid >= 1000 )); then
cfg_tmpdirs+=( "/run/user/$uid:750:$uid:$gid" )
fi
done < /etc/passwd
# Functions # Functions
rc.rescue() { exec "${cfg_rc_rescue_shell:-"$SHELL"}"; } rc.rescue() { exec "${cfg_rc_rescue_shell:-"$SHELL"}"; }
@ -32,7 +40,8 @@ rc.motd() {
rc.tmpfiles() { rc.tmpfiles() {
printf '%s\n' "${cfg_tmpdirs[@]}" | while IFS=':' read dir perm own grp; do printf '%s\n' "${cfg_tmpdirs[@]}" | while IFS=':' read dir perm own grp; do
install -v -d -m "${perm:-755}" -o "${own:-root}" -g "${grp:-root}" "$dir" 2>/dev/null mkdir -pm "${perm:-755}" "$dir"
chown -c "${own:-root}:${grp:-root}" "$dir"
done done
printf '%s\n' "${cfg_tmpfiles[@]}" | while IFS=':' read file perm own grp; do printf '%s\n' "${cfg_tmpfiles[@]}" | while IFS=':' read file perm own grp; do