Add support for loading 9.0+ docs, which are no longer stored
authorMagnus Hagander <magnus@hagander.net>
Mon, 7 Jun 2010 11:55:27 +0000 (11:55 +0000)
committerMagnus Hagander <magnus@hagander.net>
Mon, 7 Jun 2010 11:55:27 +0000 (11:55 +0000)
in an embedded tarball. Retain support for loading the older
versions, of course...

git-svn-id: file:///Users/dpage/pgweb/svn-repo/trunk@2685 8f5c7a92-453e-0410-a47f-ad33c8a6b003

portal/tools/docs/load_docs.sh

index 5eac967eb7dfa959ad397f8927224c23cb4e2809..8e9a529439cb1a1233d56dd89fab698fc4712ee8 100755 (executable)
@@ -28,20 +28,29 @@ echo Uncompressing main tarball...
 tar xfz ../$TARBALL
 cd ..
 
-mkdir $MAJOR
-cd $MAJOR
-echo Uncompressing embedded tarball...
-find ../tmp -name postgres.tar.gz |xargs tar xfz
-cd ..
-
-if [ ! -f $MAJOR/index.html ]; then
-   echo Could not find index.html in uncompressed tarball
-   exit 1
+X=$(find tmp -name postgres.tar.gz |wc -l|sed -e 's/ //g')
+if [ "$X" == "0" ]; then
+   echo New style tarball with nothing embedded, loading docs
+   DIR=$(find tmp -type d -name html)
+   ./store $DIR $MAJOR $SERVER $DB $USER
+else
+   echo Old style tarball with embedded documentation tarball
+
+   mkdir $MAJOR
+   cd $MAJOR
+   echo Uncompressing embedded tarball...
+   find ../tmp -name postgres.tar.gz |xargs tar xfz
+   cd ..
+
+   if [ ! -f $MAJOR/index.html ]; then
+      echo Could not find index.html in uncompressed tarball
+      exit 1
+   fi
+
+   echo Loading into database...
+   ./store $MAJOR $MAJOR $SERVER $DB $USER
 fi
 
-echo Loading into database...
-./store $MAJOR $MAJOR $SERVER $DB $USER
-
 echo Cleaing up
 rm -rf $MAJOR
 rm -rf tmp