Parcourir la source

Add a simple shell script to ease migration

Baptiste Jonglez il y a 9 ans
Parent
commit
cb6c0af949
2 fichiers modifiés avec 27 ajouts et 0 suppressions
  1. 3 0
      UPGRADE.md
  2. 24 0
      upgrade/import_single_pano.sh

+ 3 - 0
UPGRADE.md

@@ -98,4 +98,7 @@ image) for importing into the databse.  A copy of the image file will be
 put into the `media/pano` directory, meaning you can remove the original
 image file once you ensured that the import process went smoothly.
 
+For convenience, a simple shell script that does exactly the above is provided:
+`upgrade/import_single_pano.sh`.
+
 Then, you need to regenerate tiles for the imported panorama (see above).

+ 24 - 0
upgrade/import_single_pano.sh

@@ -0,0 +1,24 @@
+#!/bin/sh
+
+if [ -z "$2" ]
+then
+  echo "Usage: $0 <site.params> <panorama.tif>"
+  echo "Import a panorama into the Django database."
+  exit
+fi
+
+param_file="$1"
+pano_file="$2"
+
+for file in "$param_file" "$pano_file"
+do
+  if [ ! -f "$file" ]
+  then
+    echo "Error: file '$file' not found"
+    exit
+  fi
+done
+
+DIRNAME="$(dirname $0)"
+
+php "$DIRNAME"/export_single_pano.php "$param_file" | "$DIRNAME"/../manage.py import_single_pano "$pano_file"