2019-12-20 00:07:17 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# exit on error
|
|
|
|
set -e
|
|
|
|
|
2019-12-21 07:45:05 +00:00
|
|
|
# detect os/ver for install type
|
|
|
|
os=""
|
|
|
|
if [[ -f /etc/os-release ]]; then
|
2019-12-23 17:28:49 +00:00
|
|
|
. /etc/os-release
|
|
|
|
os=${ID}
|
2019-12-20 00:07:17 +00:00
|
|
|
fi
|
2019-12-21 07:45:05 +00:00
|
|
|
|
2019-12-23 17:28:49 +00:00
|
|
|
# parse arguments
|
2020-07-14 18:42:24 +01:00
|
|
|
dev=""
|
|
|
|
verbose=""
|
|
|
|
prefix=""
|
|
|
|
while getopts "dvp:" 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-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-07-14 18:42:24 +01:00
|
|
|
echo "script usage: $(basename $0) [-d] [-v]" >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "-v enable verbose install" >&2
|
|
|
|
echo "-d enable developer install" >&2
|
|
|
|
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-07-14 18:42:24 +01:00
|
|
|
echo "installing CORE for ${os}"
|
|
|
|
case ${os} in
|
|
|
|
"ubuntu")
|
|
|
|
sudo apt install -y python3-pip python3-venv
|
|
|
|
;;
|
|
|
|
"centos")
|
|
|
|
sudo yum install -y python3-pip
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "unknown OS ID ${os} cannot install"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
python3 -m pip install --user pipx
|
|
|
|
python3 -m pipx ensurepath
|
|
|
|
export PATH=$PATH:~/.local/bin
|
|
|
|
pipx install invoke
|
|
|
|
inv install ${dev} ${verbose} ${prefix}
|