summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-10-27 10:50:35 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-10-28 11:53:35 +0100
commit237a92210196a0583728573d4f53f87b7d16a482 (patch)
treef08c2d106a2cd44ecdd138d91b1ef9cf8fc38521
parent54286a345710b0b73e1b58e8c2fa4caa54bed48e (diff)
Fix English in comments; fix script synopsis text
Change-Id: I6a67a8e675bdde8d9febc3edf8205c7516d979b8 Issue-ID: OOM-2612 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
-rwxr-xr-xbuild/create_repo.sh59
-rwxr-xr-xbuild/docker-entrypoint.sh63
2 files changed, 59 insertions, 63 deletions
diff --git a/build/create_repo.sh b/build/create_repo.sh
index 9ca0b4ca..8fce53cc 100755
--- a/build/create_repo.sh
+++ b/build/create_repo.sh
@@ -1,45 +1,45 @@
#!/usr/bin/env bash
-# Set type of distribution
+# Set distribution type
distro_type="$(cat /etc/*-release | grep -w "ID" | awk -F'=' '{ print $2 }' | tr -d '"')"
-# Path to folder with cloned offline-installer build directory with docker_entrypoint script
+# Path to cloned offline-installer build directory with docker_entrypoint script
volume_offline_directory="$(readlink -f $(dirname ${0}))"
-# Path for directory where repository will be created
+# Destination path for created repository
volume_repo_directory="$(pwd)"
# Path inside container with cloned offline-installer build directory
container_offline_volume="/mnt/offline/"
-# Path inside container where will be created repository
+# Target repository path inside container
container_repo_volume="/mnt/repo/"
-# Path inside container where will be stored additional packages lists
+# Additional packages lists files path within container
container_list_volume="/mnt/additional-lists/"
-# Show help for using this script
+# Show script usage
help () {
cat <<EOF
-Script for run docker container creating DEB or RPM repository
+Wrapper script running docker container for creating package repository
-Type of repository is created based on user input or if input is empty type of host OS
+Repository type is set with --target-platform option and the default is to use host OS platform type
-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
+usage: create_repo.sh [OPTION]...
-If build folder from offline repository is not specified will be used default path of current folder.
+
+ -d | --destination-repository target path to store downloaded packages. Current directory by default
+ -c | --cloned-directory path to directory containing this and docker-entrypoint scripts (offline-installer/build directory)
+ Set it only when you want to use different script/datalists
+ -t | --target-platform target repository platform type (ubuntu/rhel/centos)
+ -a | --additional-list additional packages list; can be used multiple times for more additional lists
+ -h | --help show this help
+
+If build folder from offline repository is not specified current one will be used by default.
EOF
}
-# Get type of distribution
+# Get distribution type
# Set Docker image name and version based on type of linux distribution
# Set expected directory for RPM/DEB packages
set_enviroment () {
@@ -79,23 +79,22 @@ do
exit 0
;;
-c|--cloned-directory)
- # Directory parametter
- # Sets path where is cloned offline-installer build directory
+ # Directory parameter
+ # Set path to offline-installer build directory
volume_offline_directory="$2"
;;
-d|--destination-repository)
- # Repository direcotry parametter
- # Sets path where will be repository created
+ # Repository directory parameter
+ # Set destination path for created repository
volume_repo_directory="$2"
;;
-t|--target-platform)
# Repository type (rpm/deb)
- # Sets target platform for repository
+ # Set target platform for repository
target_input="$2"
;;
-a|--additional-list)
- # Array with more packages lists
- # Add more packages lists to download
+ # Array of additional packages lists
additional_lists+=("$2")
;;
*)
@@ -107,8 +106,8 @@ do
shift;shift
done
-# Check if user specified type of repository
-# This settings have higher priority, then type of distribution
+# Check if user specified repository type
+# This setting has higher priority than distribution type
if ! test -z "$target_input"
then
set_enviroment "$target_input"
@@ -116,11 +115,11 @@ else
set_enviroment "$distro_type"
fi
-# Check if path contains expected path:
+# Check if path contains expected components:
# "resources/pkg/rpm" for Rhel/CentOS or
# "resources/pkg/deb" for Ubuntu/Debian
if ! [[ "/$volume_repo_directory/" = *"/$expected_dir/"* ]]; then
- # Create repo folder if it not exists
+ # Create repo folder if it doesn't exist
case "$distro_type" in
ubuntu)
volume_repo_directory="$volume_repo_directory"/resources/pkg/deb
diff --git a/build/docker-entrypoint.sh b/build/docker-entrypoint.sh
index b3306e26..965037e0 100755
--- a/build/docker-entrypoint.sh
+++ b/build/docker-entrypoint.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Set type of distribution where script is running
+# Set distribution family
distro_type=$(cat /etc/*-release | grep -w "ID" | awk -F'=' '{ print $2 }' | tr -d '"')
case "$distro_type" in
ubuntu)
@@ -15,36 +15,36 @@ case "$distro_type" in
;;
esac
-# Path where will be created repository (in container)
+# Target path for created repository
OFFLINE_REPO_DIR=""
-# Path where is stored onap_rpm.list and onap_deb.list file
+# Path to directory containing onap_rpm.list and onap_deb.list files
PCKG_LIST_DIR=""
-# Path where is stored additional packages lists
+# Path to additional packages lists
ADD_LIST_DIR=""
-# Show help for using this script
+# Show help
help () {
cat <<EOF
-Docker entrypoint script for creating RPM/DEB repository based on linux distribution where script is running
+Docker entrypoint script for creating RPM/DEB repository based on container platform type
-usage: create-repo.sh [-d|--directory output directory] [-l|--list input rpm/deb list directory] [-a|--additional-lists list1.list]
--h --help: Show this help
--d --directory: set path for repo directory in container
--l --list: set path where rpm or deb list is stored in container
--a --additional-list: add name of additional packages list
- can be used multiple times for more additional lists
--p --packages-lists-path: set path for other additional packages lists
+usage: create-repo.sh [OPTION]...
+
+ -d | --directory target repository path
+ -l | --list input rpm/deb list directory
+ -a | --additional-list additional packages list; can be used multiple times
+ -p | --packages-lists-path other additional packages lists
+ -h | --help show this help
Both paths have to be set with shared volume between
-container and host computer. Default path in container is: /tmp/
+container and the host. Default path in container is: /tmp/
Repository will be created at: /<path>/resources/pkg/rhel/
RMP/DEB list is stored at: ./data_list/
EOF
}
-# Getting input parametters
+# Getting input parameters
POSITIONAL=()
if [[ $# -eq 0 ]] ; then
help # show help
@@ -54,23 +54,23 @@ while [[ $# -gt 0 ]]
do
case "$1" in
-h|--help)
- # Help parametter
+ # Help parameter
help # show help
exit
;;
-d|--directory)
- # Directory parametter
- # Sets path where will be created reposity
+ # Directory parameter
+ # Set target reposity path
OFFLINE_REPO_DIR="$2"
;;
-l|--list)
- # List parametter
- # Sets path where is stored onap_rpm.list or onap_deb.list file
+ # List parameter
+ # Set path containing onap_rpm.list or onap_deb.list file
PCKG_LIST_DIR="$2"
;;
-p|--packages-lists-path)
- # Path parametter
- # Sets path where is stored additional packages lists
+ # Path parameter
+ # Set path for additional packages lists
ADD_LIST_DIR="$2"
;;
-a|--additional-list)
@@ -86,25 +86,22 @@ do
shift;shift
done
-# Testing if directory parametter was used
-# If not variable is sets to default value:
-# /tmp/repo/resources/pkg/rpm
-# or
-# /tmp/repo/resources/pkg/deb
+# Testing if directory parameter was used
+# If not variable is set to /tmp/repo by default
if test -z "$OFFLINE_REPO_DIR"
then
OFFLINE_REPO_DIR="/tmp/repo/"
fi
-# Testing if list parametter was used
-# If not variable is sets to default value /tmp/offline/data-list
+# Testing if list parameter was used
+# If not variable is set to default value /tmp/offline/data-list
if test -z "$PCKG_LIST_DIR"
then
PCKG_LIST_DIR="/tmp/offline/data_list/"
fi
-# Testing if additional packages list parametter was used
-# If not variable is sets to default value /tmp/additional-lists
+# Testing if additional packages list parameter was used
+# If not variable is set to default value /tmp/additional-lists
if test -z "$PCKG_LIST_DIR"
then
PCKG_LIST_DIR="/tmp/additional-lists/"
@@ -141,7 +138,7 @@ case "$distro_type" in
done;
done
- # Download all packages with dependecies from all additional packages lists via apt-get to repository folder
+ # Download all packages with dependencies from all additional packages lists via apt-get to repository folder
if ! [ ${#ADDITIONAL_LISTS[@]} -eq 0 ]; then
for list in ${ADDITIONAL_LISTS[@]}
do
@@ -179,7 +176,7 @@ case "$distro_type" in
done
fi
- # In repository folder create repositor
+ # Create repository
createrepo $OFFLINE_REPO_DIR
;;