summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-12-22 13:33:51 +0100
committerGravatar Nikias Bassen2010-12-22 13:33:51 +0100
commit15bb69a2d92c9eb7b4e0e2b8a5d2e9cdffeec8ba (patch)
tree7932d223f8cebd0432066e3cca9397f00dd5ba0b
parentebe8451a03f82772304657d3881a71530bafa1e4 (diff)
downloadifuse-15bb69a2d92c9eb7b4e0e2b8a5d2e9cdffeec8ba.tar.gz
ifuse-15bb69a2d92c9eb7b4e0e2b8a5d2e9cdffeec8ba.tar.bz2
Only compile house_arrest support with libimobiledevice >= 1.1.0
Since the house_arrest support was introduced with libimobiledevice 1.1.0 we only compile it in if at least version 1.1.0 is found.
-rw-r--r--configure.ac4
-rw-r--r--src/ifuse.c16
2 files changed, 18 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 678b888..0b555d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,6 +13,10 @@ AM_PROG_CC_C_O
# Checks for libraries.
PKG_CHECK_MODULES(libimobiledevice, libimobiledevice-1.0 >= 1.0.0)
+PKG_CHECK_MODULES(libimobiledevice11, libimobiledevice-1.0 >= 1.1.0, libimobiledevice_1_1=yes, libimobiledevice_1_1=no)
+if test x"$libimobiledevice_1_1" = xyes; then
+ AC_DEFINE([HAVE_LIBIMOBILEDEVICE_1_1], 1, [Define if libimobiledevice is using 1.1.0 API])
+fi
PKG_CHECK_MODULES(libglib2, glib-2.0 >= 2.14.1)
PKG_CHECK_MODULES(libgthread2, gthread-2.0 >= 2.14.1)
PKG_CHECK_MODULES(libfuse, fuse >= 2.7.0)
diff --git a/src/ifuse.c b/src/ifuse.c
index 54f0799..c96c836 100644
--- a/src/ifuse.c
+++ b/src/ifuse.c
@@ -37,7 +37,9 @@
#define AFC_SERVICE_NAME "com.apple.afc"
#define AFC2_SERVICE_NAME "com.apple.afc2"
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
#define HOUSE_ARREST_SERVICE_NAME "com.apple.mobile.house_arrest"
+#endif
#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/lockdown.h>
@@ -62,7 +64,9 @@ int debug = 0;
static struct {
char *mount_point;
char *device_uuid;
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
char *appid;
+#endif
char *service_name;
uint16_t port;
} opts;
@@ -87,8 +91,10 @@ static struct fuse_opt ifuse_opts[] = {
FUSE_OPT_KEY("--uuid %s", KEY_UUID_LONG),
FUSE_OPT_KEY("--root", KEY_ROOT),
FUSE_OPT_KEY("--debug", KEY_DEBUG),
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
FUSE_OPT_KEY("-a %s", KEY_APPID),
FUSE_OPT_KEY("--appid %s", KEY_APPID_LONG),
+#endif
FUSE_OPT_END
};
@@ -605,7 +611,9 @@ static void print_usage()
fprintf(stderr, " -u, --uuid UUID\tmount specific device by its 40-digit device UUID\n");
fprintf(stderr, " -h, --help\t\tprint usage information\n");
fprintf(stderr, " -V, --version\t\tprint version\n");
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
fprintf(stderr, " --appid APPID\t\tmount 'Documents' folder of app identified by APPID\n");
+#endif
fprintf(stderr, " --root\t\tmount root file system (jailbroken device required)\n");
fprintf(stderr, " --debug\t\tenable libimobiledevice communication debugging\n");
fprintf(stderr, "\n");
@@ -631,6 +639,7 @@ static int ifuse_opt_proc(void *data, const char *arg, int key, struct fuse_args
opts.device_uuid = strdup(arg+2);
res = 0;
break;
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
case KEY_APPID_LONG:
opts.appid = strdup(arg+7);
opts.service_name = HOUSE_ARREST_SERVICE_NAME;
@@ -641,6 +650,7 @@ static int ifuse_opt_proc(void *data, const char *arg, int key, struct fuse_args
opts.service_name = HOUSE_ARREST_SERVICE_NAME;
res = 0;
break;
+#endif
case KEY_DEBUG:
idevice_set_debug_level(1);
res = 0;
@@ -742,6 +752,7 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
if (!strcmp(opts.service_name, HOUSE_ARREST_SERVICE_NAME)) {
house_arrest_client_new(phone, opts.port, &house_arrest);
if (!house_arrest) {
@@ -771,13 +782,14 @@ int main(int argc, char *argv[])
fuse_opt_add_arg(&args, "-omodules=subdir");
fuse_opt_add_arg(&args, "-osubdir=Documents");
}
-
+#endif
res = fuse_main(args.argc, args.argv, &ifuse_oper, NULL);
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
leave_err:
if (house_arrest) {
house_arrest_client_free(house_arrest);
}
-
+#endif
return res;
}