diff --git a/src/reset.sh b/src/reset.sh index c76e79d..e29f7cc 100644 --- a/src/reset.sh +++ b/src/reset.sh @@ -25,8 +25,8 @@ detectEngine() { if [ -f "/run/.containerenv" ]; then ENGINE="${container:-}" + if [[ "${ENGINE,,}" == *"podman"* ]]; then - ROOTLESS="Y" ENGINE="Podman" else [ -z "$ENGINE" ] && ENGINE="Kubernetes" @@ -36,6 +36,21 @@ detectEngine() { return 0 } +detectRootless() { + + local uid_map="" + + uid_map=$(awk '{$1=$1; print}' /proc/self/uid_map 2>/dev/null || true) + + if [[ "$uid_map" == "0 0 4294967295" ]]; then + ROOTLESS="N" + else + ROOTLESS="Y" + fi + + return 0 +} + checkPrivileged() { local cap_bnd @@ -53,7 +68,6 @@ checkPrivileged() { max_cap=$(((1 << (last_cap + 1)) - 1)) if [ "$cap_bnd" -eq "$max_cap" ]; then - ROOTLESS="N" PRIVILEGED="Y" fi @@ -232,6 +246,7 @@ PROCESS="${APP,,}" PROCESS="${PROCESS// /-}" detectEngine +detectRootless echo "❯ Starting $APP for $ENGINE v$(