Procházet zdrojové kódy

Made init catch missing tarball

arianagiroux před 1 měsícem
rodič
revize
05628c926a
1 změnil soubory, kde provedl 23 přidání a 5 odebrání
  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