kiss: ensure that the owner actually exists

This commit is contained in:
Dylan Araps 2020-04-22 15:02:28 +03:00
parent 93ea92ee8e
commit 285b271dee
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

7
kiss
View File

@ -1161,9 +1161,12 @@ pkg_updates() {
# ownership of files and directories in the rare
# case that the repository is owned by a 3rd user.
(
user=$(stat -c %U "$PWD")
user=$(stat -c %U "$PWD") || user=root
[ "${user:=root}" = root ] ||
id -u "$user" >/dev/null 2>&1 ||
user=root
[ "$user" = root ] ||
log "Dropping permissions to $user for pull"
case $su in