Handle extreme edge case of ASF_USER=root

This commit is contained in:
JustArchi
2022-10-11 17:16:12 +02:00
parent 5dbe523f59
commit f3bb15670b
6 changed files with 6 additions and 6 deletions

View File

@@ -67,7 +67,7 @@ done
BINARY_PREFIX=""
if [ -n "${ASF_USER-}" ] && [ "$(id -u)" -eq 0 ] && id -u "$ASF_USER" >/dev/null 2>&1; then
if [ -n "${ASF_USER-}" ] && [ "$(id -u)" -eq 0 ] && id -u "$ASF_USER" >/dev/null 2>&1 && [ "$(id -u "$ASF_USER")" -gt 0 ]; then
# Fix permissions first to ensure ASF has read/write access to the directory specified by --path and its own
chown -hR "${ASF_USER}:${ASF_USER}" . "$SCRIPT_DIR" || true

View File

@@ -67,7 +67,7 @@ done
BINARY_PREFIX=""
if [ -n "${ASF_USER-}" ] && [ "$(id -u)" -eq 0 ] && id -u "$ASF_USER" >/dev/null 2>&1; then
if [ -n "${ASF_USER-}" ] && [ "$(id -u)" -eq 0 ] && id -u "$ASF_USER" >/dev/null 2>&1 && [ "$(id -u "$ASF_USER")" -gt 0 ]; then
# Fix permissions first to ensure ASF has read/write access to the directory specified by --path and its own
chown -hR "${ASF_USER}:${ASF_USER}" . "$SCRIPT_DIR" || true

View File

@@ -67,7 +67,7 @@ done
BINARY_PREFIX=""
if [ -n "${ASF_USER-}" ] && [ "$(id -u)" -eq 0 ] && id -u "$ASF_USER" >/dev/null 2>&1; then
if [ -n "${ASF_USER-}" ] && [ "$(id -u)" -eq 0 ] && id -u "$ASF_USER" >/dev/null 2>&1 && [ "$(id -u "$ASF_USER")" -gt 0 ]; then
# Fix permissions first to ensure ASF has read/write access to the directory specified by --path and its own
chown -hR "${ASF_USER}:${ASF_USER}" . "$SCRIPT_DIR" || true

View File

@@ -67,7 +67,7 @@ done
BINARY_PREFIX=""
if [ -n "${ASF_USER-}" ] && [ "$(id -u)" -eq 0 ] && id -u "$ASF_USER" >/dev/null 2>&1; then
if [ -n "${ASF_USER-}" ] && [ "$(id -u)" -eq 0 ] && id -u "$ASF_USER" >/dev/null 2>&1 && [ "$(id -u "$ASF_USER")" -gt 0 ]; then
# Fix permissions first to ensure ASF has read/write access to the directory specified by --path and its own
chown -hR "${ASF_USER}:${ASF_USER}" . "$SCRIPT_DIR" || true

View File

@@ -67,7 +67,7 @@ done
BINARY_PREFIX=""
if [ -n "${ASF_USER-}" ] && [ "$(id -u)" -eq 0 ] && id -u "$ASF_USER" >/dev/null 2>&1; then
if [ -n "${ASF_USER-}" ] && [ "$(id -u)" -eq 0 ] && id -u "$ASF_USER" >/dev/null 2>&1 && [ "$(id -u "$ASF_USER")" -gt 0 ]; then
# Fix permissions first to ensure ASF has read/write access to the directory specified by --path and its own
chown -hR "${ASF_USER}:${ASF_USER}" . "$SCRIPT_DIR" || true

View File

@@ -67,7 +67,7 @@ done
BINARY_PREFIX=""
if [ -n "${ASF_USER-}" ] && [ "$(id -u)" -eq 0 ] && id -u "$ASF_USER" >/dev/null 2>&1; then
if [ -n "${ASF_USER-}" ] && [ "$(id -u)" -eq 0 ] && id -u "$ASF_USER" >/dev/null 2>&1 && [ "$(id -u "$ASF_USER")" -gt 0 ]; then
# Fix permissions first to ensure ASF has read/write access to the directory specified by --path and its own
chown -hR "${ASF_USER}:${ASF_USER}" . "$SCRIPT_DIR" || true