From 86de557040cb2fbc79d28b67e9b9388545b469c1 Mon Sep 17 00:00:00 2001 From: Harald Hope Date: Sat, 29 Jul 2017 16:52:12 -0700 Subject: [PATCH] fixed self updater, added release dates --- inxi | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/inxi b/inxi index d4b7817..48666cb 100755 --- a/inxi +++ b/inxi @@ -1063,30 +1063,28 @@ set_display_width() # arg: $1 - version number: main/patch/date parse_version_data() { - local version_data='' - # note, using ####[[:space:]]+ to avoid having this function also trip the version datas case $1 in date) - version_data=$( gawk -F ': ' ' - /####[[:space:]]+Date:/ { + SELF_DATE=$( gawk -F '=' ' + /^SELF_DATE/ { print $NF + break }' "$SELF_PATH/$SELF_NAME" ) ;; main) - version_data=$( gawk ' - /####[[:space:]]+Version:/ { - print $3 + SELF_VERSION=$( gawk -F '=' ' + /^SELF_VERSION/ { + print $NF }' "$SELF_PATH/$SELF_NAME" ) ;; patch) - version_data=$( gawk ' - /####[[:space:]]+Patch Number:/ { - print $4 + SELF_PATCH=$( gawk -F '=' ' + /^SELF_PATCH/ { + print $NF }' "$SELF_PATH/$SELF_NAME" ) ;; esac - echo $version_data } initialize_paths() @@ -1623,6 +1621,7 @@ script_self_updater() print_screen_output "Starting $SELF_NAME self updater." 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 release date: $SELF_DATE" print_screen_output "Updating $SELF_NAME in $SELF_PATH using $2 as download source..." case $DOWNLOADER in curl) @@ -1648,10 +1647,12 @@ script_self_updater() if [[ -n $( grep '###\*\*EOF\*\*###' <<< "$file_contents" ) ]];then echo "$file_contents" > $SELF_PATH/$SELF_NAME || error_handler 14 "$?" chmod +x $SELF_PATH/$SELF_NAME || error_handler 15 "$?" - SELF_VERSION=$( parse_version_data 'main' ) - SELF_PATCH=$( parse_version_data 'patch' ) + parse_version_data 'main' + parse_version_data 'patch' + parse_version_data 'date' 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 release date: $SELF_DATE" print_screen_output "To run the new version, just start $SELF_NAME again." print_screen_output "----------------------------------------" print_screen_output "Starting download of man page file now."