changeset 865:8c69e0c2e6af

Stand-alone invocation support
author HIROSE Yuuji <yuuji@gentei.org>
date Wed, 02 Sep 2020 17:09:24 +0900
parents 45e95d6ee863
children a2e2bf4ee7eb
files s4-migrate.sh
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/s4-migrate.sh	Fri Aug 07 22:27:04 2020 +0900
+++ b/s4-migrate.sh	Wed Sep 02 17:09:24 2020 +0900
@@ -22,6 +22,14 @@
 
 query "ATTACH DATABASE \"$dstdb\" AS dst;" || abort "Cannot attach db #{dstdb}"
 
+if [ -z "$tmpd" ]; then
+  tmpd=`tmpd=$tmpdir mktempd`	# If called from command line
+  if [ -z "$tmpd" -o ! -w "$tmpd" ]; then
+    err "-- Cannot detect temporary directory [$tmpd] --"
+    exit 2
+  fi
+  trap "rm -r $tmpd" EXIT INT HUP
+fi
 failure=0
 for grid; do
   grid=$((0 + $grid))

yatex.org