comparison Makefile @ 458:84841654c606 prerelease

update is a bit more clean through Makefile
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 20 Jun 2016 02:48:31 +0100
parents 0567af952cfa
children f48d28244fe2
comparison
equal deleted inserted replaced
457:44e5c12ce165 458:84841654c606
321 @echo uncompressed size: `unzip -l \`ls $(UPDATES_DIR)/*.zip\` | tail -n1 | awk '{print $$1}'` 321 @echo uncompressed size: `unzip -l \`ls $(UPDATES_DIR)/*.zip\` | tail -n1 | awk '{print $$1}'`
322 # Delete and re-create the temp directory (first, make sure it is not an empty string!) 322 # Delete and re-create the temp directory (first, make sure it is not an empty string!)
323 @[ -n $(UPDATE_SOURCE_DIR_BASE) ] && rm -rf $(UPDATE_SOURCE_DIR_BASE) && mkdir -p $(UPDATE_SOURCE_DIR_BASE) 323 @[ -n $(UPDATE_SOURCE_DIR_BASE) ] && rm -rf $(UPDATE_SOURCE_DIR_BASE) && mkdir -p $(UPDATE_SOURCE_DIR_BASE)
324 # Unzip the contents to the temp folder 324 # Unzip the contents to the temp folder
325 @cd $(UPDATE_SOURCE_DIR_BASE) && unzip -qq $(UPDATES_DIR)/*zip 325 @cd $(UPDATE_SOURCE_DIR_BASE) && unzip -qq $(UPDATES_DIR)/*zip
326 # Strip the top-level folder ( if there is only one ) 326 #TODO: this should not be needed. Remove comments. Strip the top-level folder ( if there is only one )
327 #@DIR=`ls -d $(UPDATE_SOURCE_DIR)` && COUNT=`echo $$DIR | wc -l` &&\ 327 #@DIR=`ls -d $(UPDATE_SOURCE_DIR)` && COUNT=`echo $$DIR | wc -l` &&\
328 [ $$COUNT -eq 1 ] && mv $(UPDATE_SOURCE_DIR)/* /tmp/supertemp && rm -rf $(UPDATE_SOURCE_DIR) && mv /tmp/supertemp $(UPDATE_SOURCE_DIR) 328 [ $$COUNT -eq 1 ] && mv $(UPDATE_SOURCE_DIR)/* /tmp/supertemp && rm -rf $(UPDATE_SOURCE_DIR) && mv /tmp/supertemp $(UPDATE_SOURCE_DIR)
329
329 # Now actually check if some key-files and folders are there 330 # Now actually check if some key-files and folders are there
330 @cd $(UPDATE_SOURCE_DIR) && FAIL=0 && for path in $(UPDATE_REQUIRED_PATHS); do `ls $$path >/dev/null 2>&1` || { FAIL=1; break; }; done;\ 331 @cd $(UPDATE_SOURCE_DIR) && FAIL=0 && for path in $(UPDATE_REQUIRED_PATHS); do `ls $$path >/dev/null 2>&1` || { FAIL=1; break; }; done;\
331 [ $$FAIL -eq 0 ] || { echo "$$path was not found in the zip archive. Maybe it is corrupted?"; exit 1; } 332 [ $$FAIL -eq 0 ] || { echo "$$path was not found in the zip archive. Maybe it is corrupted?"; exit 1; }
332 # Success. You can continue the install with "make update" 333 # Success. You can continue the install with "make update"
333 UPDATE_LOG?=~/update.log 334 UPDATE_LOG?=~/update.log
338 @echo > $(UPDATE_LOG) 339 @echo > $(UPDATE_LOG)
339 # Re-perform the check, just in case ... 340 # Re-perform the check, just in case ...
340 # Now actually check if some key-files and folders are there 341 # Now actually check if some key-files and folders are there
341 @cd $(UPDATE_SOURCE_DIR) && FAIL=0 && for path in $(UPDATE_REQUIRED_PATHS); do `ls $$path >/dev/null 2>&1` || { FAIL=1; break; }; done;\ 342 @cd $(UPDATE_SOURCE_DIR) && FAIL=0 && for path in $(UPDATE_REQUIRED_PATHS); do `ls $$path >/dev/null 2>&1` || { FAIL=1; break; }; done;\
342 [ $$FAIL -eq 0 ] || { echo "$$path was not found in the zip archive. Maybe it is corrupted?"; exit 1; } 343 [ $$FAIL -eq 0 ] || { echo "$$path was not found in the zip archive. Maybe it is corrupted?"; exit 1; }
343 # Duplicate the Bela folder $(BELA_DIR) to $(UPDATE_BELA_PATCH) ...
344 @[ -n $(UPDATE_BELA_PATCH) ] && mkdir -p $(UPDATE_BELA_PATCH) 344 @[ -n $(UPDATE_BELA_PATCH) ] && mkdir -p $(UPDATE_BELA_PATCH)
345 @#TODO: this would allow to trim trailing slashes in case we want to be safer: a="`pwd`/" ; target=${a%/} ; echo $target 345 @#TODO: this would allow to trim trailing slashes in case we want to be safer: a="`pwd`/" ; target=${a%/} ; echo $target
346 @rsync -a --delete-before $(BELA_DIR)/ $(UPDATE_BELA_PATCH) 346 # Clean folder
347 # Also backing it up in $(UPDATE_BELA_BACKUP)... 347 @$(MAKE) --no-print-directory coreclean
348 # Duplicate the Bela folder $(BELA_DIR) to $(UPDATE_BELA_PATCH) ...
349 @rsync -a --delete-during --exclude Documentation $(BELA_DIR)/ $(UPDATE_BELA_PATCH)
350 # Also backing it up in $(UPDATE_BELA_BACKUP) ...
348 @[ -n $(UPDATE_BELA_BACKUP) ] && mkdir -p $(UPDATE_BELA_BACKUP) 351 @[ -n $(UPDATE_BELA_BACKUP) ] && mkdir -p $(UPDATE_BELA_BACKUP)
349 @rsync -a $(BELA_DIR)/ $(UPDATE_BELA_BACKUP) 352 @rsync -a --delete-during $(BELA_DIR)/ $(UPDATE_BELA_BACKUP)
350 # Here's the trick: we run "update_board" ssh'ing into the BeagleBone itself! 353 # Here's the trick: we run "update_board" ssh'ing into the BeagleBone itself!
351 @cd $(UPDATE_SOURCE_DIR)/scripts && BBB_ADDRESS=root@127.0.0.1 BBB_BELA_HOME=$(UPDATE_BELA_PATCH) ./update_board -y --no-frills 354 @cd $(UPDATE_SOURCE_DIR)/scripts && BBB_ADDRESS=root@127.0.0.1 BBB_BELA_HOME=$(UPDATE_BELA_PATCH) ./update_board -y --no-frills
352 # If everything went ok, we now have the updated version of $(BELA_DIR) in $(UPDATE_BELA_PATCH) and a backup of $(BELA_DIR) in $(UPDATE_BELA_BACKUP) 355 # If everything went ok, we now have the updated version of $(BELA_DIR) in $(UPDATE_BELA_PATCH) and a backup of $(BELA_DIR) in $(UPDATE_BELA_BACKUP)
353 # So let's operate the magic swap. $(BELA_DIR) is moved to $(UPDATE_BELA_MV_BACKUP) and $(UPDATE_BELA_PATCH) is moved to $(BELA_DIR). 356 # So let's operate the magic swap. $(BELA_DIR) is moved to $(UPDATE_BELA_MV_BACKUP) and $(UPDATE_BELA_PATCH) is moved to $(BELA_DIR).
354 # If something goes wrong at thie stage, you can always find your old $(BELA_DIR) folder at $(UPDATE_BELA_BACKUP) 357 # If something goes wrong at thie stage, you can always find your old $(BELA_DIR) folder at $(UPDATE_BELA_BACKUP)