2019-12-20 00:07:17 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# exit on error
|
|
|
|
set -e
|
|
|
|
|
2019-12-23 17:28:49 +00:00
|
|
|
# parse arguments
|
2020-07-14 18:42:24 +01:00
|
|
|
dev=""
|
|
|
|
verbose=""
|
|
|
|
prefix=""
|
2020-09-11 23:05:49 +01:00
|
|
|
local=""
|
|
|
|
while getopts "dvlp:" opt; do
|
2019-12-23 17:28:49 +00:00
|
|
|
case ${opt} in
|
|
|
|
d)
|
2020-07-14 18:42:24 +01:00
|
|
|
dev="-d"
|
2019-12-23 17:28:49 +00:00
|
|
|
;;
|
2020-03-05 21:19:20 +00:00
|
|
|
v)
|
2020-07-14 18:42:24 +01:00
|
|
|
verbose="-v"
|
2020-03-05 21:19:20 +00:00
|
|
|
;;
|
2020-09-11 23:05:49 +01:00
|
|
|
l)
|
|
|
|
local="-l"
|
|
|
|
;;
|
2020-07-14 18:42:24 +01:00
|
|
|
p)
|
|
|
|
prefix="-p ${OPTARG}"
|
2020-04-16 18:16:35 +01:00
|
|
|
;;
|
2019-12-23 17:28:49 +00:00
|
|
|
\?)
|
2020-09-12 00:26:13 +01:00
|
|
|
echo "script usage: $(basename $0) [-v] [-d] [-l] [-p <prefix>]" >&2
|
2020-07-14 18:42:24 +01:00
|
|
|
echo "" >&2
|
|
|
|
echo "-v enable verbose install" >&2
|
|
|
|
echo "-d enable developer install" >&2
|
2020-09-11 23:05:49 +01:00
|
|
|
echo "-l enable local install, not compatible with developer install" >&2
|
2020-07-14 18:42:24 +01:00
|
|
|
echo "-p install prefix, defaults to /usr/local" >&2
|
2020-03-05 21:19:20 +00:00
|
|
|
exit 1
|
2019-12-23 17:28:49 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $((OPTIND - 1))
|
|
|
|
|
2020-09-26 21:09:33 +01:00
|
|
|
# install pre-reqs using yum/apt
|
|
|
|
if command -v apt &> /dev/null
|
|
|
|
then
|
|
|
|
echo "setup to install CORE using apt"
|
2020-07-14 18:42:24 +01:00
|
|
|
sudo apt install -y python3-pip python3-venv
|
2020-09-26 21:09:33 +01:00
|
|
|
elif command -v yum &> /dev/null
|
|
|
|
then
|
|
|
|
echo "setup to install CORE using yum"
|
2020-07-14 18:42:24 +01:00
|
|
|
sudo yum install -y python3-pip
|
2020-09-26 21:09:33 +01:00
|
|
|
else
|
|
|
|
echo "apt/yum was not found"
|
|
|
|
echo "install python3 and invoke to run the automated install"
|
|
|
|
echo "inv -h install"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-07-14 18:42:24 +01:00
|
|
|
|
2020-09-26 21:09:33 +01:00
|
|
|
# install pip/invoke to run install with provided options
|
2020-07-14 18:42:24 +01:00
|
|
|
python3 -m pip install --user pipx
|
|
|
|
python3 -m pipx ensurepath
|
|
|
|
export PATH=$PATH:~/.local/bin
|
|
|
|
pipx install invoke
|
2020-09-11 23:05:49 +01:00
|
|
|
inv install ${dev} ${verbose} ${local} ${prefix}
|