11#! /usr/bin/env bash
22
33# Directory in which this script resides
4- ANSIBLE_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
5-
6- TEMPLATE_FILE=" $ANSIBLE_DIR /roles/openshift_client_python/library/openshift_client_python.template.py"
7-
8- if [ -n " $1 " ]
9- then
10- echo " Running in container mode"
11- TEMP_DIR=" $1 "
12- OUTPUT_FILE=" $TEMP_DIR /openshift_client_python.py"
13- DIGEST_FILE=" $TEMP_DIR /rebuild_module.digest"
14- else
15- OUTPUT_FILE=" $ANSIBLE_DIR /roles/openshift_client_python/library/openshift_client_python.py"
16- DIGEST_FILE=" $ANSIBLE_DIR /rebuild_module.digest"
17- fi
4+ DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
5+
6+ TEMPLATE_FILE=" $DIR /roles/openshift_client_python/library/openshift_client_python.template.py"
7+ OUTPUT_FILE=" $DIR /roles/openshift_client_python/library/openshift_client_python.py"
188
199if [[ ! -f " $TEMPLATE_FILE " ]]; then
2010 echo " Unable to find template file: $TEMPLATE_FILE "
2111 exit 1
2212fi
2313
24- PACKAGES_DIR=" $ANSIBLE_DIR /../packages"
14+ PACKAGES_DIR=" $DIR /../packages"
2515if [[ ! -d " $PACKAGES_DIR " ]]; then
2616 echo " Unable to find packages directory: $PACKAGES_DIR "
2717 exit 1
2818fi
29- pushd " $PACKAGES_DIR "
3019
20+ pushd " $PACKAGES_DIR "
3121# Update module digest so that pr.groovy can ensure it is run after each module change
32- cat $( find openshift/ -name ' *.py' | sort -d) | md5sum > $DIGEST_FILE
33- ENCODED_TGZ=$( tar c --owner=0 --numeric-owner --group=0 --mtime=' UTC 2019-01-01' $( find openshift/ -name ' *.py' | sort -d) | gzip -c -n | base64 --wrap=0)
34-
22+ cat $( find openshift/ -name ' *.py' | sort) | md5sum > $DIR /rebuild_module.digest
23+ ENCODED_TGZ=$( tar c --owner=0 --numeric-owner --group=0 --mtime=' UTC 2019-01-01' $( find openshift/ -name ' *.py' | sort) | gzip -c -n | base64 --wrap=0)
3524popd
3625
3726echo " #!/usr/bin/env python" > $OUTPUT_FILE
@@ -56,4 +45,4 @@ done < "$TEMPLATE_FILE"
5645if [[ " $replaced " != " 1" ]]; then
5746 echo " Unable to find replacement pattern in template"
5847 exit 1
59- fi
48+ fi
0 commit comments