forked from Github/Axter-Stash
Enhanced CreateContainer.cmd
Made command line case insensitive. Added error handling incase use enters command option where stash port should be. Change command option for creating image from PULL to IMAGE, and left PULL so as to be backward compatible.
This commit is contained in:
@@ -6,9 +6,10 @@
|
||||
:: Example with shared mount paths:
|
||||
:: CreateContainer.cmd ContainerName1 "stashapp/stash:latest" 9991 C:\MySharedMountPath C:\Another\Shared\Folder
|
||||
:: Example adding Stash IMAGE and container:
|
||||
:: CreateContainer.cmd v0.27.2 "stashapp/stash:v0.27.2" 9997 PULL
|
||||
:: CreateContainer.cmd NewContainer27.2 "stashapp/stash:v0.27.2" 9997 IMAGE
|
||||
:: Note: The image name (stashapp/stash:v0.27.2) must be an image name listed in following link: https://hub.docker.com/r/stashapp/stash/tags
|
||||
:: Example with DLNA:
|
||||
:: CreateContainer.cmd v272 "stashapp/stash:v0.27.2" 9996 C:\downloads DLNA
|
||||
:: CreateContainer.cmd MyDLNA272 "stashapp/stash:v0.27.2" 9996 C:\downloads DLNA
|
||||
:: Example skipping docker-compose:
|
||||
:: CreateContainer.cmd ContainerName "stashapp/stash:v0.26.2" 9992 C:\Videos SKIP
|
||||
set NewContainerName=%1
|
||||
@@ -29,29 +30,40 @@ set SkipDockerCompose=
|
||||
set DLNAFunctionality="no"
|
||||
set PullDockerStashImage=
|
||||
set MountAccess=":ro"
|
||||
if [%SharedMountPath%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath=)
|
||||
if [%SharedMountPath%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath=)
|
||||
if [%SharedMountPath%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath=)
|
||||
if [%SharedMountPath2%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath2=)
|
||||
if [%SharedMountPath2%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath2=)
|
||||
if [%SharedMountPath2%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath2=)
|
||||
if [%SharedMountPath2%]==[WRITE] (set MountAccess=) & (set SharedMountPath2=)
|
||||
if [%SharedMountPath3%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath3=)
|
||||
if [%SharedMountPath3%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath3=)
|
||||
if [%SharedMountPath3%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath3=)
|
||||
if [%SharedMountPath3%]==[WRITE] (set MountAccess=) & (set SharedMountPath3=)
|
||||
if [%SharedMountPath4%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath4=)
|
||||
if [%SharedMountPath4%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath4=)
|
||||
if [%SharedMountPath4%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath4=)
|
||||
if [%SharedMountPath4%]==[WRITE] (set MountAccess=) & (set SharedMountPath4=)
|
||||
if [%SharedMountPath5%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath5=)
|
||||
if [%SharedMountPath5%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath5=)
|
||||
if [%SharedMountPath5%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath5=)
|
||||
if [%SharedMountPath5%]==[WRITE] (set MountAccess=) & (set SharedMountPath5=)
|
||||
if [%VariableArg%]==[DLNA] (set DLNAFunctionality=yes)
|
||||
if [%VariableArg%]==[SKIP] (set SkipDockerCompose=yes)
|
||||
if [%VariableArg%]==[PULL] (set PullDockerStashImage=yes)
|
||||
if [%VariableArg%]==[WRITE] (set MountAccess=)
|
||||
if /I [%SharedMountPath%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath=)
|
||||
if /I [%SharedMountPath%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath=)
|
||||
if /I [%SharedMountPath%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath=)
|
||||
if /I [%SharedMountPath%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath=)
|
||||
if /I [%SharedMountPath2%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath2=)
|
||||
if /I [%SharedMountPath2%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath2=)
|
||||
if /I [%SharedMountPath2%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath2=)
|
||||
if /I [%SharedMountPath2%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath2=)
|
||||
if /I [%SharedMountPath2%]==[WRITE] (set MountAccess=) & (set SharedMountPath2=)
|
||||
if /I [%SharedMountPath3%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath3=)
|
||||
if /I [%SharedMountPath3%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath3=)
|
||||
if /I [%SharedMountPath3%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath3=)
|
||||
if /I [%SharedMountPath3%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath3=)
|
||||
if /I [%SharedMountPath3%]==[WRITE] (set MountAccess=) & (set SharedMountPath3=)
|
||||
if /I [%SharedMountPath4%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath4=)
|
||||
if /I [%SharedMountPath4%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath4=)
|
||||
if /I [%SharedMountPath4%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath4=)
|
||||
if /I [%SharedMountPath4%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath4=)
|
||||
if /I [%SharedMountPath4%]==[WRITE] (set MountAccess=) & (set SharedMountPath4=)
|
||||
if /I [%SharedMountPath5%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath5=)
|
||||
if /I [%SharedMountPath5%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath5=)
|
||||
if /I [%SharedMountPath5%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath5=)
|
||||
if /I [%SharedMountPath5%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath5=)
|
||||
if /I [%SharedMountPath5%]==[WRITE] (set MountAccess=) & (set SharedMountPath5=)
|
||||
if /I [%VariableArg%]==[DLNA] (set DLNAFunctionality=yes)
|
||||
if /I [%VariableArg%]==[SKIP] (set SkipDockerCompose=yes)
|
||||
if /I [%VariableArg%]==[IMAGE] (set PullDockerStashImage=yes)
|
||||
if /I [%VariableArg%]==[PULL] (set PullDockerStashImage=yes)
|
||||
if /I [%VariableArg%]==[WRITE] (set MountAccess=)
|
||||
:: If user incorrectly enters below arguments instead of Stash-Port, fetch the values, and let CHECK_STASH_PORT get the required Stash-Port.
|
||||
if /I [%STASH_PORT%]==[DLNA] (set DLNAFunctionality=yes) & (set SharedMountPath=)
|
||||
if /I [%STASH_PORT%]==[SKIP] (set SkipDockerCompose=yes) & (set SharedMountPath=)
|
||||
if /I [%STASH_PORT%]==[IMAGE] (set PullDockerStashImage=yes) & (set SharedMountPath=)
|
||||
if /I [%STASH_PORT%]==[PULL] (set PullDockerStashImage=yes) & (set SharedMountPath=)
|
||||
echo SkipDockerCompose = %SkipDockerCompose% ; DLNAFunctionality = %DLNAFunctionality%
|
||||
set DockerComposeFile="docker-compose.yml"
|
||||
|
||||
@@ -59,18 +71,28 @@ if [%NewContainerName%]==[] goto :MissingArgumentNewContainerName
|
||||
goto :HaveVariableNewContainerName
|
||||
:MissingArgumentNewContainerName
|
||||
set /p NewContainerName="Enter the new container name: "
|
||||
if [%NewContainerName%]==[] goto :eof
|
||||
:HaveVariableNewContainerName
|
||||
|
||||
if [%Image%]==[] goto :MissingArgumentImage
|
||||
goto :HaveVariableImage
|
||||
:MissingArgumentImage
|
||||
set /p Image="Enter the image name: "
|
||||
if [%Image%]==[] goto :eof
|
||||
:HaveVariableImage
|
||||
|
||||
:CHECK_STASH_PORT
|
||||
if [%STASH_PORT%]==[] goto :MissingArgumentSTASH_PORT
|
||||
IF 1%STASH_PORT% NEQ +1%STASH_PORT% goto STASH_PORT_NOT_NUMERIC
|
||||
goto :HaveVariableSTASH_PORT
|
||||
:STASH_PORT_NOT_NUMERIC
|
||||
echo Error ******************
|
||||
echo Argument #3 requires a numeric value for Stash-Port. You entered "%STASH_PORT%" instead. Please enter a numberic value for Stash Port.
|
||||
:MissingArgumentSTASH_PORT
|
||||
set STASH_PORT=
|
||||
set /p STASH_PORT="Enter the Stash port number: "
|
||||
if [%STASH_PORT%]==[] Goto :eof
|
||||
goto :CHECK_STASH_PORT
|
||||
:HaveVariableSTASH_PORT
|
||||
|
||||
if exist %NewContainerName%\ (
|
||||
|
||||
Reference in New Issue
Block a user