Skip to content

Commit 5b6b3c4

Browse files
author
liranmauda
committed
clean_ova: skipping rm first_install.mrk on none azure
- skipping rm first_install.mrk on none azure - making sure that we insert a flag (—azure/—esx) - using getopt
1 parent 13e69c3 commit 5b6b3c4

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

src/deploy/NVA_build/clean_ova.sh

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
set -e
22
# TODO copied from first_install_diaglog.sh
3+
isAzure=false
4+
isesx=false
35
function clean_ifcfg() {
46
eths=$(ifconfig | grep eth | awk '{print $1}')
57
for eth in ${eths}; do
@@ -8,16 +10,44 @@ function clean_ifcfg() {
810
done
911
}
1012

11-
isAzure=${1}
13+
OPTIONS=$( getopt -o 'h,e,a' --long "help,esx,azure" -- "$@" )
14+
eval set -- "${OPTIONS}"
1215

13-
if [ "${isAzure}" == "azure" ] ; then
16+
function usage(){
17+
echo "$0 [options]"
18+
echo "-e --esx run this script on esx"
19+
echo "-a --azure run this script on azure"
20+
echo "-h --help will show this help"
21+
exit 0
22+
}
23+
24+
while true
25+
do
26+
case ${1} in
27+
-a|--azure) isAzure=true
28+
shift 1 ;;
29+
-e|--esx) isesx=true
30+
shift 1;;
31+
-h|--help) usage;;
32+
--) shift 1;
33+
break ;;
34+
esac
35+
done
36+
37+
if ! ${isAzure} && ! ${isesx}
38+
then
39+
usage
40+
fi
41+
42+
if ${isAzure}
43+
then
1444
echo "make sure no swap entry in fstab!"
1545
cat /etc/fstab
1646
else
1747
clean_ifcfg
18-
fi
48+
sudo rm /etc/first_install.mrk
49+
fi
1950
sudo rm /etc/noobaa_sec
20-
sudo rm /etc/first_install.mrk
2151
echo Passw0rd | passwd noobaaroot --stdin
2252
rm -f /var/log/*.log
2353
rm -f /var/log/*-*
@@ -41,7 +71,8 @@ sudo sysctl kernel.hostname=noobaa
4171
#reduce VM size
4272
set +e
4373
/sbin/swapoff -a
44-
if [ "${isAzure}" == "azure" ] ; then
74+
if ${isAzure}
75+
then
4576
echo "Azure - will not try to compress HD"
4677
else
4778
dd if=/dev/zero of=zeroFile.tmp bs=1M

0 commit comments

Comments
 (0)