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
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."