automatically makes user.USER service for initing XDG_RUNTIME_DIR

This commit is contained in:
2026-07-03 09:30:26 +01:00
parent dcd2e1cd19
commit c1525eaa60
4 changed files with 17 additions and 8 deletions
+2 -2
View File
@@ -64,8 +64,8 @@ $(foreach module,$(MODULES),$(eval $(openrc_restart_rule)))
/etc/init.d/user.$(USER): /etc/init.d/user.$(USER):
sudo ln -s /etc/init.d/user /etc/init.d/user.$(USER) sudo ln -s /etc/init.d/user /etc/init.d/user.$(USER)
/etc/conf.d/user.$(USER): openrc/conf.d/user.$(USER) /etc/conf.d/user.$(USER): openrc/conf.d/user.template
sudo cp openrc/conf.d/user.$(USER) /etc/conf.d/user.$(USER) sudo USER=$(USER)envsubst openrc/conf.d/user.template /etc/conf.d/user.$(USER)
sudo rc-update add user.$(USER) default sudo rc-update add user.$(USER) default
.PHONY: uninstall_joeac.net_service .PHONY: uninstall_joeac.net_service
-3
View File
@@ -1,3 +0,0 @@
*
!.gitignore
!user.example
-3
View File
@@ -1,3 +0,0 @@
# copy this file to user.<USER> for the user you want to be running joeac.net via OpenRC
# add in here any user setup, bearing in mind that OpenRC doesn't use your usual login flow
# this may include setting up $HOME and/or $XDG_RUNTIME_DIR
+15
View File
@@ -0,0 +1,15 @@
UID="$$(id -u ${USER})"
if test -z "$${XDG_RUNTIME_DIR}"; then
export XDG_RUNTIME_DIR=/tmp/xdg/"$${UID}"-xdg-runtime-dir
if ! test -d "$${XDG_RUNTIME_DIR}"; then
mkdir -p "$${XDG_RUNTIME_DIR}"
chown -R ${USER}:${USER} "$${XDG_RUNTIME_DIR}"
chmod -R 0700 "$${XDG_RUNTIME_DIR}"
fi
fi
if ! test -f "$${XDG_RUNTIME_DIR}/openrc/softlevel"; then
mkdir -p "$${XDG_RUNTIME_DIR}/openrc"
touch "$${XDG_RUNTIME_DIR}/openrc/softlevel"
chown -R ${USER}:${USER} "$${XDG_RUNTIME_DIR}"
chmod -R 0700 "$${XDG_RUNTIME_DIR}"
fi