File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ if [ $# == 0 ] || [ "$1" == "-v" ] || [ "$1" == "--version" ] || [ "$1" == "-h"
5656 installedVersion=$( echo $KSCRIPT_VERSION | tr -d ' .' )
5757
5858 # # http://stackoverflow.com/questions/15224581/floating-point-comparison-with-variable-in-bash
59+ # # fixme bc is a dependency, use a kscriptlet here
5960 if [ $( echo " ${latestVersion} > ${installedVersion} " | bc) -eq 1 ]; then
6061 bold=$( tput bold) ; normal=$( tput sgr0) # # http://stackoverflow.com/questions/2924697/how-does-one-output-bold-text-in-bash
6162 echo -e " \n${bold} A new version of kscript is available. Use 'kscript --self-update' to update your local kscript installation" >&2
8990
9091
9192# # optionally self-update kscript ot the newest version (if not local copy is not being maintained by sdkman)
92- if [[ " $1 " == " --self-update" ]] && [[ -z " $( which kotlin | grep .sdkman) " ]]; then
93- echo " Installing latest version of kscript..."
94- kurl https://git.io/v9R73 > $( which kscript) && chmod u+x $( which kscript)
93+ if [[ " $1 " == " --self-update" ]]; then
94+ # # choose update strategy depending on installation type
95+ if [[ -z " $( which kscript | grep .sdkman) " ]]; then
96+ echo " Installing latest version of kscript..."
97+ kurl https://git.io/v9R73 > $( which kscript) && chmod u+x $( which kscript)
98+ else
99+ sdkman_auto_answer=true && sdk install kscript
100+ fi
95101
96102 echo " You're now running kscript " $( kscript --help 2>&1 | grep Version | cut -f2- | tr -d ' :' )
97103 exit 0
You can’t perform that action at this time.
0 commit comments