diff options
author | B. Stack <bgstack15@gmail.com> | 2022-11-29 16:09:22 -0500 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-11-29 16:09:22 -0500 |
commit | 4a8ce7e2862b338a7f8e34d016a3119290239b0b (patch) | |
tree | 951ad8a52ddf31e489e4fab7c0d0c96947d6b0f4 /extra/pip-helper.sh | |
download | outbound-4a8ce7e2862b338a7f8e34d016a3119290239b0b.tar.gz outbound-4a8ce7e2862b338a7f8e34d016a3119290239b0b.tar.bz2 outbound-4a8ce7e2862b338a7f8e34d016a3119290239b0b.zip |
Diffstat (limited to 'extra/pip-helper.sh')
-rw-r--r-- | extra/pip-helper.sh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/extra/pip-helper.sh b/extra/pip-helper.sh new file mode 100644 index 0000000..e2dd700 --- /dev/null +++ b/extra/pip-helper.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# This file is part of the outbound package. +# It is designed to be run as root, and it will run the requisite pip commands for the discovered environment. + +contents="$( awk -F'=' '/ID=|VERSION_ID/{print $2}' /etc/os-release 2>/dev/null | sed -r -e 's/"//g;' )" +id="$( echo "${contents}" | sed -n -e '1p' )" +version_id="$( echo "${contents}" | sed -n -e '2p' )" + +echo "Any parameters sent to this script ${0} will be added to the list of packages to install." +piplist="${1}" + +if echo "${id}" | grep -qiE 'rhel|centos' ; +then + #if echo "${version_id}" | grep -qiE '7' ; + #then + piplist="${piplist} " + #fi +elif echo "${id}" | grep -qiE 'fedora' ; +then + piplist="${piplist} " +elif echo "${id}" | grep -qiE 'devuan|debian' ; +then + piplist="${piplist} " +else + echo "Unknown os from /etc/os-release. Please investigate what pip3" 1>&2 + echo "packages are required for this OS release and share it with upstream." 1>&2 + echo "Aborted." 1>&2 + exit 1 +fi + +if test -n "${piplist}" ; +then + echo "Will try to serially install with pip these packages: ${piplist}" + for word in ${piplist} ; do + su outbound -s /bin/sh -c "pip3 install --user ${word}" || exit 1 + done +fi |