removeconfdemo.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/sh
  2. #------------------------------------------------------
  3. # Script to remove setup of a Dolibarr installation.
  4. # Note: "dialog" tool need to be available.
  5. #
  6. # Regis Houssin - regis.houssin@inodbox.com
  7. # Laurent Destailleur - eldy@users.sourceforge.net
  8. #------------------------------------------------------
  9. # WARNING: This script erase setup of instance,
  10. # but not the database
  11. #------------------------------------------------------
  12. export mydir=`echo "$0" | sed -e 's/removedemo.sh//'`;
  13. if [ "x$mydir" = "x" ]
  14. then
  15. export mydir="./"
  16. fi
  17. export id=`id -u`;
  18. # ----------------------------- check if root
  19. if [ "x$id" != "x0" -a "x$id" != "x1001" ]
  20. then
  21. echo "Script must be ran as root"
  22. exit
  23. fi
  24. DIALOG=${DIALOG=dialog}
  25. DIALOG="$DIALOG --ascii-lines"
  26. fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
  27. trap "rm -f $fichtemp" 0 1 2 5 15
  28. $DIALOG --title "Remove Dolibarr install" --clear \
  29. --yesno "Do you confirm ?" 15 40
  30. valret=$?
  31. case $valret in
  32. 0)
  33. base=`cat $fichtemp`;;
  34. 1)
  35. exit;;
  36. 255)
  37. exit;;
  38. esac
  39. # ---------------------------- remove conf file
  40. echo "Remove file $mydir../../htdocs/conf/conf.php"
  41. cp -pf $mydir../../htdocs/conf/conf.php $mydir../../htdocs/conf/conf.sav.php 2>/dev/null
  42. rm $mydir../../htdocs/conf/conf.php 2>/dev/null
  43. echo "Remove file $mydir../../install.lock"
  44. rm $mydir../../install.lock 2>/dev/null
  45. echo "Dolibarr setup has been removed (need to be installed again. database not dropped)."
  46. echo