// libmount
#include <libmount/libmount.h>
+#include <pakfire/arch.h>
#include <pakfire/logging.h>
#include <pakfire/pakfire.h>
#include <pakfire/mount.h>
return 0;
}
+static int pakfire_mount_interpreter(struct pakfire* pakfire) {
+ char target[PATH_MAX];
+
+ // Fetch the target architecture
+ const char* arch = pakfire_get_arch(pakfire);
+
+ // Can we emulate this architecture?
+ char* interpreter = pakfire_arch_find_interpreter(arch);
+
+ // No interpreter required
+ if (!interpreter)
+ return 0;
+
+ DEBUG(pakfire, "Mounting interpreter %s for %s\n", interpreter, arch);
+
+ // Where to mount this?
+ int r = pakfire_make_path(pakfire, target, interpreter);
+ if (r < 0)
+ return r;
+
+ // Create directory
+ r = pakfire_mkparentdir(target, 0);
+ if (r)
+ return r;
+
+ // Create an empty file
+ FILE* f = fopen(target, "w");
+ if (!f)
+ return 1;
+ fclose(f);
+
+ r = pakfire_mount(pakfire, interpreter, target, NULL, MS_BIND|MS_RDONLY, NULL);
+ if (r)
+ ERROR(pakfire, "Could not mount interpreter %s to %s: %m\n", interpreter, target);
+
+ return r;
+}
+
int pakfire_mount_all(struct pakfire* pakfire) {
char target[PATH_MAX];
char options[PATH_MAX];
if (r)
return r;
+ // Mount the interpreter (if needed)
+ r = pakfire_mount_interpreter(pakfire);
+ if (r)
+ return r;
+
return 0;
}
return r;
}
-static int pakfire_mount_interpreter(struct pakfire* pakfire) {
- char target[PATH_MAX];
-
- // Can we emulate this architecture?
- char* interpreter = pakfire_arch_find_interpreter(pakfire->arch);
-
- // No interpreter required
- if (!interpreter)
- return 0;
-
- DEBUG(pakfire, "Mounting interpreter %s for %s\n", interpreter, pakfire->arch);
-
- // Where to mount this?
- int r = pakfire_make_path(pakfire, target, interpreter);
- if (r < 0)
- return r;
-
- // Create directory
- r = pakfire_mkparentdir(target, 0);
- if (r)
- return r;
-
- // Create an empty file
- FILE* f = fopen(target, "w");
- if (!f)
- return 1;
- fclose(f);
-
- r = pakfire_mount(pakfire, interpreter, target, NULL, MS_BIND|MS_RDONLY, NULL);
- if (r)
- ERROR(pakfire, "Could not mount interpreter %s to %s: %m\n", interpreter, target);
-
- return r;
-}
-
static void pakfire_free(struct pakfire* pakfire) {
struct pakfire_repo* repo = NULL;
int r;
goto ERROR;
}
- // Mount the interpreter (if needed)
- r = pakfire_mount_interpreter(p);
- if (r)
- goto ERROR;
-
// Make path for private files
char private_dir[PATH_MAX];
r = pakfire_make_path(p, private_dir, PAKFIRE_PRIVATE_DIR);