Cleanup upon new driver-request
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Wed, 5 Aug 2009 18:09:56 +0000 (11:09 -0700)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Wed, 5 Aug 2009 18:09:56 +0000 (11:09 -0700)
This lets you switch between drivers with driver-select.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
scripts/driver-select

index a7ec5e4c63fdf1cc49459a2315c4c399d170ebf7..df3c1013e8ac44ab70dc3f2eeea842fa7e41ad60 100755 (executable)
@@ -142,11 +142,28 @@ if [ ! -f compat-release ]; then
        exit
 fi
 
+if [[ ! -f built-in.o ]]; then
+       if [[ "$1" != "restore" ]]; then
+               echo -e "${YELLOW}Processing new driver-select request...${NORMAL}"
+       fi
+fi
+
 # Always backup the top level Makefile, unless restoring
 if [[ "$1" != "restore" ]]; then
        backup_file Makefile
 fi
 
+# If a user selects a new driver make sure we clean up for them
+# first and also restore the backup makefiles then. Otherwise
+# we'll be trying to leave drivers on Makefiles which are not
+# already there from a previous run.
+if [ -f built-in.o ]; then
+       echo -e "${YELLOW}Old build found, going to clean this up first...${NORMAL}"
+       make clean
+       echo -e "${YELLOW}Restoring Makefiles...${NORMAL}"
+       ./$0 restore
+fi
+
 case $1 in
        restore)
                restore_compat