Author: Jeremy Huntwork <jhuntwork@lightcubesolutions.com>
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@neuf.fr>
This commit is contained in:
parent
8589e90f5c
commit
a22bfe1ab5
2 changed files with 9 additions and 10 deletions
4
Makefile
4
Makefile
|
@ -11,7 +11,7 @@ CONFIG = menu
|
||||||
|
|
||||||
all: menuconfig
|
all: menuconfig
|
||||||
# @clear
|
# @clear
|
||||||
@`grep RUN_ME configuration | sed -e 's@RUN_ME=\"@@' -e 's@\"@@' `
|
@$$(grep RUN_ME configuration 2>/dev/null | sed -e 's@RUN_ME=\"@@' -e 's@\"@@')
|
||||||
|
|
||||||
$(CONFIG)/conf:
|
$(CONFIG)/conf:
|
||||||
$(MAKE) -C $(CONFIG) conf
|
$(MAKE) -C $(CONFIG) conf
|
||||||
|
@ -20,7 +20,7 @@ $(CONFIG)/mconf:
|
||||||
$(MAKE) -C $(CONFIG) ncurses conf mconf
|
$(MAKE) -C $(CONFIG) ncurses conf mconf
|
||||||
|
|
||||||
menuconfig: $(CONFIG)/mconf
|
menuconfig: $(CONFIG)/mconf
|
||||||
-@cp -a configuration configuration.old
|
@cp -a configuration configuration.old 2>/dev/null || true
|
||||||
@$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
|
@$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
|
||||||
|
|
||||||
config: $(CONFIG)/conf
|
config: $(CONFIG)/conf
|
||||||
|
|
15
jhalfs
15
jhalfs
|
@ -124,15 +124,14 @@ esac
|
||||||
|
|
||||||
# If the user has not saved his configuration file, let's ask
|
# If the user has not saved his configuration file, let's ask
|
||||||
# if he or she really wants to run this stuff
|
# if he or she really wants to run this stuff
|
||||||
time_old=$(stat -c '%Y' configuration.old 2>/dev/null)
|
time_current=$(stat -c '%Y' configuration 2>/dev/null || date +%s)
|
||||||
time_current=$(stat -c '%Y' configuration 2>/dev/null)
|
time_old=$(stat -c '%Y' configuration.old 2>/dev/null || printf '%s' "$time_current")
|
||||||
if [ "$(printf '%d' "$time_old")" -ge "$(printf '%d' "$time_current")" ]
|
if [ "$(printf '%d' "$time_old")" -ge "$(printf '%d' "$time_current")" ] ; then
|
||||||
then echo -n "Do you want to run jhalfs? yes/no (yes): "
|
printf 'Do you want to run jhalfs? yes/no (yes): '
|
||||||
read -r ANSWER
|
read -r ANSWER
|
||||||
if [ "x${ANSWER:0:1}" = "xn" ] || [ "x${ANSWER:0:1}" = "xN" ] ; then
|
case ${ANSWER:0:1} in
|
||||||
echo "${nl_}Exiting gracefully.${nl_}"
|
n|N) printf "\nExiting gracefully.\n"; exit ;;
|
||||||
exit
|
esac
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change this to 0 to suppress almost all messages
|
# Change this to 0 to suppress almost all messages
|
||||||
|
|
Reference in a new issue