3 # Path where will be created repository (in container)
6 # Path where is stored onap_rpm.list file
9 # Getting input parametters
17 echo -e "Docker entrypoint script for creating RPM repository\n"
18 echo "-h --help: Show this help"
19 echo "-d --directory: set path for repo directory in container"
20 echo -e "-l --list: set path where rpm list is stored in container\n"
21 echo "Both paths have to be set with shared volume between"
22 echo "container and host computer. Default path in container is: /tmp/"
23 echo "Repository will be created at: /<path>/resources/pkg/rhel/"
24 echo "RMP list is stored at: /<path>/offline-installer/build/data_list/"
30 # Directory parametter
31 # Sets path where will be created reposity
38 # Sets path where is stored onap_rpm.list file
49 POSITIONAL+=("$1") # save it in an array for later
55 # Testing if directory parametter was used
56 # If not variable is sets to default value /tmp/resources/pkg/rhel
57 if test -z "$OOM_REPO_DIR"
59 OOM_REPO_DIR="/tmp/resources/pkg/rhel"
62 # Testing if list parametter was used
63 # If not variable is sets to default value /tmp/data-list
64 if test -z "$RPM_LIST_DIR"
66 RPM_LIST_DIR="/tmp/offline-installer/build/data_list/"
71 mkdir $OOM_REPO_DIR -p
73 # Install createrepo package for create repository in folder
74 # and yum-utils due to yum-config-manager for adding docker repository
75 yum install createrepo yum-utils -y
77 # Add official docker repository
78 yum-config-manager --add-repo=https://download.docker.com/linux/centos/7/x86_64/stable/
80 # Download all packages from onap_rpm.list via yumdownloader to repository folder
81 for i in $(cat ${RPM_LIST_DIR}onap_rpm.list | awk '{print $1}');do yumdownloader --resolve --downloadonly --destdir=${OOM_REPO_DIR} $i -y; done
83 # In repository folder create repository
84 createrepo $OOM_REPO_DIR