fix mkdirs

This commit is contained in:
emmett1
2019-05-01 17:18:12 +08:00
parent 8a9c4eb185
commit 5962451f56

27
scratch
View File

@@ -477,21 +477,22 @@ post_triggers() {
case "$dir" in
""|\#*) continue ;;
esac
mkdir -p "$dir"
if [ "$uid" != '-' ]; then
getent passwd $uid >/dev/null
if [[ "$?" = 0 ]]; then
chown "$uid" "$dir"
if [ -e "$dir" ]; then
if [ "$uid" != '-' ]; then
getent passwd $uid >/dev/null
if [[ "$?" = 0 ]]; then
chown "$uid" "$dir"
fi
fi
fi
if [ "$gid" != '-' ]; then
getent group $gid >/dev/null
if [[ "$?" = 0 ]]; then
chgrp "$gid" "$dir"
if [ "$gid" != '-' ]; then
getent group $gid >/dev/null
if [[ "$?" = 0 ]]; then
chgrp "$gid" "$dir"
fi
fi
if [ "$mode" != '-' ]; then
chmod "$mode" "$dir"
fi
fi
if [ "$mode" != '-' ]; then
chmod "$mode" "$dir"
fi
done < "$mkd"
done