Group names may actually contain spaces, and since the groups commmand
only reports a space-delimited list of groups on stdout, we had
a problem.
Thanks to "Oei, Yung-Chin" <yungchin@yungchin.nl> and Gabriel Filion
<lelutin@gmail.com> for tracking this down.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Reviewed-by: Zoran Zaric <zz@zoranzaric.de>
WVPASS bup xstat src | grep -qvE '^user: root'
# Make sure we can restore one of the user's groups.
- user_groups="$(groups)"
- last_group="$(echo ${user_groups/* /})"
+ last_group="$(python -c 'import os,grp; \
+ print grp.getgrgid(os.getgroups()[0])[0]')"
rm -rf src
WVPASS bup meta --edit --set-group "$last_group" ../src.meta \
| WVPASS bup meta -x