Skip to content

Commit

Permalink
compatibility with OS X 10.9 (Mavericks) => close #9
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin committed Nov 6, 2013
1 parent b81483b commit 6d7849c
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 10 deletions.
32 changes: 32 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

BIN="$PROJECT_DIR/../bin"
mkdir -p "$BIN"
BIN=`cd "$BIN";pwd` # normalize path

TARGET="$BIN/Asepsis"
DAEMON="$TARGET/asepsisd"
TEST="$TARGET/asepsisTest"
WRAPPER="$TARGET/DesktopServicesPrivWrapper"
UPDATER="$TARGET/AsepsisUpdater.app"

echo "build products dir is $BUILT_PRODUCTS_DIR"
echo "assembling final products in $BIN"

mkdir -p "$TARGET"

cp "$PROJECT_DIR"/com.binaryage.*.plist "$TARGET"
cp "$PROJECT_DIR/finish-uninstall.sh" "$TARGET"
cp "$PROJECT_DIR/finish-kext-uninstall.sh" "$TARGET"
cp "$PROJECT_DIR/launch-updater.sh" "$TARGET"
cp -Rf "$BUILT_PRODUCTS_DIR/asepsisd" "$DAEMON"
cp -Rf "$BUILT_PRODUCTS_DIR/asepsisTest" "$TEST"
cp -Rf "$BUILT_PRODUCTS_DIR/DesktopServicesPrivWrapper.framework/Versions/A/DesktopServicesPrivWrapper" "$WRAPPER"
cp -Rf "$BUILT_PRODUCTS_DIR/AsepsisUpdater.app" "$UPDATER"
cp "$PROJECT_DIR/install_name_tool" "$TARGET"
cp "$PROJECT_DIR/codesign" "$TARGET"

rm "$UPDATER/Contents/Frameworks/Sparkle.framework/Headers"
rm -rf "$UPDATER/Contents/Frameworks/Sparkle.framework/Versions/A/Headers"

cp -Rf "$PROJECT_DIR/../ctl" "$TARGET"
2 changes: 2 additions & 0 deletions ctl/asepsisctl
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ ASEPSISCTL_SYMLINK_PATH = "/usr/local/bin/asepsisctl"
ASEPSISCTL_SYMLINK_SOURCE_PATH = File.join(RESOURCES_PATH, "ctl", "asepsisctl")
DAEMON_LABEL = "com.binaryage.asepsis.daemon"
DS_FRAMEWORK_PATH = "/System/Library/PrivateFrameworks/DesktopServicesPriv.framework"
DS_LIB_ASEPSIS_REV = File.join(DS_FRAMEWORK_PATH, "Versions", "asepsis-1.4")
DS_LIB_FOLDER = File.join(DS_FRAMEWORK_PATH, "Versions", "A")
DS_LIB_RELOCATED_FOLDER = File.join(DS_FRAMEWORK_PATH, "Versions", "A_")
DS_LIB_BACKUP_FOLDER = File.join(DS_FRAMEWORK_PATH, "Versions", "A_Backup")
DS_WRAPPER_SOURCE_PATH = File.join(RESOURCES_PATH, "DesktopServicesPrivWrapper")

##############################################################################################################################
Expand Down
3 changes: 3 additions & 0 deletions ctl/cmd/install.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
def cmd_install(options)
# prevent installing on future OS versions
os_version_check()

ctl = "\"#{ASEPSISCTL_SYMLINK_SOURCE_PATH}\""
sys!("#{ctl} create_symlink")
sys!("#{ctl} make_dscage")
Expand Down
19 changes: 16 additions & 3 deletions ctl/cmd/install_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,30 @@ def cmd_install_wrapper(options)
force = options[:force]

unless force
`sw_vers -productVersion|grep '10\\.\\(7\\|8\\)'`
die("this version of Asepsis is only supported under OS X 10.7 or 10.8") if $?!=0
# prevent installing on future OS versions
os_version_check()
end

