[mod] tools:deploy
This commit is contained in:
parent
1cc7ea746c
commit
64436d5d6a
68
tools/deploy
68
tools/deploy
|
|
@ -1,19 +1,59 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
## args
|
import sys as _sys
|
||||||
|
import os as _os
|
||||||
if [ $# -ge 1 ] ; then target_ssh_handle=$1 && shift ; else target_ssh_handle="gs-monitoring" ; fi
|
import argparse as _argparse
|
||||||
|
|
||||||
|
|
||||||
## exec
|
def main():
|
||||||
|
## args
|
||||||
|
argument_parser = _argparse.ArgumentParser()
|
||||||
|
argument_parser.add_argument(
|
||||||
|
type = str,
|
||||||
|
dest = "target_system",
|
||||||
|
metavar = "<target-system>",
|
||||||
|
help = "either 'localhost' or SSH handle of the target system",
|
||||||
|
)
|
||||||
|
argument_parser.add_argument(
|
||||||
|
"-t",
|
||||||
|
"--target-directory",
|
||||||
|
type = str,
|
||||||
|
dest = "target_directory",
|
||||||
|
default = "/opt/heimdall",
|
||||||
|
metavar = "<target-directory>",
|
||||||
|
help = "directory on the target system, where the files shall be put; default: /opt/heimdall",
|
||||||
|
)
|
||||||
|
argument_parser.add_argument(
|
||||||
|
"-b",
|
||||||
|
"--build-directory",
|
||||||
|
type = str,
|
||||||
|
dest = "build_directory",
|
||||||
|
default = "/tmp/heimdall",
|
||||||
|
metavar = "<build-directory>",
|
||||||
|
help = "directory to where the build was put",
|
||||||
|
)
|
||||||
|
args = argument_parser.parse_args()
|
||||||
|
|
||||||
rsync \
|
## exec
|
||||||
--rsh=ssh \
|
if (not _os.path.exists(args.build_directory)):
|
||||||
--recursive \
|
_sys.stderr.write("-- build directory not found; probably you need to run /tools/build\n")
|
||||||
--update \
|
_sys.exit(1)
|
||||||
--delete \
|
else:
|
||||||
--exclude 'node_modules' \
|
_os.system(
|
||||||
--verbose \
|
" ".join([
|
||||||
build/ \
|
"rsync",
|
||||||
${target_ssh_handle}:/opt/heimdall
|
"--recursive",
|
||||||
|
"--update",
|
||||||
|
"--verbose",
|
||||||
|
("%s/" % args.build_directory),
|
||||||
|
(
|
||||||
|
("%s" % args.target_directory)
|
||||||
|
if (args.target_system == "localhost") else
|
||||||
|
("%s:%s" % (args.target_system, args.target_directory, ))
|
||||||
|
),
|
||||||
|
])
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue