#!/bin/sh
#
if [ -n "$DISPLAY" ]; then
echo "FireFOX etc. may have left temporary files in /tmp that are using space.
I will delete any files in /tmp that have been created since you started X,
or the last time you ran cleantmp. Click [okay] to delete the temporary files!
Don't store anything in /tmp, because it will be deleted! " | \
xmessage -nearmouse -file - || exit

if [ -f /tmp/timestamp ]; then
  echo "
  CleanTMP: DONE! This is before and after in KB and MB.
  
  Before CleanTMP:" >/tmp/cleantmp
  df -k / >>/tmp/cleantmp
  df -m / >>/tmp/cleantmp
  cd /tmp && find * -type f -newer timestamp ! -name wget_dir ! -name xinit.error ! -name cleantmp -exec rm -f '{}' \;
fi
  echo "Don't delete this file!" >/tmp/timestamp
  echo "
  After CleanTMP:" >>/tmp/cleantmp
  df -k / >>/tmp/cleantmp
  df -m / >>/tmp/cleantmp
  xmessage -nearmouse -file /tmp/cleantmp
fi
