-
Notifications
You must be signed in to change notification settings - Fork 234
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ease upgrade procedure #400
Changes from 3 commits
2d2912a
1357484
34d049b
f33e678
02c9a55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.2.4 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ KERL_CONFIG=${KERL_CONFIG:="$HOME"/.kerlrc} | |
KERL_DOWNLOAD_DIR=${KERL_DOWNLOAD_DIR:="${KERL_BASE_DIR:?}"/archives} | ||
KERL_BUILD_DIR=${KERL_BUILD_DIR:="${KERL_BASE_DIR:?}"/builds} | ||
KERL_GIT_DIR=${KERL_GIT_DIR:="${KERL_BASE_DIR:?}"/gits} | ||
KERL_GIT_BASE=https://raw.githubusercontent.com/kerl/kerl/master | ||
|
||
if [ -n "$OTP_GITHUB_URL" ]; then | ||
_OGU="$OTP_GITHUB_URL" | ||
|
@@ -193,6 +194,7 @@ usage() { | |
echo ' install Install the specified release at the given location' | ||
echo ' deploy Deploy the specified installation to the given host and location' | ||
echo ' update Update the list of available releases from your source provider' | ||
echo ' upgrade Upgrade kerl to the latest available version' | ||
echo ' list List releases, builds and installations' | ||
echo ' delete Delete builds and installations' | ||
echo ' install-docsh Install erl shell documentation access extension - docsh' | ||
|
@@ -1736,6 +1738,10 @@ update_usage() { | |
echo "usage: $0 update releases" | ||
} | ||
|
||
upgrade_usage() { | ||
echo "upgrade: $0 upgrade" | ||
} | ||
|
||
get_active_path() { | ||
if [ -n "$_KERL_ACTIVE_DIR" ]; then | ||
echo "$_KERL_ACTIVE_DIR" | ||
|
@@ -2124,6 +2130,15 @@ index caa1ce568b..6ebb3d3a25 100644 | |
_END_PATCH | ||
} | ||
|
||
upgrade_kerl() { | ||
install_folder=$1 | ||
wget -q -O "$install_folder/kerl" $KERL_GIT_BASE/kerl | ||
chmod +x "$install_folder/kerl" | ||
version=$(kerl version) | ||
current_kerl_path="$(which kerl)" | ||
echo "kerl $version is now available at $current_kerl_path." | ||
} | ||
|
||
case "$1" in | ||
version) | ||
echo "$KERL_VERSION" | ||
|
@@ -2215,6 +2230,34 @@ case "$1" in | |
;; | ||
esac | ||
;; | ||
upgrade) | ||
if [ $# -ne 1 ]; then | ||
upgrade_usage | ||
exit 1 | ||
fi | ||
current_kerl_path="$(which kerl)" | ||
which_status=$? | ||
if [ $which_status != 0 ]; then | ||
install_folder="/usr/local/bin" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be its own environment variable or otherwise settable to a directory from the command line. (For example, I install my kerl at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Current kerl is $0 ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jadeallenx, agreed. If not set, would the current choice ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I didn't understand this, sorry. Here (in this place in the code), we're covering the option where |
||
echo "kerl not installed. Dropping it into $install_folder/kerl..." | ||
upgrade_kerl $install_folder | ||
else | ||
version=$(kerl version) | ||
echo "local kerl found ($current_kerl_path) at version $version." | ||
latest=$(curl -s $KERL_GIT_BASE/LATEST) | ||
echo "remote kerl found at version $latest." | ||
if [ "$version" != "$latest" ]; then | ||
echo "Versions are different. Upgrading to $latest." | ||
current_kerl_path=$(dirname "$current_kerl_path") | ||
upgrade_kerl "$current_kerl_path" | ||
else | ||
echo "No upgrade required." | ||
fi | ||
printf "Updating list of available releases... " | ||
kerl update releases > /dev/null | ||
echo "Done!" | ||
fi | ||
;; | ||
list) | ||
if [ $# -ne 2 ]; then | ||
list_usage | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use
curl
everywhere else in the script currently, can we please use it here too instead of adding a new dependency on wget.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure 馃憤
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 2d2912a