Skip to content

Commit f27e011

Browse files
committed
Fix normal docker run too
1 parent e505146 commit f27e011

File tree

1 file changed

+23
-37
lines changed
  • Docker/rootfs/etc/services.d/NetDaemonApp

1 file changed

+23
-37
lines changed
Lines changed: 23 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,52 @@
11
#!/usr/bin/with-contenv bash
2-
echo "Starting NetDaemon Runner"
32

43
declare daemondir="/daemon"
5-
declare is_custom_app_source=false
64

75
if [ ! -d "/data" ]; then
86
echo -e "\\033[31mMissing mapping to apps, please map '/data' to your apps folder\\033[0m" >&2
97
exit 1
108
fi
119

12-
if [[ "${NETDAEMON__APPLICATION_ASSEMBLY}" == *.csproj ]];
10+
if [ -z $NetDaemon_ApplicationAssembly ]
1311
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
2921

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
3327

3428
# make path relative to data folder (/config/netdaemon if addon)
3529
# if the path is a relative path
36-
if [[ "${NETDAEMON__APPLICATION_ASSEMBLY}" != /* ]];
30+
if [[ "${NetDaemon_ApplicationAssembly}" != /* ]];
3731
then
38-
export NETDAEMON__APPLICATION_ASSEMBLY="/data/${NETDAEMON__APPLICATION_ASSEMBLY}"
32+
export NetDaemon_ApplicationAssembly="/data/${NetDaemon_ApplicationAssembly}"
3933
fi
4034

4135
# The provided application source is ether a project or pre-compiled .Net application
42-
if [ ! -f ${NETDAEMON__APPLICATION_ASSEMBLY} ];
36+
if [ ! -f ${NetDaemon_ApplicationAssembly} ];
4337
then
4438

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
4640
exit 1
4741
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
5844

59-
if [[ "${PWD}" != "$(dirname "${NETDAEMON__APPLICATION_ASSEMBLY}")" ]]; then
45+
if [[ "${PWD}" != "$(dirname "${NetDaemon_ApplicationAssembly}")" ]]; then
6046
echo -e "\\033[31mCould not change directory to run custom project\\033[0m" >&2
6147
exit 1
6248
fi
63-
runme="$(basename "${NETDAEMON__APPLICATION_ASSEMBLY}")"
49+
runme="$(basename "${NetDaemon_ApplicationAssembly}")"
6450
exec dotnet $runme
6551
fi
6652

0 commit comments

Comments
 (0)