diff --git a/scripts/create_archive.sh b/scripts/create_archive.sh new file mode 100644 index 0000000..f64ac3c --- /dev/null +++ b/scripts/create_archive.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Create an archive named with "$2", containing all files under "$1" +# and no subdir containing all others + +if (( $# != 2 )) ; then + echo "parameters not meet" + exit 1 +fi + +find "$1" -mindepth 1 -not -type d -printf "%P\n" | tar -C "$1" -cf "$2" --gzip -T - diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100644 index 0000000..e2be567 --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +# The http server not support data-form or x-www-url-encoded-form, +# so the archive file must just in the post body, so use --data-binary +# as curl argument. +# +# $1 is the archive path to be sent to http server +# $2 is the http server (including schema, host, port and path) +# +# Example: +# curl --data-binary @public.tar.gz http://localhost:8080/ + +if (( $# != 2 )) ; then + echo "parameter not meet" + exit 1 +fi + +curl --data-binary @"$1" "$2"