From 9c7f48af6e8b43960e0f51a9d1bca249421be685 Mon Sep 17 00:00:00 2001 From: axtloss Date: Thu, 25 May 2023 20:00:54 +0200 Subject: Change mount function and add chmod --- src/main/java/io/github/jshipit/Mount.java | 48 ------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 src/main/java/io/github/jshipit/Mount.java (limited to 'src/main/java/io/github/jshipit/Mount.java') diff --git a/src/main/java/io/github/jshipit/Mount.java b/src/main/java/io/github/jshipit/Mount.java deleted file mode 100644 index 63b60dd..0000000 --- a/src/main/java/io/github/jshipit/Mount.java +++ /dev/null @@ -1,48 +0,0 @@ -package io.github.jshipit; - -import com.sun.jna.Library; -import com.sun.jna.Native; -import com.sun.jna.Platform; - -public class Mount { - public interface CLibrary extends Library { - int mount(String source, String target, - String filesystemtype, int mountflags, - String data); - - int umount(String target); - } - - public void mount(String source, String target, - String filesystemtype, int mountflags, - String data) { - CLibrary libc; - - if (Platform.isLinux()) { - libc = Native.load("c", CLibrary.class); - int result = libc.mount(source, target, filesystemtype, mountflags, data); - if (result == 0) { - System.out.println("Device mounted successfully."); - } else { - System.out.println("Device mount failed."); - } - } - } - - public void overlayMount(String[] lower, String upper, String target) { - CLibrary libc; - - if (Platform.isLinux()) { - libc = Native.load("c", CLibrary.class); - int result = libc.mount("overlay", target, "overlay", 0, "lowerdir="+String.join(":", lower)+",upperdir="+upper+",workdir="+target+"/work"); - if (result == 0) { - System.out.println("Device mounted successfully."); - } else { - System.out.println("Device mount failed."); - } - } else { - System.out.println("Platform not supported."); - System.out.println("mount -t overlay overlay -o lowerdir="+String.join(":", lower)+",upperdir="+upper+",workdir="+target+"/work "+target); - } - } -} -- cgit v1.2.3