aboutsummaryrefslogtreecommitdiffstats
path: root/roles/local_homedirs/files/usr
diff options
context:
space:
mode:
authorStonewall Jackson <stonewall@sacredheartsc.com>2023-02-04 01:23:43 -0500
committerStonewall Jackson <stonewall@sacredheartsc.com>2023-02-04 01:52:13 -0500
commit0261e875679f1bf63c8d689da7fc7e014597885d (patch)
tree3f19cd74a0c1070944f75437f30b098d6ef2ffcb /roles/local_homedirs/files/usr
downloadselfhosted-0261e875679f1bf63c8d689da7fc7e014597885d.tar.gz
selfhosted-0261e875679f1bf63c8d689da7fc7e014597885d.zip
initial commit
Diffstat (limited to 'roles/local_homedirs/files/usr')
-rw-r--r--roles/local_homedirs/files/usr/local/sbin/create-local-homedir.sh13
1 files changed, 13 insertions, 0 deletions
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