summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/tools.c
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/tools.c')
-rw-r--r--mdk-stage1/tools.c70
1 files changed, 1 insertions, 69 deletions
diff --git a/mdk-stage1/tools.c b/mdk-stage1/tools.c
index aca40c971..2e27688ea 100644
--- a/mdk-stage1/tools.c
+++ b/mdk-stage1/tools.c
@@ -148,65 +148,6 @@ enum return_type copy_file(char * from, char * to, void (*callback_func)(int ove
}
}
-enum return_type recursiveRemove(char *file)
-{
- struct stat sb;
-
- if (lstat(file, &sb) != 0) {
- log_message("failed to stat %s: %d", file, errno);
- return RETURN_ERROR;
- }
-
- /* only descend into subdirectories if device is same as dir */
- if (S_ISDIR(sb.st_mode)) {
- char * strBuf = alloca(strlen(file) + 1024);
- DIR * dir;
- struct dirent * d;
-
- if (!(dir = opendir(file))) {
- log_message("error opening %s: %d", file, errno);
- return RETURN_ERROR;
- }
- while ((d = readdir(dir))) {
- if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
- continue;
-
- strcpy(strBuf, file);
- strcat(strBuf, "/");
- strcat(strBuf, d->d_name);
-
- if (recursiveRemove(strBuf) != 0) {
- closedir(dir);
- return RETURN_ERROR;
- }
- }
- closedir(dir);
-
- if (rmdir(file)) {
- log_message("failed to rmdir %s: %d", file, errno);
- return RETURN_ERROR;
- }
- } else {
- if (unlink(file) != 0) {
- log_message("failed to remove %s: %d", file, errno);
- return RETURN_ERROR;
- }
- }
- return RETURN_OK;
-}
-
-enum return_type recursiveRemove_if_it_exists(char *file)
-{
- struct stat sb;
-
- if (lstat(file, &sb) != 0) {
- /* if file doesn't exist, simply return OK */
- return RETURN_OK;
- }
-
- return recursiveRemove(file);
-}
-
enum return_type mount_compressed_image(char *compressed_image, char *location_mount)
{
if (lomount(compressed_image, location_mount, NULL, 1)) {
@@ -267,21 +208,12 @@ enum return_type load_compressed_fd(int fd, int size)
return preload_mount_compressed_fd(fd, size, COMPRESSED_NAME(""), STAGE2_LOCATION);
}
-// FIXME: guess right module from partition type (using libblkid?)
int try_mount(char * dev, char * location)
{
char device_fullname[50];
snprintf(device_fullname, sizeof(device_fullname), "/dev/%s", dev);
- if (my_mount(device_fullname, location, "ext4", 0) == -1 &&
- my_mount(device_fullname, location, "btrfs", 0) == -1 &&
- my_mount(device_fullname, location, "vfat", 0) == -1 &&
- my_mount(device_fullname, location, "ntfs", 0) == -1 &&
- my_mount(device_fullname, location, "reiserfs", 0) == -1 &&
- my_mount(device_fullname, location, "reiser4", 0) == -1 &&
- my_mount(device_fullname, location, "jfs", 0) == -1 &&
- my_mount(device_fullname, location, "xfs", 0) == -1 &&
- my_mount(device_fullname, location, "iso9660", 0) == -1) {
+ if (my_mount(device_fullname, location, "auto", 0) == -1) {
return 1;
}