Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/configs
diff options
context:
space:
mode:
authornl6720 <nl6720@gmail.com>2020-07-20 12:18:16 +0300
committernl6720 <nl6720@gmail.com>2020-07-28 11:56:59 +0300
commitb922e8bc9cebbb42a76da4752a10ecba0043917d (patch)
tree9cf2b3b2be6a8529febf907f067b3a0e3c93a2ab /configs
parent78fe6560420adccf70c50eb9963e133794f7522e (diff)
Set up custom user home directories and their permissions
Diffstat (limited to 'configs')
-rwxr-xr-xconfigs/baseline/build.sh14
-rwxr-xr-xconfigs/releng/build.sh15
2 files changed, 28 insertions, 1 deletions
diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh
index f2f3922..6001cd8 100755
--- a/configs/baseline/build.sh
+++ b/configs/baseline/build.sh
@@ -39,6 +39,20 @@ make_custom_airootfs() {
cp -af --no-preserve=ownership -- "${script_path}/airootfs/." "${_airootfs}"
[[ -e "${_airootfs}/etc/shadow" ]] && chmod -f 0400 -- "${_airootfs}/etc/shadow"
[[ -e "${_airootfs}/etc/gshadow" ]] && chmod -f 0400 -- "${_airootfs}/etc/gshadow"
+
+ # Set up user home directories and permissions
+ if [[ -e "${_airootfs}/etc/passwd" ]]; then
+ while IFS=':' read -a passwd -r; do
+ [[ "${passwd[5]}" == '/' ]] && continue
+
+ if [[ -d "${_airootfs}${passwd[5]}" ]]; then
+ chown -hR -- "${passwd[2]}:${passwd[3]}" "${_airootfs}${passwd[5]}"
+ chmod -f 0750 -- "${_airootfs}${passwd[5]}"
+ else
+ install -d -m 0750 -o "${passwd[2]}" -g "${passwd[3]}" -- "${_airootfs}${passwd[5]}"
+ fi
+ done < "${_airootfs}/etc/passwd"
+ fi
fi
}
diff --git a/configs/releng/build.sh b/configs/releng/build.sh
index 07d2560..310204b 100755
--- a/configs/releng/build.sh
+++ b/configs/releng/build.sh
@@ -69,7 +69,20 @@ make_custom_airootfs() {
[[ -e "${_airootfs}/etc/shadow" ]] && chmod -f 0400 -- "${_airootfs}/etc/shadow"
[[ -e "${_airootfs}/etc/gshadow" ]] && chmod -f 0400 -- "${_airootfs}/etc/gshadow"
- [[ -e "${_airootfs}/root" ]] && chmod -f 0750 -- "${_airootfs}/root"
+
+ # Set up user home directories and permissions
+ if [[ -e "${_airootfs}/etc/passwd" ]]; then
+ while IFS=':' read -a passwd -r; do
+ [[ "${passwd[5]}" == '/' ]] && continue
+
+ if [[ -d "${_airootfs}${passwd[5]}" ]]; then
+ chown -hR -- "${passwd[2]}:${passwd[3]}" "${_airootfs}${passwd[5]}"
+ chmod -f 0750 -- "${_airootfs}${passwd[5]}"
+ else
+ install -d -m 0750 -o "${passwd[2]}" -g "${passwd[3]}" -- "${_airootfs}${passwd[5]}"
+ fi
+ done < "${_airootfs}/etc/passwd"
+ fi
fi
}