#!/bin/sh GROUPS=`lliurex-userfuncs llx_get_non_system_groups` GROUPS_GUARDED=`llxcfg-guard grouplist` FILE_OF_GROUPS=`mktemp /tmp/lliurex-guard.XXXXXX` FILE_OF_GROUPS_GUARDED=`mktemp /tmp/lliurex-guard.XXXXXX` FILE_OF_RESULTS=`mktemp /tmp/lliurex-guard.XXXXXX` TEXTDOMAIN="lliurex-guard" export TEXTDOMAIN TSELECTED="$(gettext "Selected")" TGROUPS="$(gettext "GROUPS")" TGROUPNAME="$(gettext "Group name")" echo $GROUPS > $FILE_OF_GROUPS echo $GROUPS_GUARDED > $FILE_OF_GROUPS_GUARDED delete_temp_files(){ rm -f $FILE_OF_GROUPS $FILE_OF_GROUPS_GUARDED $FILE_OF_RESULTS } # MAIN rc=0 for i in $GROUPS ; do if [ -n "`cat $FILE_OF_GROUPS_GUARDED|grep $i`" ]; then printf "TRUE\0" printf "$i\0" else printf "FALSE\0" printf "$i\0" fi done | xargs -0 zenity --list --text="$TGROUPS" --checklist --column="$TSELECTED" --column="$TGROUPNAME" > $FILE_OF_RESULTS rc=$? if [ $rc -ne 0 ] ; then delete_temp_files exit 0 fi RESULTS=`cat $FILE_OF_RESULTS| sed -e "s%|% %g"` echo "$RESULTS" > "$FILE_OF_RESULTS" # Delete groups for f in $GROUPS_GUARDED ; do if [ ! `echo $f| grep -q $FILE_OF_RESULTS `] ; then llxcfg-guard groupdel $f fi done # Adding to GUARD for f in $RESULTS ; do llxcfg-guard groupadd $f done delete_temp_files exit 0