File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,8 +13,15 @@ if [ "$CURRENT_UID" != "$TARGET_UID" ] || [ "$CURRENT_GID" != "$TARGET_GID" ]; t
1313 sed -i " s/^$USERNAME :x:$CURRENT_UID :$CURRENT_GID :/$USERNAME :x:$TARGET_UID :$TARGET_GID :/" /etc/passwd
1414 sed -i " s/^$USERNAME :x:$CURRENT_GID :/$USERNAME :x:$TARGET_GID :/" /etc/group
1515 chown " $TARGET_UID :$TARGET_GID " " /home/$USERNAME "
16- find " /home/$USERNAME " -mindepth 1 -maxdepth 1 ! -name mnt \
17- -exec chown -R " $TARGET_UID :$TARGET_GID " {} +
16+ ITEMS=$( find " /home/$USERNAME " -mindepth 1 -maxdepth 1 ! -name mnt)
17+ TOTAL=$( printf ' %s\n' " $ITEMS " | wc -l)
18+ I=0
19+ printf ' %s\n' " $ITEMS " | while read -r item; do
20+ I=$(( I + 1 ))
21+ printf ' \r\033[Kchown [%d/%d] %s' " $I " " $TOTAL " " ${item##*/ } "
22+ chown -R " $TARGET_UID :$TARGET_GID " " $item "
23+ done
24+ printf ' \r\033[Kchown complete (%d items)\n' " $TOTAL "
1825fi
1926
2027exec su - " $USERNAME " -s /bin/zsh -c " $* "
You can’t perform that action at this time.
0 commit comments