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 ...@@ -6,14 +6,31 @@ set -e
echo "Change GIDs and UIDs" echo "Change GIDs and UIDs"
TPS_GROUP_STEALER=$(getent group 122 | awk -F ':' '{print $1}') Change_uid () {
if [ -n "$TPS_GROUP_STEALER" ]; then OLD="$1"
groupmod --gid 150 "$TPS_GROUP_STEALER" NEW="$2"
find / -wholename /proc -prune -o \( \! -type l -a -gid 122 -exec chgrp 150 '{}' \; \) NAME=$(getent passwd "$OLD" | awk -F ':' '{print $1}')
fi
if [ -n "$NAME" ]; then
TPS_USER_STEALER=$(getent passwd 115 | awk -F ':' '{print $1}') echo "Changing UID for $NAME ($OLD -> $NEW)"
if [ -n "$TPS_USER_STEALER" ]; then usermod --uid "$NEW" "$NAME"
usermod --uid 150 "$TPS_USER_STEALER" find / -wholename /proc -prune -o \( \! -type l -a -uid "$OLD" -exec chown "$NEW" '{}' \; \)
find / -wholename /proc -prune -o \( \! -type l -a -uid 115 -exec chown 150 '{}' \; \) fi
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