Commit 1d3d7854 authored by lamby's avatar lamby Committed by Cyril Brulebois
Browse files

Factor-out fixing of tails-persistent-setup UID/GID settings into utility methods. (refs: #15695)



v2 by Cyril Brulebois:
 - Use the correct command to adjust group ID.
Signed-off-by: default avatarCyril Brulebois <cyril@debamax.com>
parent 4f229bab
......@@ -6,14 +6,31 @@ set -e
echo "Change GIDs and UIDs"
TPS_GROUP_STEALER=$(getent group 122 | awk -F ':' '{print $1}')
if [ -n "$TPS_GROUP_STEALER" ]; then
groupmod --gid 150 "$TPS_GROUP_STEALER"
find / -wholename /proc -prune -o \( \! -type l -a -gid 122 -exec chgrp 150 '{}' \; \)
fi
TPS_USER_STEALER=$(getent passwd 115 | awk -F ':' '{print $1}')
if [ -n "$TPS_USER_STEALER" ]; then
usermod --uid 150 "$TPS_USER_STEALER"
find / -wholename /proc -prune -o \( \! -type l -a -uid 115 -exec chown 150 '{}' \; \)
fi
Change_uid () {
OLD="$1"
NEW="$2"
NAME=$(getent passwd "$OLD" | awk -F ':' '{print $1}')
if [ -n "$NAME" ]; then
echo "Changing UID for $NAME ($OLD -> $NEW)"
usermod --uid "$NEW" "$NAME"
find / -wholename /proc -prune -o \( \! -type l -a -uid "$OLD" -exec chown "$NEW" '{}' \; \)
fi
}
Change_gid () {
OLD="$1"
NEW="$2"
NAME=$(getent group "$OLD" | awk -F ':' '{print $1}')
if [ -n "$NAME" ]; then
echo "Changing GID for $NAME ($OLD -> $NEW)"
groupmod --gid "$NEW" "$NAME"
find / -wholename /proc -prune -o \( \! -type l -a -gid "$OLD" -exec chgrp "$NEW" '{}' \; \)
fi
}
# tails-persistent-setup
Change_uid 115 150
Change_gid 122 150
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment