-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·54 lines (43 loc) · 1.18 KB
/
bootstrap.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
set -u
set -v
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source $SCRIPT_DIR/utilities.sh > /dev/null
Help()
{
# Display Help
echo "This script Execute will change the user inside the container to your local user to avoid permission issues."
echo
printf "\n\33[32mSyntax: bootstrap.sh [-h | -d] [tag]\33[0m\n"
echo
echo "Options:"
echo " h Print this Help."
echo " d Not duplicate image. If provided, the original image will be overwritten. If not provided, the username will be appended to the tag and the original image will be kept."
echo
echo "Arguments:"
echo " tag The tag of the image to be boostrapped."
echo
}
export DUPLICATE_IMAGE=true
while getopts ":h:d" option; do
case $option in
h) # display Help
Help
exit;;
d) # not duplicate image
export DUPLICATE_IMAGE=false
;;
\?) # incorrect option
echo "Error: Invalid option"
exit;;
esac
done
# if no arguments supplied, display usage
if [ $# -le 0 ]; then
Help
exit 1
fi
# TAG is the last argument
TAG=${@: -1}
boostrap agilepy $TAG $DUPLICATE_IMAGE