3 # Path where will be created repository (in container)
6 # Path where is stored onap_rpm.list file
10 echo -e "Docker entrypoint script for creating RPM repository\n"
11 echo "usage: create-repo.sh [-d|--directory output directory] [-l|--list input rpm list directory]"
12 echo "-h --help: Show this help"
13 echo "-d --directory: set path for repo directory in container"
14 echo -e "-l --list: set path where rpm list is stored in container\n"
15 echo "Both paths have to be set with shared volume between"
16 echo "container and host computer. Default path in container is: /tmp/"
17 echo "Repository will be created at: /<path>/resources/pkg/rpm/"
18 echo "RMP list is stored at: ./data_list/"
21 # Getting input parametters
23 if [[ $# -eq 0 ]] ; then
36 # Directory parametter
37 # Sets path where will be created reposity
42 # Sets path where is stored onap_rpm.list file
54 # Testing if directory parametter was used
55 # If not variable is sets to default value /tmp/repo/resources/pkg/rpm
56 if test -z "$OFFLINE_REPO_DIR"
58 OFFLINE_REPO_DIR="/tmp/repo/"
61 # Testing if list parametter was used
62 # If not variable is sets to default value /tmp/offline/data-list
63 if test -z "$RPM_LIST_DIR"
65 RPM_LIST_DIR="/tmp/offline/data_list/"
69 # Install createrepo package for create repository in folder
70 # and yum-utils due to yum-config-manager for adding docker repository
71 yum install createrepo yum-utils -y
73 # Add official docker repository
74 yum-config-manager --add-repo=https://download.docker.com/linux/centos/7/x86_64/stable/
76 # Download all packages from onap_rpm.list via yumdownloader to repository folder
77 for i in $(cat ${RPM_LIST_DIR}onap_rpm.list | awk '{print $1}');do yumdownloader --resolve --downloadonly --destdir=${OFFLINE_REPO_DIR} $i -y; done
79 # In repository folder create repository
80 createrepo $OFFLINE_REPO_DIR