Skip to content

Commit

Permalink
Improved Install script
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Aug 12, 2019
1 parent 2afdc1d commit f78e00c
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ wasmer_detect_profile() {
wasmer_link() {
printf "$cyan> Adding to bash profile...$reset\n"
WASMER_PROFILE="$(wasmer_detect_profile)"
LOAD_STR="\n# Wasmer\nexport WASMER_DIR=\"$INSTALL_DIRECTORY\"\n[ -s \"\$WASMER_DIR/wasmer.sh\" ] && source \"\$WASMER_DIR/wasmer.sh\" # This loads wasmer\n"
LOAD_STR="\n# Wasmer\nexport WASMER_DIR=\"$INSTALL_DIRECTORY\"\n[ -s \"\$WASMER_DIR/wasmer.sh\" ] && source \"\$WASMER_DIR/wasmer.sh\"\n"
SOURCE_STR="# Wasmer config\nexport WASMER_DIR=\"$INSTALL_DIRECTORY\"\nexport WASMER_CACHE_DIR=\"\$WASMER_DIR/cache\"\nexport PATH=\"\$WASMER_DIR/bin:\$WASMER_DIR/globals/wapm_packages/.bin:\$PATH\"\n"

# We create the wasmer.sh file
Expand All @@ -153,18 +153,17 @@ wasmer_link() {
fi
printf "\033[1A$cyan> Adding to bash profile... ✓$reset\n"
printf "${dim}Note: We've added the following to your $WASMER_PROFILE\n"
echo "If this isn't the profile of your current shell then please add the following to your correct profile:"
echo "If you have a different profile please add the following:"
printf "$LOAD_STR$reset\n"

version=`$INSTALL_DIRECTORY/bin/wasmer --version` || (
printf "$red> wasmer was installed, but doesn't seem to be working :($reset\n"
exit 1;
)

printf "$green> Successfully installed $version!\n\n${reset}If you want to have the command available now please execute:\nsource $INSTALL_DIRECTORY/wasmer.sh$reset\n"
printf "\nOtherwise, wasmer and wapm will be available the next time you open the terminal.\n"
echo "Note: during the alpha release of wapm, telemetry is enabled by default; if you would like to opt out, run \`wapm config set telemetry.enabled false\`."
echo "If you notice anything wrong or have any issues, please file a bug at https://github.com/wasmerio/wapm-cli :)"
printf "$green> Successfully installed $version!"
printf "\n${reset}${dim}wasmer & wapm will be available the next time you open the terminal."
printf "\n${reset}${dim}If you want to have the commands available now please execute:\n${reset}source $INSTALL_DIRECTORY/wasmer.sh$reset\n"
fi
}

Expand Down Expand Up @@ -230,31 +229,31 @@ initOS() {

wasmer_install() {
magenta1="${reset}\033[34;1m"
magenta2="${reset}\033[34m"
magenta3="${reset}\033[34;2m"
magenta2=""
magenta3=""

if which wasmer >/dev/null; then
printf "${reset}Updating wasmer$reset\n"
else
printf "${reset}Installing Wasmer!$reset\n"
printf "
${magenta1} ${magenta2} ${magenta3}###${reset}
${magenta1} ${magenta2} ${magenta3}#####${reset}
${magenta1} ${magenta2}### ${magenta3}######${reset}
${magenta1} ${magenta2}###### ${magenta3}#############${reset}
${magenta1}# ${magenta2}####### ${magenta3}##############${reset}
${magenta1}##### ${magenta2}#############${magenta3}#########${reset}
${magenta1}######${magenta2}###############${magenta3}#######${reset}
${magenta1}############${magenta2}#########${magenta3}#######${reset}
${magenta1}##############${magenta2}#######${magenta3}#######${reset}
${magenta1}##############${magenta2}#######${magenta3}#######${reset}
${magenta1}##############${magenta2}#######${magenta3}#######${reset}
${magenta1}##############${magenta2}#######${magenta3} ###${reset}
${magenta1}##############${magenta2}#######
${magenta1}###########${magenta2} ###
${magenta1}########${magenta2}
${magenta1}####${reset}
${magenta1} ww
${magenta1} wwwww
${magenta1} ww wwwwww w
${magenta1} wwwww wwwwwwwww
${magenta1}ww wwwwww w wwwwwww
${magenta1}wwwww wwwwwwwwww wwwww
${magenta1}wwwwww w wwwwwww wwwww
${magenta1}wwwwwwwwwwwwww wwwww wwwww
${magenta1}wwwwwwwwwwwwwww wwwww wwwww
${magenta1}wwwwwwwwwwwwwww wwwww wwwww
${magenta1}wwwwwwwwwwwwwww wwwww wwwww
${magenta1}wwwwwwwwwwwwwww wwwww wwww
${magenta1}wwwwwwwwwwwwwww wwwww
${magenta1} wwwwwwwwwwww wwww
${magenta1} wwwwwwww
${magenta1} wwww
${reset}
"
fi
# if [ -d "$INSTALL_DIRECTORY" ]; then
Expand Down Expand Up @@ -431,9 +430,12 @@ wasmer_download() {

# echo "Moving executable to $INSTALL_DIRECTORY/$INSTALL_NAME"

printf "$cyan> Unpacking contents...$reset\n"

mkdir -p $INSTALL_DIRECTORY
# Untar the wasmer contents in the install directory
tar -C $INSTALL_DIRECTORY -zxvf $DOWNLOAD_FILE
tar -C $INSTALL_DIRECTORY -zxf $DOWNLOAD_FILE
printf "\033[1A$cyan> Unpacking contents... ✓$reset\n"
}

wasmer_verify_or_quit() {
Expand Down

0 comments on commit f78e00c

Please sign in to comment.