diff --git a/README.md b/README.md index 68cab36..3ef091d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ You can use the following command to install it in your enviroment: sudo apt-get update && apt-get install -y wget # This downloads an installation script and run it -wget -O - https://release.choco-technologies.com/scripts/install-choco-scripts.sh | bash +wget -O - https://raw.githubusercontent.com/JohnAmadis/choco-scripts/main/install-choco-scripts.sh | bash ``` Once the scripts are installed, they are auto-loaded on bash start and you can start using it. To import it in your script, just add the following line into your project: diff --git a/install-choco-scripts.sh b/install-choco-scripts.sh index 7384ad0..dbe21cb 100755 --- a/install-choco-scripts.sh +++ b/install-choco-scripts.sh @@ -7,9 +7,10 @@ # PROJECT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" +GITHUB_REPO=JohnAmadis/choco-scripts VERSION=latest FILE_NAME=choco-scripts-$VERSION.tar.gz -URL=http://release.choco-technologies.com/scripts/$FILE_NAME +URL=https://github.com/$GITHUB_REPO/releases/latest/download/$FILE_NAME TARGET_PATH=~/.choco-scripts TEMPLATE_FILE_NAME=template.sh TEMPLATE_FILE_PATH=$TARGET_PATH/$TEMPLATE_FILE_NAME @@ -20,7 +21,7 @@ CHOCO_HELP_FILE_PATH=$TARGET_PATH/$CHOCO_HELP_FILE_NAME USER_CONFIG_PATH=~/.choco-scripts.cfg BASHRC_FILE_PATH=~/.bashrc ENTRY_SCRIPT_NAME=choco-scripts -INSTALL_URL=https://release.choco-technologies.com/scripts/install-choco-scripts.sh +INSTALL_URL=https://raw.githubusercontent.com/$GITHUB_REPO/main/install-choco-scripts.sh if [ "$1" == "--help" ] then diff --git a/public/template.sh b/public/template.sh index d3b48b8..7e6ec8a 100755 --- a/public/template.sh +++ b/public/template.sh @@ -15,6 +15,20 @@ THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" CONFIGURATION_FILE_PATH=~/.choco-scripts.cfg SCRIPT_DESCRIPTION="" +# +# Installs choco-scripts +# +function installChocoScripts() +{ + echo "Installation of the choco-scripts" + + # This line installs wget tool - you don't need to use it if you already have it + apt-get update && apt-get install -y wget + + # This downloads an installation script and run it + wget -O - https://raw.githubusercontent.com/JohnAmadis/choco-scripts/main/install-choco-scripts.sh | bash +} + # # Verification of the choco scripts installation # @@ -22,7 +36,19 @@ if [ -f "$CONFIGURATION_FILE_PATH" ] then source $CONFIGURATION_FILE_PATH else - printf "\033[31;1mChoco-Scripts are not installed for this user\033[0m\n" + printf "\033[31;1mChoco-Scripts are not installed for this user\033[0m\n\n" + printf " \033[37;1mYou can find the installation instruction here: \033[0m\n" + printf " \033[34;1mhttps://github.com/JohnAmadis/choco-scripts\033[0m\n\n" + + while true + do + read -p "Do you want to try to auto-install it? [Y/n]: " answer + case $answer in + [Yy]* ) installChocoScripts; break;; + [Nn]* ) echo "Skipping installation"; exit 1;; + * ) echo "Please answer Y or n";; + esac + done exit 1 fi