Skip to content

Commit

Permalink
Merge pull request #644 from HoxhaEndri/master
Browse files Browse the repository at this point in the history
new switch -c to choose docker container as parameter
  • Loading branch information
HoxhaEndri authored Jun 15, 2023
2 parents f2c02ed + 8ffb93d commit f5f9a31
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
11 changes: 9 additions & 2 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions installer/I05_emba_docker_image_dl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions installer/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit f5f9a31

Please sign in to comment.