diff --git a/installer.sh b/installer.sh index 2e5fcd5a6..0799a2f70 100755 --- a/installer.sh +++ b/installer.sh @@ -84,7 +84,7 @@ echo "" echo -e "==> ""$GREEN""Imported ""$INSTALLER_COUNT"" installer module files""$NC" echo "" -if [ "$#" -ne 1 ]; then +if [[ "$#" -le 1 ]] && [[ "$#" -gt 2 ]]; then echo -e "$RED""$BOLD""Invalid number of arguments""$NC" echo -e "\n\n------------------------------------------------------------------" echo -e "If you are going to install EMBA in default mode you can use:" @@ -94,7 +94,7 @@ if [ "$#" -ne 1 ]; then exit 1 fi -while getopts cCdDFghlr OPT ; do +while getopts CdDFghlrc: OPT ; do case $OPT in d) export DOCKER_SETUP=1 @@ -134,6 +134,9 @@ while getopts cCdDFghlr OPT ; do export REMOVE=1 echo -e "$GREEN""$BOLD""Remove EMBA from the system""$NC" ;; + c) + export CONTAINER="$OPTARG" + ;; *) echo -e "$RED""$BOLD""Invalid option""$NC" print_help @@ -142,6 +145,10 @@ while getopts cCdDFghlr OPT ; do esac done +if ! [[ -v CONTAINER ]]; then + CONTAINER="embeddedanalyzer/emba" +fi + if [[ "$LIST_DEP" -eq 1 ]]; then echo -e "\n${ORANGE}WARNING: This feature is deprecated and not maintained anymore.$NC" read -p "If you know what you are doing you can press any key to continue ..." -n1 -s -r diff --git a/installer/I05_emba_docker_image_dl.sh b/installer/I05_emba_docker_image_dl.sh index 2079b7d3b..046e0ea65 100755 --- a/installer/I05_emba_docker_image_dl.sh +++ b/installer/I05_emba_docker_image_dl.sh @@ -26,7 +26,7 @@ I05_emba_docker_image_dl() { echo -e "Description: EMBA docker images used for firmware analysis." if command -v docker > /dev/null; then - f="$(docker manifest inspect embeddedanalyzer/emba:latest | grep "size" | sed -e 's/[^0-9 ]//g')" + f="$(docker manifest inspect "${CONTAINER}" | grep "size" | sed -e 's/[^0-9 ]//g')" echo "Download-Size : ""$(("$(( "${f//$'\n'/+}" ))"/1048576))"" MB" fi @@ -48,7 +48,9 @@ I05_emba_docker_image_dl() { if command -v docker > /dev/null ; then export DOCKER_CLI_EXPERIMENTAL=enabled echo -e "$ORANGE""EMBA docker image will be downloaded.""$NC" - docker pull embeddedanalyzer/emba + echo -e "$ORANGE""CONTAINER VARIABLE SET TO ""$CONTAINER""$NC" + docker pull "${CONTAINER}" + sed -i "/image:/c\ image: ${CONTAINER}" docker-compose.yml export DOCKER_CLI_EXPERIMENTAL=disabled docker-compose up --no-start else diff --git a/installer/helpers.sh b/installer/helpers.sh index 43ec3f076..f3fff80e2 100755 --- a/installer/helpers.sh +++ b/installer/helpers.sh @@ -26,6 +26,7 @@ print_help() echo -e "$CYAN""-h""$NC"" Print this help message" echo -e "$CYAN""-l""$NC"" List all dependencies of EMBA (deprecated)" echo -e "$CYAN""-r""$NC"" Remove a default installation of EMBA" + echo -e "$CYAN""-c {x}""$NC"" Choose docker image to install (replace {x} with the name)" echo }