diff options
author | Stonewall Jackson <stonewall@sacredheartsc.com> | 2023-02-04 01:23:43 -0500 |
---|---|---|
committer | Stonewall Jackson <stonewall@sacredheartsc.com> | 2023-02-04 01:52:13 -0500 |
commit | 0261e875679f1bf63c8d689da7fc7e014597885d (patch) | |
tree | 3f19cd74a0c1070944f75437f30b098d6ef2ffcb /roles/local_homedirs/files | |
download | selfhosted-0261e875679f1bf63c8d689da7fc7e014597885d.tar.gz selfhosted-0261e875679f1bf63c8d689da7fc7e014597885d.zip |
initial commit
Diffstat (limited to 'roles/local_homedirs/files')
3 files changed, 33 insertions, 0 deletions
diff --git a/roles/local_homedirs/files/etc/profile.d/local-homedirs.sh b/roles/local_homedirs/files/etc/profile.d/local-homedirs.sh new file mode 100644 index 0000000..88d710c --- /dev/null +++ b/roles/local_homedirs/files/etc/profile.d/local-homedirs.sh @@ -0,0 +1,16 @@ +# This file contains various environment variables and hacks to accomodate +# applications that don't play well with NFS-mounted home directories. + +if (( UID >= 1000 )); then + export PYTHONUSERBASE="/usr/local/home/${USER}/.local" + export npm_config_cache="/usr/local/home/${USER}/.npm" + export CARGO_HOME="/usr/local/home/${USER}/.cargo" + export GOPATH="/usr/local/home/${USER}/go" + + # firefox + mkdir -p "/usr/local/home/${USER}/.mozilla" + ln -sfn "/usr/local/home/${USER}/.mozilla" "${HOME}/.mozilla" + + # flatpak + ln -sfn "/opt/flatpak/${USER}" "${HOME}/.var" +fi diff --git a/roles/local_homedirs/files/etc/security/pam_env_xdg.conf b/roles/local_homedirs/files/etc/security/pam_env_xdg.conf new file mode 100644 index 0000000..40ee87c --- /dev/null +++ b/roles/local_homedirs/files/etc/security/pam_env_xdg.conf @@ -0,0 +1,4 @@ +XDG_DATA_HOME DEFAULT=/usr/local/home/@{PAM_USER}/.local/share +XDG_STATE_HOME DEFAULT=/usr/local/home/@{PAM_USER}/.local/state +XDG_CACHE_HOME DEFAULT=/usr/local/home/@{PAM_USER}/.cache +XDG_CONFIG_HOME DEFAULT=/usr/local/home/@{PAM_USER}/.config diff --git a/roles/local_homedirs/files/usr/local/sbin/create-local-homedir.sh b/roles/local_homedirs/files/usr/local/sbin/create-local-homedir.sh new file mode 100644 index 0000000..ed42588 --- /dev/null +++ b/roles/local_homedirs/files/usr/local/sbin/create-local-homedir.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +exec 1> >(logger -s -t $(basename "$0")) 2>&1 + +PAM_UID=$(id -u "$PAM_USER") + +if (( PAM_UID >= 1000 )); then + install -o "$PAM_USER" -g "$PAM_USER" -m 0700 -d "/usr/local/home/$PAM_USER" + + # Flatpak shadows /usr with its own runtime, so we need a path that flatpak + # doesn't touch. /opt seems appropriate. + install -o "$PAM_USER" -g "$PAM_USER" -m 0700 -d "/opt/flatpak/$PAM_USER" +fi |