When doing dockerHub install, check for name collision
parent
a64d6c8fa1
commit
f0b6fb728f
Binary file not shown.
|
@ -2617,7 +2617,7 @@ function dockerSearch(pageNumber) {
|
||||||
function dockerConvert(dockerID) {
|
function dockerConvert(dockerID) {
|
||||||
swal({
|
swal({
|
||||||
title: "<?tr("Determine configuration?")?>",
|
title: "<?tr("Determine configuration?")?>",
|
||||||
text: '<?tr('Would you like CA to attempt to determine any applicable paths, ports, and variables for the template? This will entail performing a test installation of the container. It will be automatically deleted after processing.')?>',
|
text: '<?tr('Would you like CA to attempt to determine any applicable paths, ports, and variables for the template? This will entail performing a test installation of the container. It will be automatically deleted after processing. The container will not be started.')?>',
|
||||||
html: true,
|
html: true,
|
||||||
type: 'info',
|
type: 'info',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
6c35f81875196de983d6640d48306830 ./Apps.page
|
990d0b76efb0311cf30163fa798455ce ./Apps.page
|
||||||
4e55f7483b661af21a25b677179baffe ./CA_notices.page
|
4e55f7483b661af21a25b677179baffe ./CA_notices.page
|
||||||
42a1658a916a3a3eed2a9f2af80603c4 ./ca_settings.page
|
42a1658a916a3a3eed2a9f2af80603c4 ./ca_settings.page
|
||||||
e718d7825dbdc96a17a915079222b098 ./default.cfg
|
e718d7825dbdc96a17a915079222b098 ./default.cfg
|
||||||
d80ab64bf966c609548865f6c32c3ac8 ./include/exec.php
|
105bb8a693748ba6bf8328dc78f8fc3a ./include/exec.php
|
||||||
f32bb71914346adbbc8a3a6b59e9521d ./include/helpers.php
|
f32bb71914346adbbc8a3a6b59e9521d ./include/helpers.php
|
||||||
d9b0dc98ee598d44633341ac199a43e0 ./include/paths.php
|
d9b0dc98ee598d44633341ac199a43e0 ./include/paths.php
|
||||||
532fffdf939594c143e679da02bd841e ./javascript/libraries.js
|
532fffdf939594c143e679da02bd841e ./javascript/libraries.js
|
||||||
71f911a818d88d3d567f8a2898094ee2 ./README.md
|
71f911a818d88d3d567f8a2898094ee2 ./README.md
|
||||||
79f3093f42415484944e6aa2863ee30a ./scripts/checkForUpdates.php
|
79f3093f42415484944e6aa2863ee30a ./scripts/checkForUpdates.php
|
||||||
496387a0bcb82280347d756a1d3cc30d ./scripts/dockerConvert.php
|
0a98a9bb4b6553043daa38a6e58e8048 ./scripts/dockerConvert.php
|
||||||
78912ecc112fd6cc6ca49b4b30197ba0 ./scripts/installMulti.php
|
78912ecc112fd6cc6ca49b4b30197ba0 ./scripts/installMulti.php
|
||||||
be74e770cdc8938200fc29580be4e3a1 ./scripts/installMultiPlugin.php
|
be74e770cdc8938200fc29580be4e3a1 ./scripts/installMultiPlugin.php
|
||||||
524afab04ca930f59117a846f819fb2f ./scripts/installPluginUpdate.sh
|
524afab04ca930f59117a846f819fb2f ./scripts/installPluginUpdate.sh
|
||||||
|
|
|
@ -1996,7 +1996,7 @@ function onStartupScreen() {
|
||||||
# convert_docker - called when system adds a container from dockerHub #
|
# convert_docker - called when system adds a container from dockerHub #
|
||||||
#######################################################################
|
#######################################################################
|
||||||
function convert_docker() {
|
function convert_docker() {
|
||||||
global $caPaths;
|
global $caPaths, $dockerManPaths;
|
||||||
|
|
||||||
$dockerID = getPost("ID","");
|
$dockerID = getPost("ID","");
|
||||||
|
|
||||||
|
@ -2015,6 +2015,13 @@ function convert_docker() {
|
||||||
$dockerfile['Privileged'] = "false";
|
$dockerfile['Privileged'] = "false";
|
||||||
$dockerfile['Networking']['Mode'] = "bridge";
|
$dockerfile['Networking']['Mode'] = "bridge";
|
||||||
$dockerfile['Icon'] = "/plugins/dynamix.docker.manager/images/question.png";
|
$dockerfile['Icon'] = "/plugins/dynamix.docker.manager/images/question.png";
|
||||||
|
|
||||||
|
$existing_templates = array_diff(scandir($dockerManPaths['templates-user']),[".",".."]);
|
||||||
|
foreach ( $existing_templates as $template ) {
|
||||||
|
if ( strtolower($dockerfile['Name']) == strtolower(str_replace(["my-",".xml"],["",""],$template)) )
|
||||||
|
$dockerfile['Name'] .= "-1";
|
||||||
|
}
|
||||||
|
|
||||||
$dockerXML = makeXML($dockerfile);
|
$dockerXML = makeXML($dockerfile);
|
||||||
|
|
||||||
file_put_contents($caPaths['dockerSearchInstall'],$dockerXML);
|
file_put_contents($caPaths['dockerSearchInstall'],$dockerXML);
|
||||||
|
|
|
@ -106,31 +106,47 @@ function addCloseButton() {
|
||||||
$ports = isset($json[0]['Config']['ExposedPorts']) ? $json[0]['Config']['ExposedPorts'] : [];
|
$ports = isset($json[0]['Config']['ExposedPorts']) ? $json[0]['Config']['ExposedPorts'] : [];
|
||||||
$vars = isset($json[0]['Config']['Env']) ? $json[0]['Config']['Env'] : [];
|
$vars = isset($json[0]['Config']['Env']) ? $json[0]['Config']['Env'] : [];
|
||||||
|
|
||||||
|
$count = 1;
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $path) {
|
||||||
$p = ["Name"=>"Path",'Type'=>"Path","Target"=>$path['Destination'],"Default"=>"","Mode"=>"rw","Display"=>"always","Required"=>"false","Mask"=>"false"];
|
$p = ["Name"=>"Container Path $count",'Type'=>"Path","Target"=>$path['Destination'],"Default"=>"","Mode"=>"rw","Display"=>"always","Required"=>"false","Mask"=>"false"];
|
||||||
$Config[]['@attributes'] = $p;
|
$Config[]['@attributes'] = $p;
|
||||||
|
$count++;
|
||||||
}
|
}
|
||||||
|
$count = 1;
|
||||||
foreach ($ports as $port => $name) {
|
foreach ($ports as $port => $name) {
|
||||||
$pp = explode("/",$port);
|
$pp = explode("/",$port);
|
||||||
$p = ["Name"=>"Port",'Type'=>"Port","Target"=>$pp[0],"Default"=>$pp[0],"Mode"=>$pp[1],"Display"=>"always","Required"=>"false","Mask"=>"false","Description"=>""];
|
$p = ["Name"=>"Container Port $count",'Type'=>"Port","Target"=>$pp[0],"Default"=>$pp[0],"Mode"=>$pp[1],"Display"=>"always","Required"=>"false","Mask"=>"false","Description"=>""];
|
||||||
$Config[]['@attributes'] = $p;
|
$Config[]['@attributes'] = $p;
|
||||||
|
$count++;
|
||||||
}
|
}
|
||||||
foreach ($vars as $var) {
|
foreach ($vars as $var) {
|
||||||
$textvars .= "$var\n";
|
$textvars .= "$var\n";
|
||||||
}
|
}
|
||||||
$testvars = parse_ini_string($textvars);
|
$testvars = parse_ini_string($textvars);
|
||||||
$defaultvars = ["HOST_HOSTNAME","HOST_OS","HOST_CONTAINERNAME","TZ","PATH"];
|
$defaultvars = ["HOST_HOSTNAME","HOST_OS","HOST_CONTAINERNAME","TZ","PATH"];
|
||||||
|
$count = 1;
|
||||||
foreach ($testvars as $var => $varcont) {
|
foreach ($testvars as $var => $varcont) {
|
||||||
if ( in_array($var,$defaultvars) )
|
if ( in_array($var,$defaultvars) )
|
||||||
continue;
|
continue;
|
||||||
$p = ["Name"=>"Variable",'Target'=>$var,"Type"=>"Variable","Default"=>$varcont,"Description"=>"","Required"=>"false","Mask"=>"false","Display"=>"always"];
|
|
||||||
$Config[]['@attributes'] = $p;
|
$Config[]['@attributes'] = ["Name"=>"Container Variable $count",'Target'=>$var,"Type"=>"Variable","Default"=>$varcont,"Description"=>"","Required"=>"false","Mask"=>"false","Display"=>"always"];
|
||||||
|
$count++;
|
||||||
}
|
}
|
||||||
|
$Config[]['@attributes'] = ["Name"=>"Community Applications Conversion",'Target'=>"Community_Applications_Conversion","Type"=>"Variable","Default"=>"true","Description"=>"","Required"=>"false","Mask"=>"false","Display"=>"always"];
|
||||||
|
|
||||||
if ( $Config )
|
if ( $Config )
|
||||||
$dockerfile['Config'] = $Config;
|
$dockerfile['Config'] = $Config;
|
||||||
|
} else {
|
||||||
|
$error = tr("An error occurred - Could not determine configuration");
|
||||||
}
|
}
|
||||||
$dockerfile['Name'] = $docker['Name'];
|
$dockerfile['Name'] = $docker['Name'];
|
||||||
|
|
||||||
|
$existing_templates = array_diff(scandir($dockerManPaths['templates-user']),[".",".."]);
|
||||||
|
foreach ( $existing_templates as $template ) {
|
||||||
|
if ( strtolower($dockerfile['Name']) == strtolower(str_replace(["my-",".xml"],["",""],$template)) )
|
||||||
|
$dockerfile['Name'] .= "-1";
|
||||||
|
}
|
||||||
|
|
||||||
file_put_contents($caPaths['dockerSearchInstall'],makeXML($dockerfile));
|
file_put_contents($caPaths['dockerSearchInstall'],makeXML($dockerfile));
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -139,7 +155,7 @@ function addCloseButton() {
|
||||||
window.parent.location = "/Apps/AddContainer?xmlTemplate=default:<?=$caPaths['dockerSearchInstall']?>";
|
window.parent.location = "/Apps/AddContainer?xmlTemplate=default:<?=$caPaths['dockerSearchInstall']?>";
|
||||||
|
|
||||||
<? else: ?>
|
<? else: ?>
|
||||||
alert("<?tr("An error occurred - Could not determine configuration")?>");
|
alert("<?=$error?>");
|
||||||
window.parent.location = "/Apps/AddContainer?xmlTemplate=default:<?=$caPaths['dockerSearchInstall']?>";
|
window.parent.location = "/Apps/AddContainer?xmlTemplate=default:<?=$caPaths['dockerSearchInstall']?>";
|
||||||
|
|
||||||
<? endif; ?>
|
<? endif; ?>
|
||||||
|
|
Loading…
Reference in New Issue