#!/bin/sh

ROOT_PREFIX=""
ARCH=$(dpkg --print-architecture)
if [ "$ARCH" = "iphoneos-arm" ]; then
   if [ -L "/var/jb" ]; then
      # get symlink target
      # xina support
      destination=$(readlink -f /var/jb)
      if [ "$destination" != "/jb" ]; then
         ROOT_PREFIX="$destination"
      fi
   fi
else
   ROOT_PREFIX="/var/jb"
   # rootless has no legacy app
fi

launchctl unload $ROOT_PREFIX/Library/LaunchDaemons/com.opa334.cranehelperd.plist 2> /dev/null

exit 0