summaryrefslogtreecommitdiffstats
path: root/build/create_repo.sh
diff options
context:
space:
mode:
authorJan Benedikt <j.benedikt@partner.samsung.com>2020-03-19 16:03:25 +0100
committerJan Benedikt <j.benedikt@partner.samsung.com>2020-04-30 09:38:41 +0200
commitfdec88ed10910485efc53e1e85b678a2f1a1180e (patch)
treeb98cb61f31fd3f87d0ff0484c4e55561d3e217b6 /build/create_repo.sh
parent2b0fb491053859a114064c4b4847916d909a5bec (diff)
Adding support for another packages lists
Adding support for another packages lists in create_repo script. Additional package lists is for packages which are for example helpful tools for debugging. Issue-ID: OOM-2340 Signed-off-by: Jan Benedikt <j.benedikt@partner.samsung.com> Change-Id: If0bcb437809b60d83ed92436adade086314ccfac
Diffstat (limited to 'build/create_repo.sh')
-rwxr-xr-xbuild/create_repo.sh54
1 files changed, 42 insertions, 12 deletions
diff --git a/build/create_repo.sh b/build/create_repo.sh
index 4403a4e3..fa53e688 100755
--- a/build/create_repo.sh
+++ b/build/create_repo.sh
@@ -15,16 +15,28 @@ container_offline_volume="/mnt/offline/"
# Path inside container where will be created repository
container_repo_volume="/mnt/repo/"
+# Path inside container where will be stored additional packages lists
+container_list_volume="/mnt/additional-lists/"
+
# Show help for using this script
help () {
- echo "Script for run docker container creating DEB or RPM repository"
- echo "Type of repository is created based on user input or if input is empty type of host OS"
- echo "usage: create_repo.sh [-d|--destination-repository output directory] [-c|--cloned-directory input directory] [-t|--target-platform (ubuntu/rhel/centos) target platform for repository]"
- echo "-h --help: Show this help"
- echo "-d --destination-repository: set path where will be stored RPM packages. Default value is current directory"
- echo "-c --cloned-directory: set path where is stored this script and docker-entrypoint script (offline-installer/build directory). Fill it just when you want to use different script/datalists"
- echo "-t --target-platform: set target platform for repository"
- echo "If build folder from offline repository is not specified will be used default path of current folder."
+cat <<EOF
+Script for run docker container creating DEB or RPM repository
+
+Type of repository is created based on user input or if input is empty type of host OS
+
+usage: create_repo.sh [-d|--destination-repository output directory] [-c|--cloned-directory input directory]
+ [-t|--target-platform centos target platform for repository]
+ [-a|----additional-lists path to additional package list]
+-h --help: Show this help
+-d --destination-repository: set path where will be stored RPM packages. Default value is current directory
+-c --cloned-directory: set path where is stored this script and docker-entrypoint script (offline-installer/build directory). Fill it just when you want to use different script/datalists
+-t --target-platform: set target platform for repository (ubuntu/rhel/centos)
+-a --additional-list: add additional packages list
+ can be used multiple times for more additional lists
+
+If build folder from offline repository is not specified will be used default path of current folder.
+EOF
}
# Get type of distribution
@@ -76,11 +88,16 @@ do
# Sets path where will be repository created
volume_repo_directory="$2"
;;
- -t|--type)
+ -t|--target-platform)
# Repository type (rpm/deb)
# Sets target platform for repository
target_input="$2"
;;
+ -a|--additional-list)
+ # Array with more packages lists
+ # Add more packages lists to download
+ additional_lists+=("$2")
+ ;;
*)
# unknown option
help # show help
@@ -124,15 +141,28 @@ if [ ! "$(docker ps -q -f name=$container_name)" ]; then
# run repo container
# name of container $container_name
# docker entrypoint script from mounted volume
- #
+ # with dynamic parameters
+ # mount additional packages lists to container
+ param_array=()
+ mounted_lists=()
+ param_array+=(--directory ${container_repo_volume})
+ param_array+=(--list ${container_offline_volume}data_lists/)
+ param_array+=(--packages-lists-path ${container_list_volume})
+ [[ ! ${#additional_lists[@]} -eq 0 ]] && \
+ for array_list in "${additional_lists[@]}";
+ do
+ param_array+=(--additional-list "${array_list##*/}") && \
+ mounted_lists+=(-v ${array_list}:${container_list_volume}${array_list##*/})
+ done
+
docker run -d \
--name $container_name \
-v ${volume_offline_directory}:${container_offline_volume} \
-v ${volume_repo_directory}:${container_repo_volume} \
+ "${mounted_lists[@]}" \
--rm \
--entrypoint="${container_offline_volume}docker-entrypoint.sh" \
-it ${docker_image} \
- --directory ${container_repo_volume} \
- --list ${container_offline_volume}data_lists/
+ "${param_array[@]}"
docker logs $(docker ps --filter "name=${container_name}" --format '{{.ID}}' -a) -f
fi