Add prompt to refresh.sh

This commit is contained in:
Gregory Nutt 2014-08-30 07:00:52 -06:00
parent 9e119c1c4f
commit 28719a71da
2 changed files with 18 additions and 10 deletions

View File

@ -564,9 +564,16 @@ refresh.sh
two configuration files is often not useful. But tools/cmpconfig
will show only the meaningful differences between the two
configuration files.
4. It will edit the .config file to comment out the setting
of the CONFIG_APPS_DIR= setting. This setting should not
be in checked-in defconfig files because the actually must
be determined at the next time that the configuration is
installed.
5. Finally, the refreshed defconfig file is copied back in
place where it can be committed with the next set of
difference (unless you add --dry-run) to the command line.
difference to the command line. refresh.sh will prompt
you first to avoid overwriting the defconfig file with
changes that you do not want.
`
zipme.sh
--------

View File

@ -32,17 +32,13 @@
# POSSIBILITY OF SUCH DAMAGE.
#
USAGE="USAGE: $0 [--dry-run|--debug|--help] <board>/<config>"
USAGE="USAGE: $0 [--debug|--help] <board>/<config>"
ADVICE="Try '$0 --help' for more information"
unset CONFIG
DRYRUN=n
while [ ! -z "$1" ]; do
case $1 in
--dry-run )
DRYRUN=y
;;
--debug )
set -x
;;
@ -52,8 +48,6 @@ while [ ! -z "$1" ]; do
echo $USAGE
echo ""
echo "Where:"
echo " --dry-run"
echo " Do no change the defconfig file"
echo " --debug"
echo " Enable script debug"
echo " --help"
@ -169,16 +163,23 @@ make oldconfig
# Show differences
sed -i -e "s/^CONFIG_APPS_DIR/# CONFIG_APPS_DIR/g" .config
$CMPCONFIG $DEFCONFIG .config
if [ "X$DRYRUN" = "Xn" ]; then
# Save the refreshed configuration
read -p "Save the new configuration (y/n)?" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo "Saving the new configuration file"
sed -i -e "s/^CONFIG_APPS_DIR/# CONFIG_APPS_DIR/g" .config
mv .config $DEFCONFIG || \
{ echo "ERROR: Failed to move .config to $DEFCONFIG"; exit 1; }
chmod 644 $DEFCONFIG
fi
# Restore any previous .config file
if [ -e SAVEconfig ]; then
mv SAVEconfig .config || \
{ echo "ERROR: Failed to move SAVEconfig to .config"; exit 1; }