summaryrefslogtreecommitdiffstats
path: root/installer/opengnsys_uninstall.sh
diff options
context:
space:
mode:
Diffstat (limited to 'installer/opengnsys_uninstall.sh')
-rwxr-xr-xinstaller/opengnsys_uninstall.sh23
1 files changed, 15 insertions, 8 deletions
diff --git a/installer/opengnsys_uninstall.sh b/installer/opengnsys_uninstall.sh
index b70245dc..29879883 100755
--- a/installer/opengnsys_uninstall.sh
+++ b/installer/opengnsys_uninstall.sh
@@ -2,6 +2,14 @@
# Desinstalación de OpenGnSys.
+# Variables.
+OPENGNSYS="/opt/opengnsys" # Directorio de OpenGnSys
+OGIMG="images" # Directorio de imágenes del repositorio
+MYSQLROOT="passwordroot" # Clave de root de MySQL
+DATABASE="ogAdmBD" # Base de datos de administración
+OLDDATABASE="ogBDAdmin" # Antigua base de datos
+DBUSER="usuog" # Usuario de acceso a la base de datos
+
# Parar servicio.
echo "Uninstalling OpenGnSys services."
if [ -x /etc/init.d/opengnsys ]; then
@@ -10,7 +18,6 @@ if [ -x /etc/init.d/opengnsys ]; then
fi
# Eliminar bases de datos.
echo "Erasing OpenGnSys database."
-MYSQLROOT="passwordroot"
DROP=1
if ! mysql -u root -p"$MYSQLROOT" <<<"quit" 2>/dev/null; then
stty -echo
@@ -23,15 +30,15 @@ if ! mysql -u root -p"$MYSQLROOT" <<<"quit" 2>/dev/null; then
fi
fi
if test $DROP; then
- mysql -u root -p"$MYSQLROOT" <<<"DROP DATABASE ogBDAdmin;" 2>/dev/null
- mysql -u root -p"$MYSQLROOT" <<<"DROP DATABASE ogAdmBD;" 2>/dev/null
- mysql -u root -p"$MYSQLROOT" <<<"DROP USER 'usuog';" 2>/dev/null
- mysql -u root -p"$MYSQLROOT" <<<"DROP USER 'usuog'@'localhost';" 2>/dev/null
+ mysql -u root -p"$MYSQLROOT" <<<"DROP DATABASE $OLDDATABASE;" 2>/dev/null
+ mysql -u root -p"$MYSQLROOT" <<<"DROP DATABASE $DATABASE;" 2>/dev/null
+ mysql -u root -p"$MYSQLROOT" <<<"DROP USER '$DBUSER';" 2>/dev/null
+ mysql -u root -p"$MYSQLROOT" <<<"DROP USER '$DBUSER'@'localhost';" 2>/dev/null
fi
# Eliminar ficheros.
echo "Deleting OpenGnSys files."
-for dir in /opt/opengnsys/*; do
- if [ "$dir" != "/opt/opengnsys/images" ]; then
+for dir in $OPENGNSYS/*; do
+ if [ "$dir" != "$OPENGNSYS/$OGIMG" ]; then
rm -fr "$dir"
fi
done
@@ -40,5 +47,5 @@ rm -f /etc/init.d/opengnsys /etc/default/opengnsys
echo "Manual tasks:"
echo "- You may stop or uninstall manually all other services"
echo " (DHCP, PXE, TFTP, NFS, Apache, MySQL)."
-echo "- Delete repository directory \"/opt/opengnsys/images\""
+echo "- Delete repository directory \"$OGIMG\""