Le 22/03/2013 18:39, Bruce Dubbs a écrit :
Thomas Pegg wrote:
How about something like this Bruce.
I like that better, but it doesn't give an option if not saving the
configuration. Better to either give a choice or just exit(1) if the
config is not saved.
Why not modify the jhalfs script, rather? (well it needs some help from
the Makefile...)
Patch attached.
The behavior is: if "configuration" exists prior to running make, it is
copied with cp -a to configuration.old, so that jhalfs is able to
determine whether the configuration was saved (modification times of
"configuration" and "configuration.old" differ) or not.
If configuration does not exist prior to running make and you do not
save it, jhalfs exits with error, as it should be since it would not be
able to run anyway.
Regards
Pierre
Index: jhalfs-trunk/jhalfs
===================================================================
--- jhalfs-trunk.orig/jhalfs 2012-02-22 22:12:12.000000000 +0100
+++ jhalfs-trunk/jhalfs 2013-03-23 10:46:30.000000000 +0100
@@ -83,6 +83,19 @@
;;
esac
+# If the user has not saved his configuration file, let's ask
+# if he or she really wants to run this stuff
+if [ $(ls -l --time-style='+%Y%m%d%H%M%S' configuration.old | cut -d' ' -f 6) \
+ -ge $(ls -l --time-style='+%Y%m%d%H%M%S' configuration | cut -d' ' -f 6) ]
+ then echo -n "Do you want to run jhalfs? yes/no (yes): "
+ read ANSWER
+ if [ x${ANSWER:0:1} = "xn" -o x${ANSWER:0:1} = "xN" ] ; then
+ echo "${nl_}Exiting gracefully.${nl_}"
+ exit
+ fi
+fi
+
+# Change this to 0 to suppress almost all messages
VERBOSITY=1
[[ $VERBOSITY > 0 ]] && echo -n "Loading config params from <configuration>..."
Index: jhalfs-trunk/Makefile
===================================================================
--- jhalfs-trunk.orig/Makefile 2012-02-08 22:02:27.000000000 +0100
+++ jhalfs-trunk/Makefile 2013-03-23 10:21:58.000000000 +0100
@@ -17,6 +17,7 @@
$(MAKE) -C $(CONFIG) ncurses conf mconf
menuconfig: $(CONFIG)/mconf
+ -@cp -a configuration configuration.old
@$(CONFIG)/mconf $(CONFIG_CONFIG_IN)
config: $(CONFIG)/conf
--
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page