diff options
author | axtloss <axtlos@getcryst.al> | 2023-05-25 20:00:54 +0200 |
---|---|---|
committer | axtloss <axtlos@getcryst.al> | 2023-05-25 20:00:54 +0200 |
commit | 9c7f48af6e8b43960e0f51a9d1bca249421be685 (patch) | |
tree | 392ee954befa8eedea48593524bb9c0d320bf600 /src/main/java/io/github/jshipit/Mount.java | |
parent | 44ea7455e1f440a8df4070604213b390c21e7a3d (diff) | |
download | jshipit-9c7f48af6e8b43960e0f51a9d1bca249421be685.tar.gz jshipit-9c7f48af6e8b43960e0f51a9d1bca249421be685.tar.bz2 |
Change mount function and add chmod
Diffstat (limited to 'src/main/java/io/github/jshipit/Mount.java')
-rw-r--r-- | src/main/java/io/github/jshipit/Mount.java | 48 |
1 files changed, 0 insertions, 48 deletions
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); - } - } -} |