4 # Copyright 2016-2017 VMware Inc.
5 # This file is part of ETSI OSM
8 # Licensed under the Apache License, Version 2.0 (the "License"); you may
9 # not use this file except in compliance with the License. You may obtain
10 # a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 # License for the specific language governing permissions and limitations
20 # For those usages not covered by the Apache License, Version 2.0 please
21 # contact: osslegalrouting@vmware.com
25 ################################################################
26 ##### Installing Required Packages #####
27 ################################################################'
29 # Paths to copy application files
30 Install_dir
="/usr/local/bin"
31 App_dir
="$( cd "$
( dirname "${BASH_SOURCE[0]}" )" && pwd )"
32 Converter_App_CLI_path
="${App_dir}/ovf_converter_cli.py"
33 Converter_Install_CLI_path
="${Install_dir}/OVF_converter/ovf_converter_cli.py"
34 Uploader_App_CLI_path
="${App_dir}/ovf_uploader_cli.py"
35 Uploader_Install_CLI_path
="${Install_dir}/OVF_converter/ovf_uploader_cli.py"
36 Logs_Folder
="${Install_dir}/OVF_converter/logs"
38 #Function to install packages using apt-get
39 function install_packages
(){
40 [ -x /usr
/bin
/apt-get
] && apt-get
install -y $
*
42 #check properly installed
45 PACKAGE_INSTALLED
="no"
46 [ -x /usr
/bin
/apt-get
] && dpkg
-l $PACKAGE &>> /dev
/null
&& PACKAGE_INSTALLED
="yes"
47 if [ "$PACKAGE_INSTALLED" = "no" ]
49 echo "failed to install package '$PACKAGE'. Revise network connectivity and try again" >&2
55 apt-get update
# To get the latest package lists
56 install_packages
"libxml2-dev libxslt-dev python-dev python-pip python-lxml python-yaml"
57 install_packages
"qemu-utils"
59 #apt-get install <package name> -y
61 #Move OVF Converter to usr/bin
62 cp -R "${App_dir}" "${Install_dir}"
64 #Create logs folder and file
65 mkdir
"${Logs_Folder}"
68 chmod -R 777 ${Converter_Install_CLI_path}
69 chmod -R 777 ${Uploader_Install_CLI_path}
70 chmod -R 777 ${Logs_Folder}
72 touch "${Install_dir}/ovf_converter"
73 echo "#!/bin/sh" > "${Install_dir}/ovf_converter"
74 echo "python3 ${Converter_Install_CLI_path} \"\$@\"" >> "${Install_dir}/ovf_converter"
75 chmod a
+x
"${Install_dir}/ovf_converter"
77 touch "${Install_dir}/ovf_uploader"
78 echo "#!/bin/sh" > "${Install_dir}/ovf_uploader"
79 echo "python3 ${Uploader_Install_CLI_path} \"\$@\"" >> "${Install_dir}/ovf_uploader"
80 chmod a
+x
"${Install_dir}/ovf_uploader"
82 echo "Installation complete. More information can be found at:"
83 echo " ${Install_dir}/OVF_converter/Usage.txt"