# sanity check
sys("sudo rm -rf \"#{DS_LIB_RELOCATED_FOLDER}\"") if File.exists? DS_LIB_RELOCATED_FOLDER and force
die("wrapper framework seems to be installed (#{DS_LIB_RELOCATED_FOLDER} exists), to reinstall please run: \"asepsisctl uninstall_wrapper\" first") if File.exists? DS_LIB_RELOCATED_FOLDER

# make initial backup first
unless File.exists? DS_LIB_BACKUP_FOLDER then
sys("sudo cp -r \"#{DS_LIB_FOLDER}\" \"#{DS_LIB_BACKUP_FOLDER}\"")
sys("sudo touch \"#{DS_LIB_ASEPSIS_REV}\"")
end

# replace DesktopServicesPriv inplace
sys("sudo rm -rf \"#{DS_LIB_RELOCATED_FOLDER}\"")

sys("sudo cp -r \"#{DS_LIB_FOLDER}\" \"#{DS_LIB_RELOCATED_FOLDER}\"")
sys("sudo \"#{RESOURCES_PATH}/install_name_tool\" -id \"#{DS_LIB_RELOCATED_FOLDER}/DesktopServicesPriv\" \"#{DS_LIB_RELOCATED_FOLDER}/DesktopServicesPriv\"")

sys("sudo \"#{RESOURCES_PATH}/install_name_tool\" -id \"#{DS_LIB_RELOCATED_FOLDER}/DesktopServicesPriv\" \"#{DS_LIB_RELOCATED_FOLDER}/DesktopServicesPriv\"")
sys("sudo cp \"#{DS_WRAPPER_SOURCE_PATH}\" \"#{DS_LIB_FOLDER}/DesktopServicesPriv\"")
sys("sudo rm -rf \"#{DS_LIB_FOLDER}/_CodeSignature\"")

# use adhoc codesign to make Mavericks happy (at least for now)
sys("sudo \"#{RESOURCES_PATH}/codesign\" --force --sign - \"#{DS_LIB_RELOCATED_FOLDER}/DesktopServicesPriv\"")
sys("sudo \"#{RESOURCES_PATH}/codesign\" --force --sign - \"#{DS_LIB_FOLDER}/DesktopServicesPriv\"")
end
20 changes: 15 additions & 5 deletions ctl/cmd/uninstall_wrapper.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
def cmd_uninstall_wrapper(options)
die("wrapper framework seems not to be installed (#{DS_LIB_RELOCATED_FOLDER} does not exist)") unless File.exists? DS_LIB_RELOCATED_FOLDER

# replace DesktopServicesPriv with original version
if File.exists? DS_LIB_ASEPSIS_REV then
# asepsis 1.4 path
die("the backup folder is missing! (#{DS_LIB_BACKUP_FOLDER} does not exist)") unless File.exists? DS_LIB_BACKUP_FOLDER

# replace DesktopServicesPriv with original version inplace
sys("sudo cp -r \"#{DS_LIB_RELOCATED_FOLDER}/_CodeSignature\" \"#{DS_LIB_FOLDER}\"")
sys("sudo cp \"#{DS_LIB_RELOCATED_FOLDER}/DesktopServicesPriv\" \"#{DS_LIB_FOLDER}/DesktopServicesPriv\"")
sys("sudo \"#{RESOURCES_PATH}/install_name_tool\" -id \"#{DS_LIB_FOLDER}/DesktopServicesPriv\" \"#{DS_LIB_FOLDER}/DesktopServicesPriv\"")
sys("sudo rm -rf \"#{DS_LIB_RELOCATED_FOLDER}\"")
sys("sudo rm -rf \"#{DS_LIB_FOLDER}\"")
sys("sudo mv \"#{DS_LIB_BACKUP_FOLDER}\" \"#{DS_LIB_FOLDER}\"")
sys("sudo rm -rf \"#{DS_LIB_RELOCATED_FOLDER}\"")
else
# asepsis 1.3.x and lower
sys("sudo cp -r \"#{DS_LIB_RELOCATED_FOLDER}/_CodeSignature\" \"#{DS_LIB_FOLDER}\"")
sys("sudo cp \"#{DS_LIB_RELOCATED_FOLDER}/DesktopServicesPriv\" \"#{DS_LIB_FOLDER}/DesktopServicesPriv\"")
sys("sudo \"#{RESOURCES_PATH}/install_name_tool\" -id \"#{DS_LIB_FOLDER}/DesktopServicesPriv\" \"#{DS_LIB_FOLDER}/DesktopServicesPriv\"")
sys("sudo rm -rf \"#{DS_LIB_RELOCATED_FOLDER}\"")
end
end
5 changes: 5 additions & 0 deletions ctl/lib/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,8 @@ def remove_permanent_sysctl(name, path = "/etc/sysctl.conf")
f << lines.join
end
end

