Be specific about where to install Ansible

This commit is contained in:
Anthony Rose 2022-08-15 11:43:49 +01:00
parent 948ba826f0
commit 56673c5fde

View file

@ -14,22 +14,18 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
if [ x$1 != x ]; then if [ "x$1" == "x--help" ] || [ "x$1" == "x-h" ] || [ "x$1" == "x-?" ]
install_path=$1 then
if [ $(id -u) -eq 0 ]; then echo "Usage: $0 [install_path] [bin_path]"
bin_path=/usr/local/bin exit
else
bin_path="$HOME/.local/bin"
fi
elif [ $(id -u) -eq 0 ]; then
install_path=/opt/ansible
bin_path=/usr/local/bin
else
install_path="$HOME/opt/ansible"
bin_path="$HOME/.local/bin"
fi fi
install_path=${1:-/opt/ansible}
bin_path=${2:-/usr/local/bin}
echo "Install path: $install_path" echo "Install path: $install_path"
echo "Bin path: $bin_path" echo "Bin path: $bin_path"
echo "Press RETURN to continue, or Ctrl-C to cancel."
read
pipinstall () { pipinstall () {
if [ -r /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ]; then if [ -r /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ]; then
@ -41,7 +37,7 @@ pipinstall () {
} }
create_link () { create_link () {
ln -srf "$install_path/bin/$1" "$bin_path/$1" ln -sf "$install_path/bin/$1" "$bin_path/$1"
} }
py3cmd="$(command -v python3)" py3cmd="$(command -v python3)"