From 792d2dd0caa09c5e5d15fbdeca2249e217568fca Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Mon, 8 Sep 2014 16:35:47 +0200 Subject: [PATCH] [populate_foward] Proprification suite au changement des homes --- populate_forward.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/populate_forward.sh b/populate_forward.sh index b492c9c..70d86ee 100755 --- a/populate_forward.sh +++ b/populate_forward.sh @@ -2,17 +2,18 @@ # Remplir le fichier forward -USER=legallic - -FILE=/home/${USER}/forwards if [ $EUID -eq 0 ] then + USER=${SUDO_USER} + HOMEDIR=$(getent passwd ${USER} | cut -d ":" -f 6) + FILE=${HOMEDIR}/forwards + touch ${FILE} chown ${USER}:users ${FILE} chmod 600 ${FILE} - find /home -mindepth 1 -maxdepth 1 -type d | sort | \ + find /home -mindepth 2 -maxdepth 2 -type d | sort | \ while read -r dossier; do if test -f ${dossier}/.forward; -- 2.39.2