From fc7ecb1e84cf63f088816752dddd487c77f06a86 Mon Sep 17 00:00:00 2001 From: Th3S <46804083+the-soloist@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:42:22 +0800 Subject: [PATCH] feat: update scripts --- build/ubuntu/lts/16.04/Dockerfile | 2 +- build/ubuntu/lts/18.04/Dockerfile | 2 +- build/ubuntu/lts/20.04/Dockerfile | 2 +- docker/env/pwn/python.sh | 4 ++-- docker/env/pyenv/python-2.7.sh | 9 --------- docker/env/pyenv/python-3.10.sh | 9 --------- docker/env/pyenv/python-3.8.sh | 9 --------- docker/env/pyenv/python.sh | 23 +++++++++++++++++++++++ 8 files changed, 28 insertions(+), 32 deletions(-) delete mode 100644 docker/env/pyenv/python-2.7.sh delete mode 100644 docker/env/pyenv/python-3.10.sh delete mode 100644 docker/env/pyenv/python-3.8.sh create mode 100644 docker/env/pyenv/python.sh diff --git a/build/ubuntu/lts/16.04/Dockerfile b/build/ubuntu/lts/16.04/Dockerfile index b202ccd..0abddd5 100644 --- a/build/ubuntu/lts/16.04/Dockerfile +++ b/build/ubuntu/lts/16.04/Dockerfile @@ -61,7 +61,7 @@ RUN apt-get update && \ # install custom tools RUN bash /opt/env/install.sh && \ bash /opt/env/pyenv/install.sh && \ - bash /opt/env/pyenv/python-3.8.sh + bash /opt/env/pyenv/python.sh -p 3.8.19 # install pwn tools RUN bash /opt/env/pwn/python.sh -p 3.8.19 diff --git a/build/ubuntu/lts/18.04/Dockerfile b/build/ubuntu/lts/18.04/Dockerfile index 5dd6498..0bdc996 100644 --- a/build/ubuntu/lts/18.04/Dockerfile +++ b/build/ubuntu/lts/18.04/Dockerfile @@ -61,7 +61,7 @@ RUN apt-get update && \ # install custom tools RUN bash /opt/env/install.sh && \ bash /opt/env/pyenv/install.sh && \ - bash /opt/env/pyenv/python-3.10.sh + bash /opt/env/pyenv/python.sh -p 3.10.14 # install pwn tools RUN bash /opt/env/pwn/python.sh -p 3.10.14 diff --git a/build/ubuntu/lts/20.04/Dockerfile b/build/ubuntu/lts/20.04/Dockerfile index ef86141..de5c894 100644 --- a/build/ubuntu/lts/20.04/Dockerfile +++ b/build/ubuntu/lts/20.04/Dockerfile @@ -61,7 +61,7 @@ RUN apt-get update && \ # install custom tools RUN bash /opt/env/install.sh && \ bash /opt/env/pyenv/install.sh && \ - bash /opt/env/pyenv/python-3.10.sh + bash /opt/env/pyenv/python.sh -p 3.10.14 # install pwn tools RUN bash /opt/env/pwn/python.sh -p 3.10.14 diff --git a/docker/env/pwn/python.sh b/docker/env/pwn/python.sh index c48922c..f117642 100644 --- a/docker/env/pwn/python.sh +++ b/docker/env/pwn/python.sh @@ -3,8 +3,8 @@ set -x function print_help() { - echo "Usage: $0 " - echo " e.g.: $0 3.8.16" + echo "Usage: $0 -p " + echo " e.g.: $0 -p 3.8.16" exit 1 } diff --git a/docker/env/pyenv/python-2.7.sh b/docker/env/pyenv/python-2.7.sh deleted file mode 100644 index 5a891dc..0000000 --- a/docker/env/pyenv/python-2.7.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -set -x - -export PYENV_ROOT="/opt/pyenv" -command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" -eval "$(command pyenv init -)" - -pyenv install 2.7.18 diff --git a/docker/env/pyenv/python-3.10.sh b/docker/env/pyenv/python-3.10.sh deleted file mode 100644 index ab7036e..0000000 --- a/docker/env/pyenv/python-3.10.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -set -x - -export PYENV_ROOT="/opt/pyenv" -command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" -eval "$(command pyenv init -)" - -pyenv install 3.10.14 diff --git a/docker/env/pyenv/python-3.8.sh b/docker/env/pyenv/python-3.8.sh deleted file mode 100644 index 97b9925..0000000 --- a/docker/env/pyenv/python-3.8.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -set -x - -export PYENV_ROOT="/opt/pyenv" -command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" -eval "$(command pyenv init -)" - -pyenv install 3.8.19 diff --git a/docker/env/pyenv/python.sh b/docker/env/pyenv/python.sh new file mode 100644 index 0000000..0d36f5f --- /dev/null +++ b/docker/env/pyenv/python.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +set -x + +function print_help() { + echo "Usage: $0 -p " + echo " e.g.: $0 -p 3.8.16" + exit 1 +} + +while getopts "p:h" OPT; do + case $OPT in + p) PY_VERSION="$OPTARG" ;; + h) print_help ;; + ?) print_help ;; + esac +done + +export PYENV_ROOT="/opt/pyenv" +command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(command pyenv init -)" + +pyenv install $PY_VERSION