|
1 | 1 | #!/usr/bin/with-contenv bash |
2 | | -echo "Starting NetDaemon Runner" |
3 | 2 |
|
4 | 3 | declare daemondir="/daemon" |
5 | | -declare is_custom_app_source=false |
6 | 4 |
|
7 | 5 | if [ ! -d "/data" ]; then |
8 | 6 | echo -e "\\033[31mMissing mapping to apps, please map '/data' to your apps folder\\033[0m" >&2 |
9 | 7 | exit 1 |
10 | 8 | fi |
11 | 9 |
|
12 | | -if [[ "${NETDAEMON__APPLICATION_ASSEMBLY}" == *.csproj ]]; |
| 10 | +if [ -z $NetDaemon_ApplicationAssembly ] |
13 | 11 | then |
14 | | - echo -e "\\033[31mcsproj deployments are not supported in v3, use compiled option instead!\\033[0m" >&2 |
15 | | - exit 1 |
16 | | -fi |
17 | | - |
18 | | -if [[ "${NETDAEMON__APPLICATION_ASSEMBLY}" == *.csproj ]]; |
19 | | -then |
20 | | - echo -e "\\033[31mcsproj deployments are not supported in v3, use compiled option instead!\\033[0m" >&2 |
21 | | - exit 1 |
22 | | -fi |
23 | | - |
24 | | -if [[ ! -z "${NETDAEMON__APPLICATION_ASSEMBLY}" ]] && [[ "${NETDAEMON__APPLICATION_ASSEMBLY}" != *".dll" ]]; |
25 | | -then |
26 | | - echo -e "\\033[31mAssembly needs to point to a .dll file!\\033[0m" >&2 |
27 | | - exit 1 |
28 | | -fi |
| 12 | + echo -e "\\033[32mStarting NetDaemon V3 runtime ...\\033[0m" >&2 |
| 13 | + cd "${daemondir}" |
| 14 | + exec dotnet NetDaemon.Host.Default.dll |
| 15 | +else |
| 16 | + if $NetDaemon_ApplicationAssembly == *.csproj ]]; |
| 17 | + then |
| 18 | + echo -e "\\033[31mcsproj deployments are not supported in v3, use compiled option instead!\\033[0m" >&2 |
| 19 | + exit 1 |
| 20 | + fi |
29 | 21 |
|
30 | | -if [[ "${NETDAEMON__APPLICATION_ASSEMBLY}" == *.dll ]]; |
31 | | -then |
32 | | - is_custom_app_source=true |
| 22 | + if $NetDaemon_ApplicationAssembly != *".dll" |
| 23 | + then |
| 24 | + echo -e "\\033[31mAssembly needs to point to a .dll file!\\033[0m" >&2 |
| 25 | + exit 1 |
| 26 | + fi |
33 | 27 |
|
34 | 28 | # make path relative to data folder (/config/netdaemon if addon) |
35 | 29 | # if the path is a relative path |
36 | | - if [[ "${NETDAEMON__APPLICATION_ASSEMBLY}" != /* ]]; |
| 30 | + if [[ "${NetDaemon_ApplicationAssembly}" != /* ]]; |
37 | 31 | then |
38 | | - export NETDAEMON__APPLICATION_ASSEMBLY="/data/${NETDAEMON__APPLICATION_ASSEMBLY}" |
| 32 | + export NetDaemon_ApplicationAssembly="/data/${NetDaemon_ApplicationAssembly}" |
39 | 33 | fi |
40 | 34 |
|
41 | 35 | # The provided application source is ether a project or pre-compiled .Net application |
42 | | - if [ ! -f ${NETDAEMON__APPLICATION_ASSEMBLY} ]; |
| 36 | + if [ ! -f ${NetDaemon_ApplicationAssembly} ]; |
43 | 37 | then |
44 | 38 |
|
45 | | - echo -e "\\033[31mThe assembly ${NETDAEMON__APPLICATION_ASSEMBLY} cannot be found. Please check the settings.\\033[0m" >&2 |
| 39 | + echo -e "\\033[31mThe assembly ${NetDaemon_ApplicationAssembly} cannot be found. Please check the settings.\\033[0m" >&2 |
46 | 40 | exit 1 |
47 | 41 | fi |
48 | | -fi |
49 | | - |
50 | | -if [[ $is_custom_app_source == false ]]; then |
51 | | - echo -e "\\033[32mRunning NetDaemon at ${daemondir}...\\033[0m" >&2 |
52 | | - cd "${daemondir}" |
53 | | - exec dotnet NetDaemon.Host.Default.dll |
54 | | -else |
55 | | - # This is a pre-built deamon |
56 | | - echo -e "\\033[32mRunning the pre-built NetDaemon at ${NETDAEMON__APPLICATION_ASSEMBLY}...\\033[0m" >&2 |
57 | | - cd "$(dirname "${NETDAEMON__APPLICATION_ASSEMBLY}")" || echo -e "\\033[31mCould not change directory to run project\\033[0m" >&2 |
| 42 | + echo -e "\\033[32mStarting NetDaemon V3 pre-built runtime using assembly ${NetDaemon_ApplicationAssembly}...\\033[0m" >&2 |
| 43 | + cd "$(dirname "${NetDaemon_ApplicationAssembly}")" || echo -e "\\033[31mCould not change directory to run project\\033[0m" >&2 |
58 | 44 |
|
59 | | - if [[ "${PWD}" != "$(dirname "${NETDAEMON__APPLICATION_ASSEMBLY}")" ]]; then |
| 45 | + if [[ "${PWD}" != "$(dirname "${NetDaemon_ApplicationAssembly}")" ]]; then |
60 | 46 | echo -e "\\033[31mCould not change directory to run custom project\\033[0m" >&2 |
61 | 47 | exit 1 |
62 | 48 | fi |
63 | | - runme="$(basename "${NETDAEMON__APPLICATION_ASSEMBLY}")" |
| 49 | + runme="$(basename "${NetDaemon_ApplicationAssembly}")" |
64 | 50 | exec dotnet $runme |
65 | 51 | fi |
66 | 52 |
|
0 commit comments