aboutsummaryrefslogtreecommitdiff
path: root/NvCloth/scripts/packman/packman.sh
diff options
context:
space:
mode:
Diffstat (limited to 'NvCloth/scripts/packman/packman.sh')
-rw-r--r--NvCloth/scripts/packman/packman.sh47
1 files changed, 32 insertions, 15 deletions
diff --git a/NvCloth/scripts/packman/packman.sh b/NvCloth/scripts/packman/packman.sh
index a892def..95bb161 100644
--- a/NvCloth/scripts/packman/packman.sh
+++ b/NvCloth/scripts/packman/packman.sh
@@ -1,15 +1,27 @@
#!/bin/bash
-PM_PACKMAN_VERSION=5.1
+PM_PACKMAN_VERSION=5.4.2
# Specify where packman command exists
export PM_INSTALL_PATH=$(dirname ${BASH_SOURCE})
+add_packages_root_to_file()
+{
+ FILE_PATH=$1
+ if [ -f "$FILE_PATH" ]; then
+ if ! grep -Fq "PM_PACKAGES_ROOT" $FILE_PATH ; then
+ echo "Adjusting $FILE_PATH"
+ echo -e "export PM_PACKAGES_ROOT=\$HOME/packman-repo\n" >> $FILE_PATH
+ fi
+ fi
+}
+
# The packages root may already be configured by the user
if [ -z "$PM_PACKAGES_ROOT" ]; then
- # Set variable permanently using .profile for this user
- echo "export PM_PACKAGES_ROOT=\$HOME/packman-repo" >> ~/.profile
- # Set variable temporarily in this process so that the following execution will work
+ # Set variable permanently using .profile for this user (if exists)
+ add_packages_root_to_file ~/.profile
+ add_packages_root_to_file ~/.bashrc
+ # Set variable temporarily in this process so that the following execution will work
export PM_PACKAGES_ROOT="${HOME}/packman-repo"
fi
@@ -30,7 +42,7 @@ fi
fetch_file_from_s3()
{
SOURCE=$1
- SOURCE_URL=http://packman.s3.amazonaws.com/$SOURCE
+ SOURCE_URL=http://packman-bootstrap.s3.amazonaws.com/$SOURCE
TARGET=$2
echo "Fetching $SOURCE from S3 ..."
if command -v wget >/dev/null 2>&1; then
@@ -58,25 +70,30 @@ if [ ! -f "$PM_MODULE" ]; then
fi
# For now assume python is installed on the box and we just need to find it
-if command -v python2 >/dev/null 2>&1; then
- export PM_PYTHON=python2
+if command -v python2.7 >/dev/null 2>&1; then
+ export PM_PYTHON=python2.7
+elif command -v python2 >/dev/null 2>&1; then
+ export PM_PYTHON=python2
else
export PM_PYTHON=python
fi
# Ensure 7za package exists:
-PM_7za_VERSION=16.02
-export PM_7za_PATH="$PM_PACKAGES_ROOT/chk/7za/$PM_7za_VERSION"
-if [ ! -f "$PM_7za_PATH" ]; then
- $PM_PYTHON "$PM_MODULE" install 7za $PM_7za_VERSION -r packman:cloudfront
- if [ "$?" -ne 0 ]; then
- echo "Failure while installing required 7za package"
- exit 1
+PM_7za_VERSION=16.02.2
+export PM_7za_PATH="$PM_PACKAGES_ROOT/7za/$PM_7za_VERSION"
+if [ ! -d "$PM_7za_PATH" ]; then
+ export PM_7za_PATH="$PM_PACKAGES_ROOT/chk/7za/$PM_7za_VERSION"
+ if [ ! -d "$PM_7za_PATH" ]; then
+ $PM_PYTHON "$PM_MODULE" install 7za $PM_7za_VERSION -r packman:cloudfront
+ if [ "$?" -ne 0 ]; then
+ echo "Failure while installing required 7za package"
+ exit 1
+ fi
fi
fi
# Generate temporary file name for environment variables:
-PM_VAR_PATH=`mktemp -u -t tmp.XXXXX.$$.pmvars`
+PM_VAR_PATH=`mktemp -u -t tmp.$$.pmvars.XXXXXX`
$PM_PYTHON -u "$PM_MODULE" $* --var-path="$PM_VAR_PATH"
exit_code=$?