From be2491b093b1f0ca430bede679ecbb670041e483 Mon Sep 17 00:00:00 2001 From: cassio Date: Tue, 2 Jul 2013 09:46:45 +0400 Subject: restructuring of boca's git --- tools/etc/icpc/doclean.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 tools/etc/icpc/doclean.sh (limited to 'tools/etc/icpc/doclean.sh') diff --git a/tools/etc/icpc/doclean.sh b/tools/etc/icpc/doclean.sh new file mode 100755 index 0000000..40b49c1 --- /dev/null +++ b/tools/etc/icpc/doclean.sh @@ -0,0 +1,29 @@ +#!/bin/bash +cd /home +if [ -f /home/icpc/.cleandisk.sh ]; then +rm -rf /home/icpc +find /home -user icpc -delete +if [ -x /usr/bin/makepasswd ]; then + pass=`echo -n icpc | /usr/bin/makepasswd --clearfrom - --crypt-md5 | cut -d'$' -f2-` + pass=\$`echo $pass` + id -u icpc >/dev/null 2>/dev/null + if [ $? != 0 ]; then + useradd -d /home/icpc -k /etc/skel -m -p "$pass" -s /bin/bash -g users icpc + else + usermod -d /home/icpc -p "$pass" -s /bin/bash -g users icpc + fi +fi +for i in media mnt var opt tmp usr; do + find /$i -user icpc -delete +done +if [ ! -d /home/icpc ]; then + rm -rf /home/icpc + rm -rf /home/skel + cp -ar /etc/skel/ /home + mv /home/skel /home/icpc +fi +chown -R icpc.users /home/icpc +chmod -R u+rwx /home/icpc +fi +cd - >/dev/null +exit 0 -- cgit v1.2.3