def os_version_check()
`sw_vers -productVersion|grep '10\\.\\(7\\|8\\|9\\)'`
die("Asepsis #{ASEPSISCTL_VERSION} can be only installed under OS X versions 10.7, 10.8 and 10.9\nCheck out http://asepsis.binaryage.com for updated version.") if $?!=0
end
2 changes: 1 addition & 1 deletion installer/os_detection.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

TMP=`sw_vers -productVersion|grep '10\.\(7\|8\)'`
TMP=`sw_vers -productVersion|grep '10\.\(7\|8\|9\)'`
if [ $? -eq 0 ]; then
exit 0
fi
Expand Down
Binary file added packager/codesign
Binary file not shown.
2 changes: 1 addition & 1 deletion packager/packager.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "BIN=\"$PROJECT_DIR/../bin\"\n\nTARGET=\"$BIN/Asepsis\"\nDAEMON=\"$TARGET/asepsisd\"\nTEST=\"$TARGET/asepsisTest\"\nWRAPPER=\"$TARGET/DesktopServicesPrivWrapper\"\nUPDATER=\"$TARGET/AsepsisUpdater.app\"\n\necho \"build products dir is $BUILT_PRODUCTS_DIR\"\necho \"assembling final products in $BIN\"\n\nmkdir -p \"$TARGET\"\ncp \"$PROJECT_DIR\"/com.binaryage.*.plist \"$TARGET\"\ncp \"$PROJECT_DIR/finish-uninstall.sh\" \"$TARGET\"\ncp \"$PROJECT_DIR/finish-kext-uninstall.sh\" \"$TARGET\"\ncp \"$PROJECT_DIR/launch-updater.sh\" \"$TARGET\"\ncp -Rf \"$BUILT_PRODUCTS_DIR/asepsisd\" \"$DAEMON\"\ncp -Rf \"$BUILT_PRODUCTS_DIR/asepsisTest\" \"$TEST\"\ncp -Rf \"$BUILT_PRODUCTS_DIR/DesktopServicesPrivWrapper.framework/Versions/A/DesktopServicesPrivWrapper\" \"$WRAPPER\"\ncp -Rf \"$BUILT_PRODUCTS_DIR/AsepsisUpdater.app\" \"$UPDATER\"\ncp \"$PROJECT_DIR/install_name_tool\" \"$TARGET\"\n\ninstall_name_tool -change \"/System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A/DesktopServicesPriv\" \"/System/Library/PrivateFrameworks/DesktopServicesPriv.framework/Versions/A_/DesktopServicesPriv\" \"$WRAPPER\"\n\ncp -Rf \"$PROJECT_DIR/../ctl\" \"$TARGET\"";
shellScript = "\"$PROJECT_DIR/../build.sh\"\n";
showEnvVarsInLog = 0;
};
D657214613F09C230087EE6E /* Clean bin */ = {
Expand Down

0 comments on commit 6d7849c

Please sign in to comment.