-
Notifications
You must be signed in to change notification settings - Fork 46
/
gaas_refresh_bin.sh
executable file
·44 lines (34 loc) · 1.29 KB
/
gaas_refresh_bin.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
#!/bin/bash
cd bin
if [[ ! ${PWD##*/} == "bin" ]];then
echo "The script must be run in GAAS/bin folder"
echo "currently here `pwd`"
exit
fi
#While looking at all script within the repo we skip all Deprecated folder and what it contains
for i in $(find ../ -not \( -path */Deprecated -prune \) -not \( -path */terraform/* -prune \) -not \( -path */bin -prune \) -not \( -path */blib -prune \) -name '*.pl' -o -name '*.sh' -o -name '*.py' -o -name '*.r' -o -name '*.R' -o -name '*.rb');do
name=$(basename $i)
# skip gaas_refresh_list.sh because must not be in the bin to avoid to be distributed
if [[ $name == "gaas_refresh_bin.sh" || $name == "run_proxy.sh" || $name == "refresh_cert.sh"
|| $name == "get_cert_first.sh" || $name == "verify.sh" ]] ; then
continue
fi
# add new script
if [[ ! -f ${name} ]];then
while true; do
copyfile="no"
read -p "The script ${name} does not exist in /bin. Do you want to add it? (yes/y or no/n)" yn
case $yn in
[Yy]* ) copyfile="yes"; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
if [[ $copyfile == "yes" ]];then
cp $i .
fi
else # upadte script
echo -e "copy $i into /bin"
cp $i .
fi
done