diff --git a/emhttp/plugins/dynamix.vm.manager/scripts/virtiofsd.php b/emhttp/plugins/dynamix.vm.manager/scripts/virtiofsd.php new file mode 100644 index 000000000..9d4945ab6 --- /dev/null +++ b/emhttp/plugins/dynamix.vm.manager/scripts/virtiofsd.php @@ -0,0 +1,58 @@ +#!/usr/bin/php +$arg) { + if (strpos($arg, "--fd") !== false) unset($argv[$i]) ; + if ($arg == "-o") { unset($argv[$i]);unset($argv[$i+1]); } + } + # Check if options file exists. Each option should be on a new line. + if (is_file($file)) $options = explode("\n",file_get_contents($file)) ; else $options = ['--syslog','--inode-file-handles=mandatory','--announce-submounts']; + $options[] = "--fd=".$argoptions['fd']; + + if (isset($argoptions['o'])) { + $virtiofsoptions = explode(',',$argoptions["o"]); + foreach ($virtiofsoptions as $opt) { + $optsplit = explode('=',$opt); + switch ($optsplit[0]) { + case "source": + $options[] = "--shared-dir={$optsplit[1]}"; + break; + case "cache": + $options[] = "--cache=never"; + break; + case "xattr": + $options[] = "--xattr"; + break; + case "sandbox": + $options[] = "--sandbox={$optsplit[1]}"; + break; + } + } + } + + $newargs = array_merge($options,$argv); + foreach($newargs as $arg) { + if ($arg != "") $whole_cmd.= escapeshellarg($arg).' '; + } + echo trim($whole_cmd); + ?> \ No newline at end of file