Support --data-file instead of passing JSON as arguments
This is required for systemd-run, which limits the process argument length and makes the data get truncated https://github.com/coreos/fleet/issues/992
This commit is contained in:
@@ -23,14 +23,16 @@ chmod +x /home/yellowtent/provision.sh
|
|||||||
|
|
||||||
arg_source_tarball_url=""
|
arg_source_tarball_url=""
|
||||||
arg_data=""
|
arg_data=""
|
||||||
|
arg_data_file=""
|
||||||
|
|
||||||
args=$(getopt -o "" -l "sourcetarballurl:,data:" -n "$0" -- "$@")
|
args=$(getopt -o "" -l "sourcetarballurl:,data:,data-file:" -n "$0" -- "$@")
|
||||||
eval set -- "${args}"
|
eval set -- "${args}"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--sourcetarballurl) arg_source_tarball_url="$2";;
|
--sourcetarballurl) arg_source_tarball_url="$2";;
|
||||||
--data) arg_data="$2";;
|
--data) arg_data="$2";;
|
||||||
|
--data-file) arg_data_file="$2";;
|
||||||
--) break;;
|
--) break;;
|
||||||
*) echo "Unknown option $1"; exit 1;;
|
*) echo "Unknown option $1"; exit 1;;
|
||||||
esac
|
esac
|
||||||
@@ -38,6 +40,10 @@ while true; do
|
|||||||
shift 2
|
shift 2
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ ! -z ${arg_data_file} ]]; then
|
||||||
|
arg_data=$(cat "${arg_data_file}")
|
||||||
|
fi
|
||||||
|
|
||||||
box_src_tmp_dir=$(mktemp -dt box-src-XXXXXX)
|
box_src_tmp_dir=$(mktemp -dt box-src-XXXXXX)
|
||||||
echo "Downloading box code from ${arg_source_tarball_url} to ${box_src_tmp_dir}"
|
echo "Downloading box code from ${arg_source_tarball_url} to ${box_src_tmp_dir}"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user