Ver código fonte

Made init catch missing tarball

arianagiroux 1 mês atrás
pai
commit
05628c926a
1 arquivos alterados com 23 adições e 5 exclusões
  1. 23 5
      init.sh

+ 23 - 5
init.sh

@@ -1,19 +1,37 @@
 #! /bin/sh
 
+ls | grep "writefreely.*.tar" &> /dev/null
+if [ $? -ne 0 ]; then
+	echo "could not find a writefreely tarball that fit the grep pattern 'writefreely.*.tar'"
+	exit 1
+fi
+
 echo "Running writefreely bootstrap"
-cp production/writefreely*.tar* bootstrap/
+cp writefreely*.tar* bootstrap/
 
 pushd bootstrap
 docker build -t writefreely-bootstrap .
 docker run -it --rm -v ./data:/data writefreely-bootstrap
-if [ $? -ne 0 ]; then
+if [ $? -ne 0 ]; then									# catch errors
 	exit 1
 fi
+
 docker image rm writefreely-bootstrap # cleanup
-rm writefreely*.tar* # cleanup
+rm writefreely*.tar* 									# cleanup
 
 popd
-cp bootstrap/data/* production/
+cp writefreely*.tar* 	production/ 		# data prep
+if [ $? -ne 0 ]; then									# catch errors
+	exit 1
+fi
+cp bootstrap/data/* 	production/ 		# data prep
+if [ $? -ne 0 ]; then									# catch errors
+	exit 1
+fi
 
 pushd production
-docker compose build
+docker compose build									# generate image
+if [ $? -ne 0 ]; then									# catch errors
+	echo "build failed!"
+	exit 1
+fi