From 56673c5fde91f84b5a521965ff3f07232e77a5da Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Mon, 15 Aug 2022 11:43:49 +0100 Subject: [PATCH] Be specific about where to install Ansible --- ansible-setup.sh | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/ansible-setup.sh b/ansible-setup.sh index e051240..f1106fb 100755 --- a/ansible-setup.sh +++ b/ansible-setup.sh @@ -14,22 +14,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -if [ x$1 != x ]; then - install_path=$1 - if [ $(id -u) -eq 0 ]; then - bin_path=/usr/local/bin - 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" +if [ "x$1" == "x--help" ] || [ "x$1" == "x-h" ] || [ "x$1" == "x-?" ] +then + echo "Usage: $0 [install_path] [bin_path]" + exit fi + +install_path=${1:-/opt/ansible} +bin_path=${2:-/usr/local/bin} echo "Install path: $install_path" echo "Bin path: $bin_path" +echo "Press RETURN to continue, or Ctrl-C to cancel." +read pipinstall () { if [ -r /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem ]; then @@ -41,7 +37,7 @@ pipinstall () { } create_link () { - ln -srf "$install_path/bin/$1" "$bin_path/$1" + ln -sf "$install_path/bin/$1" "$bin_path/$1" } py3cmd="$(command -v python3)"