Created
February 6, 2019 15:13
-
-
Save GiacomoManzoli/0c03029f4a5475de25e9e9f3e72839bd to your computer and use it in GitHub Desktop.
Revisions
-
GiacomoManzoli created this gist
Feb 6, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ # ~~~ PRE INSTALL ~~~ APP_DIR='/Applications/_4KTestInstaller/' TEMP_PREFIX='TEMP_' filesToRestore=('File2.txt' 'Dir2/File2.txt') echo "** Creazione dei file temporanei **" echo "-----" for ((i=0;i<${#filesToRestore[@]};++i)); do srcFilePath="$APP_DIR${filesToRestore[i]}" echo "Source File path: $srcFilePath" srcFileName=$(basename "${srcFilePath}" ) # echo "Source File name: $srcFileName" srcFileDir=$(dirname "${srcFilePath}") # echo "Source File dir: $srcFileDir" destFilePath="$srcFileDir/$TEMP_PREFIX$srcFileName" echo "Backup File path: $destFilePath" if [ -e $srcFilePath ] ; then mv $srcFilePath $destFilePath fi echo "-----" done # ~~~ POST INSTALL ~~~ APP_DIR='/Applications/_4KTestInstaller/' APPLICATION_ROOT="${APP_DIR}Chess.app" TEMP_PREFIX='TEMP_' filesToRestore=('File2.txt' 'Dir2/File2.txt') echo "-----" for ((i=0;i<${#filesToRestore[@]};++i)); do ORGINAL_FILEPATH="$APP_DIR${filesToRestore[i]}" echo "Source File path: $ORGINAL_FILEPATH" srcFileName=$(basename "${ORGINAL_FILEPATH}" ) # echo "Source File name: $srcFileName" srcFileDir=$(dirname "${ORGINAL_FILEPATH}") # echo "Source File dir: $srcFileDir" BACKUP_FILEPATH="$srcFileDir/$TEMP_PREFIX$srcFileName" echo "Backup File path: $BACKUP_FILEPATH" if [ -e $BACKUP_FILEPATH ] ; then mv $BACKUP_FILEPATH $ORGINAL_FILEPATH fi echo "-----" done