diff options
Diffstat (limited to 'buildtools/packman5/packman')
| -rwxr-xr-x | buildtools/packman5/packman | 49 |
1 files changed, 32 insertions, 17 deletions
diff --git a/buildtools/packman5/packman b/buildtools/packman5/packman index c16a2a7..a2fb94f 100755 --- a/buildtools/packman5/packman +++ b/buildtools/packman5/packman @@ -1,15 +1,27 @@ #!/bin/bash -PM_PACKMAN_VERSION=5.2.1 +PM_PACKMAN_VERSION=5.7.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 @@ -20,17 +32,17 @@ if [ ! -d "$PM_PACKAGES_ROOT" ]; then fi # The packman module may be externally configured -if [ -z "$PM_MODULE_EXT" ]; then +if [ -z "$PM_MODULE_DIR_EXT" ]; then PM_MODULE_DIR="$PM_PACKAGES_ROOT/packman-common/$PM_PACKMAN_VERSION" - export PM_MODULE="$PM_MODULE_DIR/packman.py" else - export PM_MODULE="$PM_MODULE_EXT" + PM_MODULE_DIR="$PM_MODULE_DIR_EXT" fi +export PM_MODULE="$PM_MODULE_DIR/packman.py" 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 @@ -67,20 +79,23 @@ else fi # Ensure 7za package exists: -PM_7za_VERSION=16.02.2 -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.4 +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 -s -u -E "$PM_MODULE" pull "$PM_MODULE_DIR/deps.packman.xml" + 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" +$PM_PYTHON -s -u -E "$PM_MODULE" "$@" --var-path="$PM_VAR_PATH" exit_code=$? # Export the variables if the file was used and remove the file: if [ -f "$PM_VAR_PATH" ]; then |