push addional code
[sdc.git] / openecomp-be / backend / openecomp-sdc-vendor-software-product-manager / src / test / resources / nimbus / mount_iso_script.sh
1 #!/bin/bash
2
3 #. .config 
4 #following would be in the .config file
5  device_name="/dev/vde"
6  install_script="install_nimbus.sh"
7  enable_logic_flag_file=".flag"
8 #end of config file
9
10 #get the semaphore, 0 - disbaled, 1- enabled
11 flag=$(cat ${enable_logic_flag_file})
12
13 #check if device is mounted already
14 test=$(mount | grep ${device_name})
15 if [ "$flag" == "1" ]; then
16         if [ -e ${device_name} ] && [ ! "${test}" ]; then
17                 #mount the iso image
18                 mount -t iso9660 -v -o loop /dev/vde/ /mnt/iso
19                 #if availabe run the install script (it contains the install.sh steps)
20                 if [ -e "${install_script}" ] && [ -f "${install_script}" ]; then
21                         ${install_script}
22                 fi
23                 #disable the script from attempting to 
24                 #  mount and run install again until needed;
25                 echo "0" > ${enable_logic_flag_file}
26                 #if nedeed add step to comment out the crontab line here;
27         fi
28 else
29         echo "Auto mounting ISO & run install logic disabled!"
30 fi
31
32 #cron job
33 # * * * * * /mount_iso_script.sh
34