forked from CSCfi/hpc-container-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.sh
executable file
·29 lines (25 loc) · 1.47 KB
/
post.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
set -e
set -u
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
source $SCRIPT_DIR/common_functions.sh
source $CW_BUILD_TMPDIR/_vars.sh
print_info "Installing to $CW_INSTALLATION_PREFIX" 1
if [[ ${CW_UPDATE_INSTALLATION+defined } && "$CW_UPDATE_INSTALLATION" == "yes" ]];then
# This might fail if the installation resides on a lustre file system
# And is being used by another client while we try to remove the bin directory
# Due to the bin being using in a filesystem mount
# This would produce the error "rm: 'cannot remove Path/to/bin': Device or resource busy"
rm -fr $CW_INSTALLATION_PREFIX/bin || print_warn "Failed to remove $CW_INSTALLATION_PREFIX/bin due to it being in use\n\tContinuing anyway"
rm -fr $CW_INSTALLATION_PREFIX/_bin
rm -fr $CW_INSTALLATION_PREFIX/share
fi
cp -rd $CW_BUILD_TMPDIR/_deploy/* $CW_INSTALLATION_PREFIX/
mkdir -p $CW_INSTALLATION_PREFIX/share
if [[ ${CW_INSTALLATION_FILE_PATHS+defined} ]];then
cp -r $CW_BUILD_TMPDIR/_inst_dir/previous_input* $CW_INSTALLATION_PREFIX/share
fi
echo "tag: $(cd $SCRIPT_DIR; git describe --tags 2>/dev/null)" > $CW_INSTALLATION_PREFIX/share/VERSION.yml
echo "commit: $(cd $SCRIPT_DIR; git rev-parse --short HEAD 2>/dev/null )" >> $CW_INSTALLATION_PREFIX/share/VERSION.yml
echo "build-time: $(date)" >> $CW_INSTALLATION_PREFIX/share/VERSION.yml
cp $CW_BUILD_TMPDIR/conf.yaml $CW_INSTALLATION_PREFIX/share
rm -rf $CW_BUILD_TMPDIR