1
0

dumper.sh 624 B

1234567891011121314151617181920
  1. #! /bin/sh
  2. # check for dump dir
  3. if [ -d /buildout ]; then
  4. # if there are no files in that directory use 777 perms as root
  5. if [ `find /buildout -prune -empty 2>/dev/null` ]; then
  6. /bin/mkdir -p /buildout/buildout
  7. /bin/cp -r /mnt/* /buildout/buildout/
  8. /bin/chmod 777 -R /buildout/buildout
  9. # match the ownership of the first file we see
  10. else
  11. PERMS=`/usr/bin/find /buildout/* -print -quit |xargs stat -c "%u:%g"`
  12. /bin/mkdir -p /buildout/buildout
  13. /bin/cp -r /mnt/* /buildout/buildout/
  14. /bin/chown $PERMS -R /buildout/buildout
  15. fi
  16. else
  17. /bin/echo "/buildout not found exiting"
  18. exit 1
  19. fi