Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installer don't work with docker #7

Open
jrichardsz opened this issue Oct 11, 2023 · 0 comments
Open

Installer don't work with docker #7

jrichardsz opened this issue Oct 11, 2023 · 0 comments

Comments

@jrichardsz
Copy link

jrichardsz commented Oct 11, 2023

error:

main: line 19: sudo: command not found
main: line 21: sudo: command not found
chmod: cannot access '/usr/bin/t-rext': No such file or directory

Fix

#!/bin/bash

export TREXT_HOME=$HOME/.t-rext

for ARGUMENT in "$@"
do
   KEY=$(echo $ARGUMENT | cut -f1 -d=)

   KEY_LENGTH=${#KEY}
   VALUE="${ARGUMENT:$KEY_LENGTH+1}"

   export "$KEY"="$VALUE"
done

function mode_bin {
    echo -e "\n\nThis mode will create a simlink of the downloaded $TREXT_HOME/t-rext.jar to  /usr/bin/t-rext"
    echo -e "As any other tool, you need to grant access to perform this operation\n"

    rm /usr/bin/t-rext 2> /dev/null

    ln -s $TREXT_HOME/t-rext /usr/bin/t-rext
    chmod +x /usr/bin/t-rext

    echo -e "t-rext is ready!!!"
}

function mode_manual {

    echo -e "\n\nExport these variables in the shell or set them in your correct profile file (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc), so in your next login, executable with be in the path ready to be used"

    echo "export TREXT_HOME=$TREXT_HOME"
    echo 'export PATH=$PATH:$TREXT_HOME'

    echo -e "\nGive execution permissions to the script"
    echo "sudo chmod +x $TREXT_HOME/t-rext"
}

function download {
    mkdir -p $TREXT_HOME
    cd $TREXT_HOME
    curl -L https://github.com/jrichardsz-software-architect-tools/t-rext/releases/latest/download/t-rext.jar > $TREXT_HOME/t-rext.jar
    ls -la $TREXT_HOME
    echo 'java -jar '"$TREXT_HOME"'/t-rext.jar "$@"' > t-rext
}   

## entrypoint ##

download

case "$mode" in

  "bin")
    mode_bin
    ;;

  "manual")
    mode_manual
    ;;

  *)
    mode_bin
    ;;
esac

echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant