aboutsummaryrefslogtreecommitdiff
path: root/tools/etc/icpc/doclean.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/etc/icpc/doclean.sh')
-rwxr-xr-xtools/etc/icpc/doclean.sh29
1 files changed, 29 insertions, 0 deletions
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