fixed self updater, added release dates

This commit is contained in:
Harald Hope 2017-07-29 16:52:12 -07:00
parent 55d7875ba5
commit 86de557040

27
inxi
View file

@ -1063,30 +1063,28 @@ set_display_width()
# arg: $1 - version number: main/patch/date # arg: $1 - version number: main/patch/date
parse_version_data() parse_version_data()
{ {
local version_data=''
# note, using ####[[:space:]]+ to avoid having this function also trip the version datas # note, using ####[[:space:]]+ to avoid having this function also trip the version datas
case $1 in case $1 in
date) date)
version_data=$( gawk -F ': ' ' SELF_DATE=$( gawk -F '=' '
/####[[:space:]]+Date:/ { /^SELF_DATE/ {
print $NF print $NF
break
}' "$SELF_PATH/$SELF_NAME" ) }' "$SELF_PATH/$SELF_NAME" )
;; ;;
main) main)
version_data=$( gawk ' SELF_VERSION=$( gawk -F '=' '
/####[[:space:]]+Version:/ { /^SELF_VERSION/ {
print $3 print $NF
}' "$SELF_PATH/$SELF_NAME" ) }' "$SELF_PATH/$SELF_NAME" )
;; ;;
patch) patch)
version_data=$( gawk ' SELF_PATCH=$( gawk -F '=' '
/####[[:space:]]+Patch Number:/ { /^SELF_PATCH/ {
print $4 print $NF
}' "$SELF_PATH/$SELF_NAME" ) }' "$SELF_PATH/$SELF_NAME" )
;; ;;
esac esac
echo $version_data
} }
initialize_paths() initialize_paths()
@ -1623,6 +1621,7 @@ script_self_updater()
print_screen_output "Starting $SELF_NAME self updater." print_screen_output "Starting $SELF_NAME self updater."
print_screen_output "Currently running $SELF_NAME version number: $SELF_VERSION" print_screen_output "Currently running $SELF_NAME version number: $SELF_VERSION"
print_screen_output "Current version patch number: $SELF_PATCH" print_screen_output "Current version patch number: $SELF_PATCH"
print_screen_output "Current version release date: $SELF_DATE"
print_screen_output "Updating $SELF_NAME in $SELF_PATH using $2 as download source..." print_screen_output "Updating $SELF_NAME in $SELF_PATH using $2 as download source..."
case $DOWNLOADER in case $DOWNLOADER in
curl) curl)
@ -1648,10 +1647,12 @@ script_self_updater()
if [[ -n $( grep '###\*\*EOF\*\*###' <<< "$file_contents" ) ]];then if [[ -n $( grep '###\*\*EOF\*\*###' <<< "$file_contents" ) ]];then
echo "$file_contents" > $SELF_PATH/$SELF_NAME || error_handler 14 "$?" echo "$file_contents" > $SELF_PATH/$SELF_NAME || error_handler 14 "$?"
chmod +x $SELF_PATH/$SELF_NAME || error_handler 15 "$?" chmod +x $SELF_PATH/$SELF_NAME || error_handler 15 "$?"
SELF_VERSION=$( parse_version_data 'main' ) parse_version_data 'main'
SELF_PATCH=$( parse_version_data 'patch' ) parse_version_data 'patch'
parse_version_data 'date'
print_screen_output "Successfully updated to $2 version: $SELF_VERSION" print_screen_output "Successfully updated to $2 version: $SELF_VERSION"
print_screen_output "New $2 version patch number: $SELF_PATCH" print_screen_output "New $2 version patch number: $SELF_PATCH"
print_screen_output "New $2 version release date: $SELF_DATE"
print_screen_output "To run the new version, just start $SELF_NAME again." print_screen_output "To run the new version, just start $SELF_NAME again."
print_screen_output "----------------------------------------" print_screen_output "----------------------------------------"
print_screen_output "Starting download of man page file now." print_screen_output "Starting download of man page file now."