Author: pierre
Date: Wed Apr 17 00:06:13 2019
New Revision: 4098
Log:
Improve testing of configration 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 <[email protected]>
Modified:
jhalfs/trunk/Makefile
jhalfs/trunk/jhalfs
Modified: jhalfs/trunk/Makefile
==============================================================================
--- jhalfs/trunk/Makefile Tue Apr 16 06:02:12 2019 (r4097)
+++ jhalfs/trunk/Makefile Wed Apr 17 00:06:13 2019 (r4098)
@@ -11,7 +11,7 @@
all: menuconfig
# @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:
$(MAKE) -C $(CONFIG) conf
@@ -20,7 +20,7 @@
$(MAKE) -C $(CONFIG) ncurses conf mconf
menuconfig: $(CONFIG)/mconf
- -@cp -a configuration configuration.old
+ @cp -a configuration configuration.old 2>/dev/null || true
@$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
config: $(CONFIG)/conf
Modified: jhalfs/trunk/jhalfs
==============================================================================
--- jhalfs/trunk/jhalfs Tue Apr 16 06:02:12 2019 (r4097)
+++ jhalfs/trunk/jhalfs Wed Apr 17 00:06:13 2019 (r4098)
@@ -124,15 +124,14 @@
# If the user has not saved his configuration file, let's ask
# 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)
-if [ "$(printf '%d' "$time_old")" -ge "$(printf '%d' "$time_current")" ]
- then echo -n "Do you want to run jhalfs? yes/no (yes): "
+time_current=$(stat -c '%Y' configuration 2>/dev/null || date +%s)
+time_old=$(stat -c '%Y' configuration.old 2>/dev/null || printf '%s'
"$time_current")
+if [ "$(printf '%d' "$time_old")" -ge "$(printf '%d' "$time_current")" ] ; then
+ printf 'Do you want to run jhalfs? yes/no (yes): '
read -r ANSWER
- if [ "x${ANSWER:0:1}" = "xn" ] || [ "x${ANSWER:0:1}" = "xN" ] ; then
- echo "${nl_}Exiting gracefully.${nl_}"
- exit
- fi
+ case ${ANSWER:0:1} in
+ n|N) printf "\nExiting gracefully.\n"; exit ;;
+ esac
fi
# Change this to 0 to suppress almost all messages
--
http://lists.linuxfromscratch.org/listinfo/alfs-log
Unsubscribe: See the above information page