From ad9e298563346d58fdd778c8543462a6304b7c4d Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 22:28:01 +0200 Subject: [PATCH 01/14] Create Dockerfile --- Dockerfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..386027a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM alpine:latest + +LABEL MAINTAINER="Sebastian Zoll" + +RUN apk add --no-cache \ + curl jq graphviz git bash \ + && cd / \ + && git clone https://github.com/sips4711/ocp4upc.git \ + && mv ocp4upc/ocp4upc.sh /bin/ \ + && chmod 777 /bin/ocp4upc.sh + +WORKDIR /documents +VOLUME /documents + +CMD ["/bin/ocp4upc.sh"] From df7f349b873eef58463385bb5401e4333737c24d Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 22:30:16 +0200 Subject: [PATCH 02/14] Update README.md --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index c192513..b4f6c98 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,13 @@ ppc64le POWER8/9 little endian ----------------------------------------------------------------- ~~~ +## Podman (Docker) Example +~~~ +$ podman build -t localhost/ocp4upc . +$ podman run --rm -it -v $(pwd):/documents localhost/ocp4upc ocp4upc.sh 4.1.34-4.7 +~~~ + + ## Examples ~~~ $ ocp4upc.sh 4.6.15 From 5538dfef622e80636d405b5091b90a1ba87c45f2 Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 22:37:58 +0200 Subject: [PATCH 03/14] Update Dockerfile --- Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 386027a..b56ee31 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,11 +2,9 @@ FROM alpine:latest LABEL MAINTAINER="Sebastian Zoll" +ADD ocp4upc.sh /bin/ocp4upc.sh RUN apk add --no-cache \ - curl jq graphviz git bash \ - && cd / \ - && git clone https://github.com/sips4711/ocp4upc.git \ - && mv ocp4upc/ocp4upc.sh /bin/ \ + curl jq graphviz bash \ && chmod 777 /bin/ocp4upc.sh WORKDIR /documents From 86f329bc95df3d8003a176a87741c64032fc2ec2 Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 22:38:56 +0200 Subject: [PATCH 04/14] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b56ee31..a1f10d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:latest LABEL MAINTAINER="Sebastian Zoll" -ADD ocp4upc.sh /bin/ocp4upc.sh +ADD ocp4upc.sh /bin/ocp4upc RUN apk add --no-cache \ curl jq graphviz bash \ && chmod 777 /bin/ocp4upc.sh @@ -10,4 +10,4 @@ RUN apk add --no-cache \ WORKDIR /documents VOLUME /documents -CMD ["/bin/ocp4upc.sh"] +CMD ["/bin/ocp4upc"] From 22465bc895b95341d183344a4a5130d1ac32a429 Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 22:40:28 +0200 Subject: [PATCH 05/14] Update Dockerfile --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a1f10d6..2b8fe97 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:latest LABEL MAINTAINER="Sebastian Zoll" -ADD ocp4upc.sh /bin/ocp4upc +ADD ocp4upc.sh /bin/ RUN apk add --no-cache \ curl jq graphviz bash \ && chmod 777 /bin/ocp4upc.sh @@ -10,4 +10,4 @@ RUN apk add --no-cache \ WORKDIR /documents VOLUME /documents -CMD ["/bin/ocp4upc"] +CMD ["/bin/ocp4upc.sh"] From d68d79153e1a48a128d7cdc240bf089568df0890 Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 22:56:37 +0200 Subject: [PATCH 06/14] Update ocp4upc.sh --- ocp4upc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ocp4upc.sh b/ocp4upc.sh index dd26d5f..422621c 100755 --- a/ocp4upc.sh +++ b/ocp4upc.sh @@ -482,7 +482,7 @@ function main() cout "INFO" "Detected mode '${MOD}', targeting channels '$(${BIN}echo "${TRGa[@]}")' for multigraph generation." ##channel selection (default: first channel in the list) cout "INPT" "Select channel from [$(${BIN}echo "${CHANDEF[@]}")], press Enter for default value (${CHANDEF[0]}): " "-n" - read -t 10 chan + [ -z ${chan+x} ] && read -t 10 chan [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 chan=${chan:-"${CHANDEF[0]}"} local match="false" #make the channel selection dynamic @@ -490,7 +490,7 @@ function main() [[ "${match}" != "true" ]] && cout "ERRO" "Invalid selection. Execution interrupted." && exit 3 ##max depth selection (default: 2) cout "INPT" "Select max depth between [1-9], press Enter for default value (2): " "-n" - read -t 10 max_depth + [ -z ${max_depth+x} ] && read -t 10 max_depth max_depth=${max_depth:-"2"} [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 ! [[ "${max_depth}" =~ ^[1-9]$ ]] && cout "ERRO" "Invalid selection. Execution interrupted." && exit 3 From 2b32700535469637e23db028dfa2b3b03ca2462b Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 23:04:00 +0200 Subject: [PATCH 07/14] Update ocp4upc.sh --- ocp4upc.sh | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/ocp4upc.sh b/ocp4upc.sh index 422621c..4d7f0f9 100755 --- a/ocp4upc.sh +++ b/ocp4upc.sh @@ -480,20 +480,32 @@ function main() fi cout "INFO" "Detected mode '${MOD}', targeting channels '$(${BIN}echo "${TRGa[@]}")' for multigraph generation." - ##channel selection (default: first channel in the list) - cout "INPT" "Select channel from [$(${BIN}echo "${CHANDEF[@]}")], press Enter for default value (${CHANDEF[0]}): " "-n" - [ -z ${chan+x} ] && read -t 10 chan - [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 - chan=${chan:-"${CHANDEF[0]}"} + + + if [ -z ${chan+x} ] + then + ##channel selection (default: first channel in the list) + cout "INPT" "Select channel from [$(${BIN}echo "${CHANDEF[@]}")], press Enter for default value (${CHANDEF[0]}): " "-n" + read -t 10 chan + [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 + chan=${chan:-"${CHANDEF[0]}"} + fi + + local match="false" #make the channel selection dynamic for opt in "${CHA[@]}"; do [[ "${opt}" != "${chan}" ]] && continue || match="true"; done [[ "${match}" != "true" ]] && cout "ERRO" "Invalid selection. Execution interrupted." && exit 3 ##max depth selection (default: 2) cout "INPT" "Select max depth between [1-9], press Enter for default value (2): " "-n" - [ -z ${max_depth+x} ] && read -t 10 max_depth - max_depth=${max_depth:-"2"} - [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 - ! [[ "${max_depth}" =~ ^[1-9]$ ]] && cout "ERRO" "Invalid selection. Execution interrupted." && exit 3 + if [ -z ${max_depth+x} ] + then + read -t 10 max_depth + max_depth=${max_depth:-"2"} + [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 + ! [[ "${max_depth}" =~ ^[1-9]$ ]] && cout "ERRO" "Invalid selection. Execution interrupted." && exit 3 + fi + + local total=$((${#TRGa[@]} * ${max_depth})) [[ ${total} -gt 10 ]] && cout "WARN" "Targeting '${#TRGa[@]}' diff minor versions with '${max_depth}' releases per target (${total} edges), please be patient." From 6ecd74c7aa9fbdcc8403252e8534b48a1ec2fdc4 Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 23:09:26 +0200 Subject: [PATCH 08/14] Update ocp4upc.sh --- ocp4upc.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ocp4upc.sh b/ocp4upc.sh index 4d7f0f9..a13b011 100755 --- a/ocp4upc.sh +++ b/ocp4upc.sh @@ -481,17 +481,16 @@ function main() cout "INFO" "Detected mode '${MOD}', targeting channels '$(${BIN}echo "${TRGa[@]}")' for multigraph generation." - if [ -z ${chan+x} ] then ##channel selection (default: first channel in the list) cout "INPT" "Select channel from [$(${BIN}echo "${CHANDEF[@]}")], press Enter for default value (${CHANDEF[0]}): " "-n" read -t 10 chan [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 - chan=${chan:-"${CHANDEF[0]}"} + fi - + chan=${chan:-"${CHANDEF[0]}"} local match="false" #make the channel selection dynamic for opt in "${CHA[@]}"; do [[ "${opt}" != "${chan}" ]] && continue || match="true"; done [[ "${match}" != "true" ]] && cout "ERRO" "Invalid selection. Execution interrupted." && exit 3 From 8a7e49e2481fb0c845bce110dad21014d0a8b7fb Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 23:19:52 +0200 Subject: [PATCH 09/14] Update ocp4upc.sh --- ocp4upc.sh | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/ocp4upc.sh b/ocp4upc.sh index a13b011..db64637 100755 --- a/ocp4upc.sh +++ b/ocp4upc.sh @@ -62,6 +62,10 @@ function declare_vars() ##ARGs [[ ${#args[1]} -lt 3 ]] && usage || VER=${args[1]} [[ -z ${args[2]-} ]] && ARC="amd64" || ARC=${args[2]} + + [ -z ${version+x} ] && VER=$version + [ -z ${arch+x} ] && ARC=$arch + ##Target channel calculation & mode detection ! [[ ${VER} =~ ^[0-9]([.][0-9]+)([.][0-9]+|$).*$ ]] && usage @@ -480,31 +484,20 @@ function main() fi cout "INFO" "Detected mode '${MOD}', targeting channels '$(${BIN}echo "${TRGa[@]}")' for multigraph generation." - - if [ -z ${chan+x} ] - then - ##channel selection (default: first channel in the list) - cout "INPT" "Select channel from [$(${BIN}echo "${CHANDEF[@]}")], press Enter for default value (${CHANDEF[0]}): " "-n" - read -t 10 chan - [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 - - fi - + ##channel selection (default: first channel in the list) + cout "INPT" "Select channel from [$(${BIN}echo "${CHANDEF[@]}")], press Enter for default value (${CHANDEF[0]}): " "-n" + read -t 10 chan + [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 chan=${chan:-"${CHANDEF[0]}"} local match="false" #make the channel selection dynamic for opt in "${CHA[@]}"; do [[ "${opt}" != "${chan}" ]] && continue || match="true"; done [[ "${match}" != "true" ]] && cout "ERRO" "Invalid selection. Execution interrupted." && exit 3 ##max depth selection (default: 2) cout "INPT" "Select max depth between [1-9], press Enter for default value (2): " "-n" - if [ -z ${max_depth+x} ] - then - read -t 10 max_depth - max_depth=${max_depth:-"2"} - [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 - ! [[ "${max_depth}" =~ ^[1-9]$ ]] && cout "ERRO" "Invalid selection. Execution interrupted." && exit 3 - fi - - + read -t 10 max_depth + max_depth=${max_depth:-"2"} + [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 + ! [[ "${max_depth}" =~ ^[1-9]$ ]] && cout "ERRO" "Invalid selection. Execution interrupted." && exit 3 local total=$((${#TRGa[@]} * ${max_depth})) [[ ${total} -gt 10 ]] && cout "WARN" "Targeting '${#TRGa[@]}' diff minor versions with '${max_depth}' releases per target (${total} edges), please be patient." From ec44ed4247f426813b8782e93d4bdd58c9810acd Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 23:24:59 +0200 Subject: [PATCH 10/14] Update ocp4upc.sh --- ocp4upc.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ocp4upc.sh b/ocp4upc.sh index db64637..67db7e3 100755 --- a/ocp4upc.sh +++ b/ocp4upc.sh @@ -63,10 +63,6 @@ function declare_vars() [[ ${#args[1]} -lt 3 ]] && usage || VER=${args[1]} [[ -z ${args[2]-} ]] && ARC="amd64" || ARC=${args[2]} - [ -z ${version+x} ] && VER=$version - [ -z ${arch+x} ] && ARC=$arch - - ##Target channel calculation & mode detection ! [[ ${VER} =~ ^[0-9]([.][0-9]+)([.][0-9]+|$).*$ ]] && usage MAJ=$(${BIN}echo ${VER} | ${BIN}cut -d. -f1) @@ -486,6 +482,7 @@ function main() cout "INFO" "Detected mode '${MOD}', targeting channels '$(${BIN}echo "${TRGa[@]}")' for multigraph generation." ##channel selection (default: first channel in the list) cout "INPT" "Select channel from [$(${BIN}echo "${CHANDEF[@]}")], press Enter for default value (${CHANDEF[0]}): " "-n" + read -t 10 chan [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 chan=${chan:-"${CHANDEF[0]}"} From 8ab2927f9ea947790d55690d8a713c23bbd75a49 Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 23:30:09 +0200 Subject: [PATCH 11/14] Update ocp4upc.sh --- ocp4upc.sh | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/ocp4upc.sh b/ocp4upc.sh index 67db7e3..8fd186c 100755 --- a/ocp4upc.sh +++ b/ocp4upc.sh @@ -480,20 +480,34 @@ function main() fi cout "INFO" "Detected mode '${MOD}', targeting channels '$(${BIN}echo "${TRGa[@]}")' for multigraph generation." - ##channel selection (default: first channel in the list) - cout "INPT" "Select channel from [$(${BIN}echo "${CHANDEF[@]}")], press Enter for default value (${CHANDEF[0]}): " "-n" - read -t 10 chan - [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 + if [ -z ${channel+x} ]; + then + chan=${channel+x} + else + ##channel selection (default: first channel in the list) + cout "INPT" "Select channel from [$(${BIN}echo "${CHANDEF[@]}")], press Enter for default value (${CHANDEF[0]}): " "-n" + read -t 10 chan + [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 + fi + chan=${chan:-"${CHANDEF[0]}"} local match="false" #make the channel selection dynamic for opt in "${CHA[@]}"; do [[ "${opt}" != "${chan}" ]] && continue || match="true"; done [[ "${match}" != "true" ]] && cout "ERRO" "Invalid selection. Execution interrupted." && exit 3 - ##max depth selection (default: 2) - cout "INPT" "Select max depth between [1-9], press Enter for default value (2): " "-n" - read -t 10 max_depth - max_depth=${max_depth:-"2"} - [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 + + if [ -z ${depth+x} ]; + then + max_depth=${depth+x} + else + ##max depth selection (default: 2) + cout "INPT" "Select max depth between [1-9], press Enter for default value (2): " "-n" + read -t 10 max_depth + max_depth=${max_depth:-"2"} + [ $? -ne 0 ] && cout "ERRO" "Selection timed out. Execution interrupted." && exit 3 + fi + + ! [[ "${max_depth}" =~ ^[1-9]$ ]] && cout "ERRO" "Invalid selection. Execution interrupted." && exit 3 local total=$((${#TRGa[@]} * ${max_depth})) [[ ${total} -gt 10 ]] && cout "WARN" "Targeting '${#TRGa[@]}' diff minor versions with '${max_depth}' releases per target (${total} edges), please be patient." From 5db008f7e46c9f625c78fde6529b0091444849af Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 23:35:28 +0200 Subject: [PATCH 12/14] Update ocp4upc.sh --- ocp4upc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ocp4upc.sh b/ocp4upc.sh index 8fd186c..1922ed0 100755 --- a/ocp4upc.sh +++ b/ocp4upc.sh @@ -481,7 +481,7 @@ function main() cout "INFO" "Detected mode '${MOD}', targeting channels '$(${BIN}echo "${TRGa[@]}")' for multigraph generation." - if [ -z ${channel+x} ]; + if [ ! -z ${channel+x} ]; then chan=${channel+x} else @@ -496,7 +496,7 @@ function main() for opt in "${CHA[@]}"; do [[ "${opt}" != "${chan}" ]] && continue || match="true"; done [[ "${match}" != "true" ]] && cout "ERRO" "Invalid selection. Execution interrupted." && exit 3 - if [ -z ${depth+x} ]; + if [ ! -z ${depth+x} ]; then max_depth=${depth+x} else From 54bf7cedd07bd8ff8ad6cec9d003a834297d9342 Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 23:39:55 +0200 Subject: [PATCH 13/14] Update ocp4upc.sh --- ocp4upc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ocp4upc.sh b/ocp4upc.sh index 1922ed0..842352b 100755 --- a/ocp4upc.sh +++ b/ocp4upc.sh @@ -483,7 +483,7 @@ function main() if [ ! -z ${channel+x} ]; then - chan=${channel+x} + chan=${channel} else ##channel selection (default: first channel in the list) cout "INPT" "Select channel from [$(${BIN}echo "${CHANDEF[@]}")], press Enter for default value (${CHANDEF[0]}): " "-n" @@ -498,7 +498,7 @@ function main() if [ ! -z ${depth+x} ]; then - max_depth=${depth+x} + max_depth=${depth} else ##max depth selection (default: 2) cout "INPT" "Select max depth between [1-9], press Enter for default value (2): " "-n" From c74e4a972af33b9a342cc158d0bcb859e9d35ff5 Mon Sep 17 00:00:00 2001 From: Sebastian Zoll Date: Mon, 29 Mar 2021 23:41:22 +0200 Subject: [PATCH 14/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b4f6c98..eac452d 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ ppc64le POWER8/9 little endian ## Podman (Docker) Example ~~~ $ podman build -t localhost/ocp4upc . -$ podman run --rm -it -v $(pwd):/documents localhost/ocp4upc ocp4upc.sh 4.1.34-4.7 +$ podman run --rm -it -v $(pwd):/documents -e channel=stable -e depth=2 localhost/ocp4upc ocp4upc.sh 4.2.36-4.7 ~~~