From a514f71e56c05e26fd4c9bc0130c3d2c9bf3b35b Mon Sep 17 00:00:00 2001 From: inxi-svn Date: Thu, 9 Jun 2011 20:09:41 +0000 Subject: [PATCH] Added script patch number, this will show on update along with version number. Also if > 0, will show added to display version, like: 1.6.3-4 I've found that google svn from googlecode isn't propagating the data across its data centers quickly or consistently which makes testing and debugging a real pain in the butt when dealing with people in different geographical areas. Now we'll be able to confirm that you have dev version xx, ie, the latest uploaded, without doing pointless primary version number bumps. When patch number is 00, no display occurs, but it still shows on updating via -U --- inxi | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/inxi b/inxi index c49a606..a024055 100755 --- a/inxi +++ b/inxi @@ -1,8 +1,9 @@ #!/bin/bash ######################################################################## #### Script Name: inxi -#### version: 1.6.3 -#### Date: June 8 2011 +#### version: 1.6.4 +#### Date: June 9 2011 +#### Patch Number: 00 ######################################################################## #### SPECIAL THANKS ######################################################################## @@ -379,6 +380,7 @@ LOG_FILE="$SCRIPT_DATA_DIR/inxi.log" LOG_FILE_1="$SCRIPT_DATA_DIR/inxi.1.log" LOG_FILE_2="$SCRIPT_DATA_DIR/inxi.2.log" SCRIPT_NAME="inxi" +SCRIPT_PATCH_NUMBER='' SCRIPT_PATH="" #filled-in in Main SCRIPT_VERSION_NUMBER="" #filled-in in Main SCRIPT_DOWNLOAD='http://inxi.googlecode.com/svn/trunk/' @@ -524,6 +526,7 @@ main() ### Only continue if depends ok SCRIPT_PATH=$( dirname $0 ) SCRIPT_VERSION_NUMBER=$( grep -im 1 'version:' $SCRIPT_PATH/$SCRIPT_NAME | gawk '{print $3}' ) + SCRIPT_PATCH_NUMBER=$( grep -im 1 'Patch Number:' $SCRIPT_PATH/$SCRIPT_NAME | gawk '{print $4}' ) ### Source global config overrides if [[ -s /etc/$SCRIPT_NAME.conf ]];then @@ -672,6 +675,7 @@ initialize_script_data() error_handler 6 fi # found a case of battery existing but having nothing in it on desktop mobo + # not all laptops show the first, if [[ -n $( ls /proc/acpi/battery 2>/dev/null ) ]];then B_PORTABLE='true' fi @@ -1230,6 +1234,7 @@ script_self_updater() local wget_error=0 file_contents='' print_screen_output "Starting $SCRIPT_NAME self updater." print_screen_output "Currently running $SCRIPT_NAME version number: $SCRIPT_VERSION_NUMBER" + print_screen_output "Patch version number: $SCRIPT_PATCH_NUMBER" print_screen_output "Updating $SCRIPT_NAME in $SCRIPT_PATH using $2 as download source..." file_contents="$( wget -q -O - $1$SCRIPT_NAME )" || wget_error=$? @@ -1240,7 +1245,9 @@ script_self_updater() echo "$file_contents" > $SCRIPT_PATH/$SCRIPT_NAME || error_handler 14 "$?" chmod +x $SCRIPT_PATH/$SCRIPT_NAME || error_handler 15 "$?" SCRIPT_VERSION_NUMBER=$( grep -im 1 'version:' $SCRIPT_PATH/$SCRIPT_NAME | gawk '{print $3}' ) + SCRIPT_PATCH_NUMBER=$( grep -im 1 'Patch Number:' $SCRIPT_PATH/$SCRIPT_NAME | gawk '{print $4}' ) print_screen_output "Successfully updated to $2 version: $SCRIPT_VERSION_NUMBER" + print_screen_output "Patch version number: $SCRIPT_PATCH_NUMBER" print_screen_output "To run the new version, just start $SCRIPT_NAME again." exit 0 else @@ -4480,6 +4487,15 @@ get_partition_uuid_label_data() eval $LOGFE } +get_patch_version_string() +{ + local script_patch_number=$( sed 's/^[0]\+//' <<< $SCRIPT_PATCH_NUMBER ) + if [[ -n $script_patch_number ]];then + script_patch_number="-$script_patch_number" + fi + echo $script_patch_number +} + # args: $1 - type cpu/mem get_ps_data() { @@ -5368,6 +5384,7 @@ print_short_data() # this gets that weird min/max final array item local min_max_clock_nu=$(( ${#A_CPU_DATA[@]} - 1 )) local min_max_clock=${A_CPU_DATA[$min_max_clock_nu]} + local script_patch_number=$( get_patch_version_string ) #set_color_scheme 12 if [[ $B_RUNNING_IN_SHELL == 'false' ]];then @@ -5397,7 +5414,7 @@ print_short_data() if [[ $SHOW_IRC -gt 0 ]];then short_data="${short_data}${C1}Client${C2}${SEP1}${IRC_CLIENT}${IRC_CLIENT_VERSION}${SEP2}" fi - short_data="${short_data}${C1}$SCRIPT_NAME${C2}${SEP1}$SCRIPT_VERSION_NUMBER${SEP2}${CN}" + short_data="${short_data}${C1}$SCRIPT_NAME${C2}${SEP1}$SCRIPT_VERSION_NUMBER$script_patch_number${SEP2}${CN}" if [[ $SCHEME -gt 0 ]];then short_data="${short_data} $NORMAL" fi @@ -5915,6 +5932,7 @@ print_info_data() local memory="$( get_memory_data )" local processes="$(( $( ps aux | wc -l ) - 1 ))" local up_time="$( get_uptime )" + local script_patch_number=$( get_patch_version_string ) # Some code could look superfluous but BitchX doesn't like lines not ending in a newline. F*&k that bitch! # long_last=$( echo -ne "${C1}Processes${C2} ${processes}${CN} | ${C1}Uptime${C2} ${up_time}${CN} | ${C1}Memory${C2} ${MEM}${CN}" ) @@ -5930,7 +5948,7 @@ print_info_data() if [[ $SHOW_IRC -gt 0 ]];then info_data="${info_data} ${C1}Client${C2} ${IRC_CLIENT}${IRC_CLIENT_VERSION}${CN}" fi - info_data="${info_data} ${C1}$SCRIPT_NAME${C2} $SCRIPT_VERSION_NUMBER${CN}" + info_data="${info_data} ${C1}$SCRIPT_NAME${C2} $SCRIPT_VERSION_NUMBER$script_patch_number${CN}" if [[ $SCHEME -gt 0 ]];then info_data="${info_data} ${NORMAL}"