dolibarr/dev/initdata/removedemo.sh

55 lines
1.4 KiB
Bash
Raw Normal View History

2008-10-03 19:00:17 +02:00
#!/bin/sh
#------------------------------------------------------
# Script to remove setup of a Dolibarr installation.
# Note: "dialog" tool need to be available.
#
2012-12-30 15:11:07 +01:00
# Regis Houssin - regis.houssin@capnetworks.com
2008-10-03 19:00:17 +02:00
# Laurent Destailleur - eldy@users.sourceforge.net
#------------------------------------------------------
2012-10-02 23:48:27 +02:00
# WARNING: This script erase setup of instance,
# but not the database
2008-10-03 19:00:17 +02:00
#------------------------------------------------------
2012-10-02 23:48:27 +02:00
export mydir=`echo "$0" | sed -e 's/removedemo.sh//'`;
if [ "x$mydir" = "x" ]
then
export mydir="./"
fi
export id=`id -u`;
# ----------------------------- check if root
if [ "x$id" != "x0" -a "x$id" != "x1001" ]
then
echo "Script must be ran as root"
exit
fi
2008-10-08 01:04:12 +02:00
2008-10-03 19:00:17 +02:00
DIALOG=${DIALOG=dialog}
DIALOG="$DIALOG --ascii-lines"
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Remove Dolibarr install" --clear \
--yesno "Do you confirm ?" 15 40
valret=$?
case $valret in
0)
base=`cat $fichtemp`;;
1)
exit;;
255)
exit;;
esac
# ---------------------------- remove conf file
2008-10-08 01:04:12 +02:00
echo "Remove file $mydir../../htdocs/conf/conf.php"
2008-12-28 06:22:00 +01:00
cp -pf $mydir../../htdocs/conf/conf.php $mydir../../htdocs/conf/conf.sav.php 2>/dev/null
2008-10-08 01:04:12 +02:00
rm $mydir../../htdocs/conf/conf.php 2>/dev/null
echo "Remove file $mydir../../install.lock"
rm $mydir../../install.lock 2>/dev/null
2012-10-02 23:48:27 +02:00
echo "Dolibarr setup has been removed (need to be installed again. database not dropped)."
2008-10-08 01:04:12 +02:00
echo