Introduce NIXPROC_PROCESS environment variable to more easily rebuild the same configuration
This commit is contained in:
parent
bf4a09e2af
commit
9cd9e240e0
|
@ -7,7 +7,7 @@ shopt -s nullglob
|
|||
showUsage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $0 [OPTION] PATH
|
||||
Usage: $0 [OPTION] [PATH]
|
||||
or: $0 --undeploy [OPTION]
|
||||
or: $0 --rollback [OPTION]
|
||||
or: $0 --switch-generation NUM [OPTION]
|
||||
|
@ -63,6 +63,7 @@ Environment:
|
|||
NIX_STATE_DIR Overrides the location of the Nix state directory
|
||||
BSDRC_TARGET_DIR Directory in which the BSD rc scripts reside (defaults to:
|
||||
/usr/local/etc/rc.d)
|
||||
NIXPROC_PROCESSES Path to a processes model
|
||||
NIXPROC_STATE_DIR Changes the directory in which the state of the
|
||||
processes is stored
|
||||
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
|
||||
|
@ -158,12 +159,11 @@ done
|
|||
|
||||
shift
|
||||
|
||||
path="$1"
|
||||
|
||||
# Validate the given options
|
||||
|
||||
source @commonchecks@
|
||||
|
||||
checkProcessesFile "$1"
|
||||
checkNixStateDir
|
||||
checkProfile
|
||||
composeProfileBaseDir
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
showUsage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $0 [OPTION] PATH
|
||||
Usage: $0 [OPTION] [PATH]
|
||||
or: $0 --undeploy [OPTION]
|
||||
|
||||
This command builds a Nix profile containing multiple sysvinit scripts, and
|
||||
|
@ -32,6 +32,7 @@ Options:
|
|||
-h, --help Shows the usage of this command
|
||||
|
||||
Environment:
|
||||
NIXPROC_PROCESSES Path to a processes model
|
||||
NIXPROC_STATE_DIR Changes the directory in which the state of the
|
||||
processes is stored
|
||||
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
|
||||
|
@ -115,17 +116,21 @@ else
|
|||
processManagerArg="--argstr processManager $processManager"
|
||||
fi
|
||||
|
||||
if [ "$1" = "" ]
|
||||
if [ "$undeploy" = "1" ]
|
||||
then
|
||||
if [ "$undeploy" = "1" ]
|
||||
exprFileArg="--arg exprFile null"
|
||||
else
|
||||
if [ "$1" != "" ]
|
||||
then
|
||||
exprFileArg="--arg exprFile null"
|
||||
exprFile="$(@readlink@ -f "$1")"
|
||||
elif [ "$NIXPROC_PROCESSES" != "" ]
|
||||
then
|
||||
exprFile="$(@readlink@ -f "$NIXPROC_PROCESSES")"
|
||||
else
|
||||
echo "No processes expression provided!" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
exprFile="$(@readlink@ -f "$1")"
|
||||
|
||||
exprFileArg="--argstr exprFile $exprFile"
|
||||
fi
|
||||
|
||||
|
|
|
@ -24,6 +24,17 @@ checkProfile()
|
|||
profile=${profile:-processes}
|
||||
}
|
||||
|
||||
checkProcessesFile()
|
||||
{
|
||||
if [ "$1" != "" ]
|
||||
then
|
||||
processesFile="$1"
|
||||
elif [ "$NIXPROC_PROCESSES" != "" ]
|
||||
then
|
||||
processesFile="$NIXPROC_PROCESSES"
|
||||
fi
|
||||
}
|
||||
|
||||
buildProfile()
|
||||
{
|
||||
local processManager="$1"
|
||||
|
@ -32,7 +43,7 @@ buildProfile()
|
|||
then
|
||||
local deployArg="--undeploy"
|
||||
else
|
||||
local deployArg="$path"
|
||||
local deployArg="$processesFile"
|
||||
fi
|
||||
|
||||
profilePath=$(nixproc-build --process-manager $processManager $stateDirArg $runtimeDirArg $logDirArg $tmpDirArg $cacheDirArg $forceDisableUserChangeArg $showTraceArg "${extraParamsArg[@]}" --no-out-link $deployArg)
|
||||
|
|
|
@ -5,7 +5,7 @@ shopt -s nullglob
|
|||
showUsage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $0 [OPTION] PATH
|
||||
Usage: $0 [OPTION] [PATH]
|
||||
or: $0 --undeploy [OPTION]
|
||||
or: $0 --rollback [OPTION]
|
||||
or: $0 --switch-generation NUM [OPTION]
|
||||
|
@ -52,6 +52,7 @@ Options:
|
|||
|
||||
Environment:
|
||||
NIX_STATE_DIR Overrides the location of the Nix state directory
|
||||
NIXPROC_PROCESSES Path to a processes model
|
||||
NIXPROC_STATE_DIR Changes the directory in which the state of the
|
||||
processes is stored
|
||||
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
|
||||
|
@ -144,12 +145,11 @@ done
|
|||
|
||||
shift
|
||||
|
||||
path="$1"
|
||||
|
||||
# Validate the given options
|
||||
|
||||
source @commonchecks@
|
||||
|
||||
checkProcessesFile "$1"
|
||||
checkNixStateDir
|
||||
checkProfile
|
||||
composeProfileBaseDir
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
showUsage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $0 [OPTION] PATH
|
||||
Usage: $0 [OPTION] [PATH]
|
||||
or: $0 --undeploy [OPTION]
|
||||
or: $0 --rollback [OPTION]
|
||||
or: $0 --switch-generation NUM [OPTION]
|
||||
|
@ -51,6 +51,7 @@ Options:
|
|||
|
||||
Environment:
|
||||
NIX_STATE_DIR Overrides the location of the Nix state directory
|
||||
NIXPROC_PROCESSES Path to a processes model
|
||||
NIXPROC_STATE_DIR Changes the directory in which the state of the
|
||||
processes is stored
|
||||
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
|
||||
|
@ -141,12 +142,11 @@ done
|
|||
|
||||
shift
|
||||
|
||||
path="$1"
|
||||
|
||||
# Validate the given options
|
||||
|
||||
source @commonchecks@
|
||||
|
||||
checkProcessesFile "$1"
|
||||
checkNixStateDir
|
||||
checkProfile
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ shopt -s nullglob
|
|||
showUsage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $0 [OPTION] PATH
|
||||
Usage: $0 [OPTION] [PATH]
|
||||
or: $0 --undeploy [OPTION]
|
||||
or: $0 --rollback [OPTION]
|
||||
or: $0 --switch-generation NUM [OPTION]
|
||||
|
@ -55,6 +55,7 @@ Environment:
|
|||
NIX_STATE_DIR Overrides the location of the Nix state directory
|
||||
SYSTEMD_TARGET_DIR Directory in which the unit configuration files are
|
||||
managed (defaults to: /etc/systemd/system)
|
||||
NIXPROC_PROCESSES Path to a processes model
|
||||
NIXPROC_STATE_DIR Changes the directory in which the state of the
|
||||
processes is stored
|
||||
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
|
||||
|
@ -148,12 +149,11 @@ done
|
|||
|
||||
shift
|
||||
|
||||
path="$1"
|
||||
|
||||
# Validate the given options
|
||||
|
||||
source @commonchecks@
|
||||
|
||||
checkProcessesFile "$1"
|
||||
checkNixStateDir
|
||||
checkProfile
|
||||
composeProfileBaseDir
|
||||
|
|
|
@ -8,8 +8,9 @@ showUsage()
|
|||
Assigns unique IDs to process instances based on their ID requirements and ID
|
||||
resources configuration.
|
||||
|
||||
Usage: $0 [OPTION] --id-resources id_resources_nix PATH
|
||||
Usage: $0 [OPTION] --id-resources id_resources_nix [PATH]
|
||||
|
||||
Options:
|
||||
--id-resources=id_resources_nix
|
||||
ID resources Nix expression defining numeric ID resources
|
||||
--ids=ids_nix IDs Nix expression mapping services to unique IDs per
|
||||
|
@ -34,6 +35,7 @@ Usage: $0 [OPTION] --id-resources id_resources_nix PATH
|
|||
-h, --help Shows the usage of this command to the user
|
||||
|
||||
Environment:
|
||||
NIXPROC_PROCESSES Path to a processes model
|
||||
NIXPROC_STATE_DIR Changes the directory in which the state of the
|
||||
processes is stored
|
||||
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
|
||||
|
@ -111,13 +113,16 @@ processesFile="$1"
|
|||
|
||||
# Validate the given options
|
||||
|
||||
source @commonchecks@
|
||||
|
||||
checkProcessesFile "$1"
|
||||
|
||||
if [ "$idResourcesFile" = "" ]
|
||||
then
|
||||
echo "An ID resources configuration must be provided!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if [ "$processesFile" = "" ]
|
||||
then
|
||||
echo "A processes Nix expression must be provided!" >&2
|
||||
|
|
|
@ -55,6 +55,7 @@ Environment:
|
|||
NIX_STATE_DIR Overrides the location of the Nix state directory
|
||||
LAUNCHD_TARGET_DIR Directory in which the plist configuration files are
|
||||
managed (defaults to: /Library/LaunchDaemons)
|
||||
NIXPROC_PROCESSES Path to a processes model
|
||||
NIXPROC_STATE_DIR Changes the directory in which the state of the
|
||||
processes is stored
|
||||
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
|
||||
|
@ -147,12 +148,11 @@ done
|
|||
|
||||
shift
|
||||
|
||||
path="$1"
|
||||
|
||||
# Validate the given options
|
||||
|
||||
source @commonchecks@
|
||||
|
||||
checkProcessesFile "$1"
|
||||
checkNixStateDir
|
||||
checkProfile
|
||||
composeProfileBaseDir
|
||||
|
|
|
@ -50,6 +50,7 @@ Options:
|
|||
|
||||
Environment:
|
||||
NIX_STATE_DIR Overrides the location of the Nix state directory
|
||||
NIXPROC_PROCESSES Path to a processes model
|
||||
NIXPROC_STATE_DIR Changes the directory in which the state of the
|
||||
processes is stored
|
||||
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
|
||||
|
@ -142,12 +143,11 @@ done
|
|||
|
||||
shift
|
||||
|
||||
path="$1"
|
||||
|
||||
# Validate the given options
|
||||
|
||||
source @commonchecks@
|
||||
|
||||
checkProcessesFile "$1"
|
||||
checkNixStateDir
|
||||
checkProfile
|
||||
composeProfileBaseDir
|
||||
|
|
|
@ -93,10 +93,12 @@ done
|
|||
|
||||
shift
|
||||
|
||||
path="$1"
|
||||
source @commonchecks@
|
||||
|
||||
checkProcessesFile "$1"
|
||||
|
||||
# Build the environment with supervisord config files
|
||||
profilePath=$(nixproc-build --process-manager supervisord $stateDirArg $runtimeDirArg $logDirArg $tmpDirArg $cacheDirArg $forceDisableUserChangeArg $showTraceArg "${extraParamsArg[@]}" --no-out-link "$path")
|
||||
profilePath=$(nixproc-build --process-manager supervisord $stateDirArg $runtimeDirArg $logDirArg $tmpDirArg $cacheDirArg $forceDisableUserChangeArg $showTraceArg "${extraParamsArg[@]}" --no-out-link "$processesFile")
|
||||
|
||||
# Initialize all state
|
||||
nixproc-init-state $stateDirArg $runtimeDirArg $logDirArg $tmpDirArg $cacheDirArg $forceDisableUserChangeArg
|
||||
|
|
|
@ -58,6 +58,7 @@ Options:
|
|||
Environment:
|
||||
NIX_STATE_DIR Overrides the location of the Nix state directory
|
||||
SUPERVISORD_CONF_DIR Directory if which the supervisord.conf resides
|
||||
NIXPROC_PROCESSES Path to a processes model
|
||||
NIXPROC_STATE_DIR Changes the directory in which the state of the
|
||||
processes is stored
|
||||
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
|
||||
|
@ -150,12 +151,11 @@ done
|
|||
|
||||
shift
|
||||
|
||||
path="$1"
|
||||
|
||||
# Validate the given options
|
||||
|
||||
source @commonchecks@
|
||||
|
||||
checkProcessesFile "$1"
|
||||
checkNixStateDir
|
||||
checkProfile
|
||||
composeProfileBaseDir
|
||||
|
|
|
@ -57,6 +57,7 @@ Environment:
|
|||
SYSTEMD_TARGET_DIR Directory in which the unit configuration files are
|
||||
managed (defaults to: /etc/systemd/system or
|
||||
~/.config/systemd/user)
|
||||
NIXPROC_PROCESSES Path to a processes model
|
||||
NIXPROC_STATE_DIR Changes the directory in which the state of the
|
||||
processes is stored
|
||||
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
|
||||
|
@ -152,12 +153,11 @@ done
|
|||
|
||||
shift
|
||||
|
||||
path="$1"
|
||||
|
||||
# Validate the given options
|
||||
|
||||
source @commonchecks@
|
||||
|
||||
checkProcessesFile "$1"
|
||||
checkNixStateDir
|
||||
checkProfile
|
||||
composeProfileBaseDir
|
||||
|
|
|
@ -7,7 +7,7 @@ shopt -s nullglob
|
|||
showUsage()
|
||||
{
|
||||
cat <<EOF
|
||||
Usage: $0 [OPTION] PATH
|
||||
Usage: $0 [OPTION] [PATH]
|
||||
or: $0 --undeploy [OPTION]
|
||||
or: $0 --rollback [OPTION]
|
||||
or: $0 --switch-generation NUM [OPTION]
|
||||
|
@ -61,6 +61,7 @@ Options:
|
|||
|
||||
Environment:
|
||||
NIX_STATE_DIR Overrides the location of the Nix state directory
|
||||
NIXPROC_PROCESSES Path to a processes model
|
||||
NIXPROC_STATE_DIR Changes the directory in which the state of the
|
||||
processes is stored
|
||||
NIXPROC_RUNTIME_DIR Changes the directory in which the PID files are stored
|
||||
|
@ -155,12 +156,11 @@ done
|
|||
|
||||
shift
|
||||
|
||||
path="$1"
|
||||
|
||||
# Validate the given options
|
||||
|
||||
source @commonchecks@
|
||||
|
||||
checkProcessesFile "$1"
|
||||
checkNixStateDir
|
||||
checkProfile
|
||||
composeProfileBaseDir
|
||||
|
|
Loading…
Reference in New Issue