From 8af0c44eba5ae116dc2606c4c391e4d6f80eae4b Mon Sep 17 00:00:00 2001 From: Brooke Kuhlmann Date: Sun, 8 Jan 2017 09:52:51 -0700 Subject: [PATCH] Fixed install of zip app downloads with sub-directories. - Discovered some applications, packaged in zip file format, would extract to a sub-directory. This was problematic because all zip app installs previously assumed the app would be unzipped in the current directory. This fixes that situation where an app might be located in a sub-directory or several sub-directory deep. - The easiest fix for this problem would have been to the `-j` option for *junk* paths via unzip: "The archive's directory structure is not recreated; all files are deposited in the extraction directory (by default, the current one)." ...but some zip files, when unzipped, run executable code that creates the sub-directory structure dynamically which makes the `-j` option not viable. - The solution used to fix this problem uses `find` to determine if the application to install is in a sub-directory. If so, then the app is copied to the root folder (i.e. $MAC_OS_WORK_PATH) so the script can install as it has done in the past. Because the file copy is executed only if `find` finds something, this makes the copy optional for sub- directories and is a no-op for standard zip files with no sub- directories. Discovered that some zip app downloads use executable scripts to build for the particular machine when unzipped. http://earthlingsoft.net/UnicodeChecker/index.html --- lib/installers.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/installers.sh b/lib/installers.sh index 22f1253..9575aec 100644 --- a/lib/installers.sh +++ b/lib/installers.sh @@ -191,6 +191,7 @@ install_zip_app() { printf "Preparing...\n" cd "$MAC_OS_WORK_PATH" unzip -q "$download_file" + find . -type d -name "$app_name" -print -exec cp -pR {} . > /dev/null 2>&1 \; ) install_app "$MAC_OS_WORK_PATH" "$app_name"