test if root can execute stuff inside a directory @param dir the directory to check @return true if root can create executable files inside dir
(String dir)
| 63 | * @return true if root can create executable files inside {@code dir} |
| 64 | */ |
| 65 | private boolean root(String dir) { |
| 66 | |
| 67 | if(dir==null) |
| 68 | return false; |
| 69 | |
| 70 | try { |
| 71 | String tmpname; |
| 72 | do { |
| 73 | tmpname = dir + "/" + UUID.randomUUID().toString(); |
| 74 | } while (System.getTools().raw.run(String.format("test -f '%s'", tmpname))==0); |
| 75 | |
| 76 | return System.getTools().shell.run( |
| 77 | String.format("touch '%1$s' && chmod %2$o '%1$s' && test -x '%1$s' && rm '%1$s'", |
| 78 | tmpname, 0755)) == 0; |
| 79 | } catch (Exception e) { |
| 80 | Logger.error(e.getMessage()); |
| 81 | } |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | private static void updateFuseBinds() { |
| 86 | try { |