X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=database_utils%2Fdump_db.sh;h=89c83f02fedca7aea893155972deab76c17b12c7;hb=88b676c8c572277e2487c309be6daace6bed0ee9;hp=dfd5bbf9bd67b985aac968fbc0dad35a7621bade;hpb=7edb675ac76f3e0473042cf5cf7de3c0f19eda7d;p=osm%2FRO.git diff --git a/database_utils/dump_db.sh b/database_utils/dump_db.sh index dfd5bbf9..89c83f02 100755 --- a/database_utils/dump_db.sh +++ b/database_utils/dump_db.sh @@ -1,7 +1,7 @@ #!/bin/bash ## -# Copyright 2015 Telefónica Investigación y Desarrollo, S.A.U. +# Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U. # This file is part of openmano # All Rights Reserved. # @@ -22,6 +22,28 @@ ## +LICENSE_HEAD='/** +* Copyright 2017 Telefonica Investigacion y Desarrollo, S.A.U. +* This file is part of openmano +* All Rights Reserved. +* +* Licensed under the Apache License, Version 2.0 (the "License"); you may +* not use this file except in compliance with the License. You may obtain +* a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +* License for the specific language governing permissions and limitations +* under the License. +* +* For those usages not covered by the Apache License, Version 2.0 please +* contact with: nfvlabs@tid.es +**/ +' + DBUSER="mano" DBPASS="" DBHOST="localhost" @@ -32,7 +54,7 @@ DBNAME="mano_db" MYSQL=$(which mysql) AWK=$(which awk) GREP=$(which grep) -DIRNAME=`dirname $0` +DIRNAME=`dirname $(readlink -f $0)` function usage(){ echo -e "Usage: $0 OPTIONS" @@ -107,16 +129,19 @@ done #echo structure, including the content of schema_version -mysqldump $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ --no-data --add-drop-table --add-drop-database --routines --databases $DBNAME > ${DIRNAME}/${DBNAME}_structure.sql +echo "$LICENSE_HEAD" > ${DIRNAME}/${DBNAME}_structure.sql +mysqldump $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ --no-data --add-drop-table --add-drop-database --routines --databases $DBNAME >> ${DIRNAME}/${DBNAME}_structure.sql echo -e "\n\n\n\n" >> ${DIRNAME}/${DBNAME}_structure.sql mysqldump $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ --no-create-info $DBNAME --tables schema_version 2>/dev/null >> ${DIRNAME}/${DBNAME}_structure.sql echo " ${DIRNAME}/${DBNAME}_structure.sql" #echo only data -mysqldump $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ --no-create-info $DBNAME > ${DIRNAME}/${DBNAME}_data.sql +echo "$LICENSE_HEAD" > ${DIRNAME}/${DBNAME}_data.sql #copy my own header +mysqldump $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ --no-create-info $DBNAME >> ${DIRNAME}/${DBNAME}_data.sql echo " ${DIRNAME}/${DBNAME}_data.sql" #echo all -mysqldump $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ --add-drop-table --add-drop-database --routines --databases $DBNAME > ${DIRNAME}/${DBNAME}_all.sql +echo "$LICENSE_HEAD" > ${DIRNAME}/${DBNAME}_all.sql #copy my own header +mysqldump $DBHOST_ $DBPORT_ $DBUSER_ $DBPASS_ --add-drop-table --add-drop-database --routines --databases $DBNAME >> ${DIRNAME}/${DBNAME}_all.sql echo " ${DIRNAME}/${DBNAME}_all.sql"