Changeset a22bfe1 for jhalfs


Ignore:
Timestamp:
04/17/2019 07:06:13 AM (5 years ago)
Author:
Pierre Labastie <pierre@…>
Branches:
ablfs-more, legacy, trunk
Children:
dfc023a
Parents:
8589e90
Message:

Author: Jeremy Huntwork <jhuntwork@…>
Date: Tue Apr 16 13:31:09 2019 -0700

Improve testing of configuration file timestamp


  • Provide a default value for each so that the comparisons of the time of each file doesn't fail.
  • Two commands in the Makefile could acceptably fail, but would produce some ugly warnings.


Signed-off-by: Pierre Labastie <pierre.labastie@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jhalfs

    r8589e90 ra22bfe1  
    125125# If the user has not saved his configuration file, let's ask
    126126# if he or she really wants to run this stuff
    127 time_old=$(stat -c '%Y' configuration.old 2>/dev/null)
    128 time_current=$(stat -c '%Y' configuration 2>/dev/null)
    129 if [ "$(printf '%d' "$time_old")" -ge "$(printf '%d' "$time_current")" ]
    130   then echo -n "Do you want to run jhalfs? yes/no (yes): "
     127time_current=$(stat -c '%Y' configuration 2>/dev/null || date +%s)
     128time_old=$(stat -c '%Y' configuration.old 2>/dev/null || printf '%s' "$time_current")
     129if [ "$(printf '%d' "$time_old")" -ge "$(printf '%d' "$time_current")" ] ; then
     130  printf 'Do you want to run jhalfs? yes/no (yes): '
    131131  read -r ANSWER
    132   if [ "x${ANSWER:0:1}" = "xn" ] || [ "x${ANSWER:0:1}" = "xN" ] ; then
    133     echo "${nl_}Exiting gracefully.${nl_}"
    134     exit
    135   fi
     132  case ${ANSWER:0:1} in
     133    n|N) printf "\nExiting gracefully.\n"; exit ;;
     134  esac
    136135fi
    137136
Note: See TracChangeset for help on using the changeset viewer.