#!/bin/bash PATH_FOR_FLAGS="/etc/sabayon/" USERS_UNDER_THE_ICE="" USERS_ZENITY="" export TEXTDOMAIN="zero-sabayon" MSG_SABAYON="$(gettext "Do you want to be deleted all user data at home directories on each login?")" MSG_NETWORK_USERS="$(gettext "Your system are under a LDAP domain, if your are using a LliureX's classroom model, please use the Llum to manage these users")" get_users_under_ice() { echo "[DEBUG] get_users_under_ice " # Parse for f in $(ls -1 $PATH_FOR_FLAGS/deleteHome.*.flag) ; do TMP_USER=$(echo $(basename $f)|cut -d "." -f2 ) USERS_UNDER_THE_ICE="${USERS_UNDER_THE_ICE} $TMP_USER" done } get_users_under_ice_string() { # Ancient command # $(awk -F: '$6 ~ /\/home/ && $3 >= 1000 {print $1}' /etc/passwd | tr "\n" " " | sed -e "s%\([[:alnum:]]\+\)%\1 \1%g")) echo "[DEBUG]: get_users_under_ice_string" for u in $(awk -F: '$6 ~ /\/home/ && $3 >= 1000 {print $1}' /etc/passwd); do #if $u is on $USERS_UNDER_THE_ICE set the true checked if [[ "$USERS_UNDER_THE_ICE" =~ "${u}" ]] ; then USERS_ZENITY="$USERS_ZENITY TRUE" else USERS_ZENITY="$USERS_ZENITY FALSE" fi # DUPLICATE ALWAYS USERS_ZENITY="$USERS_ZENITY ${u}" done } ask_dialog() { get_users_under_ice get_users_under_ice_string USERS_TO_BE_RESET="$(zenity --list --checklist --text="$MSG_SABAYON" --column="" --column="Usuari" $USERS_ZENITY)" rm -r $PATH_FOR_FLAGS/deleteHome*.flag USERS_TO_BE_RESET=$(echo $USERS_TO_BE_RESET | tr "|" " ") for u in $USERS_TO_BE_RESET ; do touch /etc/sabayon/deleteHome.$u.flag done } are_under_classroom_model() { echo "[DEBUG]" eval $(llxcfg-showvars ENABLE_NSS_LDAP) if [ $ENABLE_NSS_LDAP = "yes" ] ; then zenity --info --text="$MSG_NETWORK_USERS" fi } are_under_classroom_model ask_dialog exit 0