Skip to content

Commit

Permalink
Update 2.0.1to2.1.0.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoLechemia authored Jun 2, 2019
1 parent c5a6882 commit bab3dba
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions data/migrations/2.0.1to2.1.0.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

currentdir=${PWD##*/}
#!/bin/bash

# faux sudo car sinon la commande "sudo -n -u" ne le demande pas
sudo ls
Expand All @@ -10,6 +9,7 @@ touch ../../var/log/migration_2.0.1_to_2.1.0.log

# retour a la racine
cd ../../
currentdir=$PWD

# Make sure root cannot run our script
if [ "$(id -u)" == "0" ]; then
Expand All @@ -26,7 +26,10 @@ echo "Creating 'gn_sensitivity' schema"
export PGPASSWORD=$user_pg_pass;psql -h $db_host -U $user_pg -d $db_name -f data/core/sensitivity.sql &>> var/log/migration_2.0.1_to_2.1.0.log
echo "Insert 'gn_sensitivity' data"
wget --cache=off https://geonature.fr/data/inpn/sensitivity/181201_referentiel_donnes_sensibles.csv -P tmp/geonature
sudo -n -u postgres -s psql -d $db_name -f data/core/sensitivity_data.sql &>> var/log/migration_2.0.1_to_2.1.0.log
cp data/core/sensitivity_data.sql tmp/geonature/sensitivity_data.sql
sed -i 's#'/tmp/geonature'#'$currentdir/tmp/geonature'#g' tmp/geonature/sensitivity_data.sql

sudo -n -u postgres -s psql -d $db_name -f tmp/geonature/sensitivity_data.sql &>> var/log/migration_2.0.1_to_2.1.0.log


# si no grid on exit
Expand Down

0 comments on commit bab3dba

Please sign in to comment.