From 479a3b72d486dff4c30ec53bac9947b21dcdf663 Mon Sep 17 00:00:00 2001 From: Philip Schell Date: Tue, 10 Dec 2019 15:17:58 +0100 Subject: [PATCH] Move to NET .Core --- .github/workflows/dotnetcore.yml | 106 +++++ CHANGELOG.md | 1 + Lora-Map.sln | 109 +++-- Lora-Map/Lora-Map.csproj | 420 ++++++++---------- Lora-Map/Lora-Map_Core.csproj | 156 ------- Lora-Map/Model/WeatherWarnings.cs | 20 +- Lora-Map/Program.cs | 2 +- Lora-Map/Properties/AssemblyInfo.cs | 2 +- Lora-Map/dpkg/control | 2 +- .../{loramap-logrotate => logrotate-loramap} | 0 Lora-Map/dpkg/make-deb.sh | 62 ++- Lora-Map/dpkg/postinst | 16 +- Lora-Map/dpkg/preinst | 4 + Lora-Map/dpkg/prerm | 8 +- .../dpkg/{loramap.service => service-loramap} | 6 +- Lora-Map_Core.sln | 78 ---- README.md | 2 +- 17 files changed, 431 insertions(+), 563 deletions(-) create mode 100644 .github/workflows/dotnetcore.yml delete mode 100644 Lora-Map/Lora-Map_Core.csproj rename Lora-Map/dpkg/{loramap-logrotate => logrotate-loramap} (100%) rename Lora-Map/dpkg/{loramap.service => service-loramap} (77%) delete mode 100644 Lora-Map_Core.sln diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml new file mode 100644 index 0000000..f199d4b --- /dev/null +++ b/.github/workflows/dotnetcore.yml @@ -0,0 +1,106 @@ +name: Build, Test, Publish and Dockerise Lora-Map + +on: [push] + +jobs: + build: + name: Build, pack and release + runs-on: ubuntu-latest + steps: + - name: Checkout parent project with dependencys + uses: actions/checkout@v1 + with: + repository: MONICA-Project/map-project + ref: refs/heads/master + submodules: true + + - name: Checkout last versions + run: git -C Lora-Map checkout --progress --force ${{ github.sha }} + working-directory: ../map-project + + - name: Install dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.0.100 + + - name: Build with dotnet + run: dotnet build Lora-Map.sln --configuration Release + working-directory: ../map-project/Lora-Map + + - name: Create deb files + if: success() + run: | + mkdir ../../../Builds + chmod oug+x make-deb.sh + ./make-deb.sh amd64 + ./make-deb.sh armhf + id: create_deb + working-directory: ../map-project/Lora-Map/Lora-Map/dpkg + + - name: Create release + if: success() + id: nightly_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.create_deb.outputs.builddaterelease }} + release_name: Nightly from master + body: This is a nightly release. It may be not working properly. + draft: false + prerelease: true + + - name: Upload release asset amd64 + if: success() + id: upload-release-asset-amd64 + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.nightly_release.outputs.upload_url }} + asset_path: ../map-project/Builds/amd64-${{ steps.create_deb.outputs.debuilderfile }} + asset_name: amd64-${{ steps.create_deb.outputs.debuilderfile }} + asset_content_type: application/x-deb + + - name: Upload release asset armhf + if: success() + id: upload-release-asset-armhf + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.nightly_release.outputs.upload_url }} + asset_path: ../map-project/Builds/armhf-${{ steps.create_deb.outputs.debuilderfile }} + asset_name: armhf-${{ steps.create_deb.outputs.debuilderfile }} + asset_content_type: application/x-deb + + docker: + name: Build and push dockerfile + runs-on: ubuntu-latest + steps: + - name: Checkout parent project with dependencys + uses: actions/checkout@v1 + with: + repository: MONICA-Project/map-project + ref: refs/heads/master + submodules: true + + - name: Checkout last versions + run: git -C Lora-Map checkout --progress --force ${{ github.sha }} + working-directory: ../map-project + + - name: Docker build + id: docker_build + run: | + DOCKERTAG=$(date +%Y%m%d%H%M%S) + echo "##[set-output name=dockertag;]$DOCKERTAG" + docker build . -t monicaproject/lora-map:latest -t monicaproject/lora-map:$DOCKERTAG + working-directory: ../map-project + + - name: Docker-compose publish + if: success() + run: | + echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin ${INPUT_REGISTRY} + docker push monicaproject/lora-map:latest + docker push monicaproject/lora-map:${{ steps.docker_build.outputs.dockertag }} + working-directory: ../map-project \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bc635ea..a9ddd52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ * Create Aliases for Camera Count * Filter Fight under level * Refactoring +* Porting to .NET Core ## 1.2.9 ### New Features diff --git a/Lora-Map.sln b/Lora-Map.sln index 5212e18..6999e79 100644 --- a/Lora-Map.sln +++ b/Lora-Map.sln @@ -1,30 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2026 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29519.87 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lora-Map", "Lora-Map\Lora-Map.csproj", "{95D6F48A-9488-42A6-A973-941B45B26DB8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lora-Map_Core", "Lora-Map\Lora-Map.csproj", "{78136B15-FF0B-4DCE-94CA-1D6148DEA232}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils\Utils-IoT\Utils-IoT\Utils-IoT.csproj", "{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorDataMqtt", "..\Utils\ConnectorDataMqtt\ConnectorDataMqtt\ConnectorDataMqtt.csproj", "{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "litjson_4.7.1", "..\Librarys\litjson\litjson\litjson_4.7.1.csproj", "{91A14CD2-2940-4500-8193-56D37EDDDBAA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "M2Mqtt_4.7.1", "..\Librarys\mqtt\M2Mqtt\M2Mqtt_4.7.1.csproj", "{A11AEF5A-B246-4FE8-8330-06DB73CC8074}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bot-Utils", "..\Utils\Bot-Utils\Bot-Utils\Bot-Utils.csproj", "{BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Posix", "..\Librarys\Mono.Posix\Mono.Posix\Mono.Posix.csproj", "{E2CA132E-E85C-40AD-BE94-B138AA68772B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoordinateSharp", "..\Librarys\Coordinates\CoordinateSharp\CoordinateSharp.csproj", "{DA8510CE-7899-49DD-9E17-7C974382288D}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "map-project", "map-project", "{09970E82-A296-45BC-A389-77CA4EFEFFED}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7DD32F31-ACB0-4F5E-B3D8-78564A83ACEF}" ProjectSection(SolutionItems) = preProject ..\.dockerignore = ..\.dockerignore - ..\.travis.yml = ..\.travis.yml ..\CONTRIBUTING.md = ..\CONTRIBUTING.md ..\docker-compose.yml = ..\docker-compose.yml ..\Dockerfile = ..\Dockerfile @@ -33,53 +16,63 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "map-project", "map-project" ..\update.sh = ..\update.sh EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot-Utils_Core", "..\Utils\Bot-Utils\Bot-Utils\Bot-Utils_Core.csproj", "{ED37370F-AE65-498D-A425-413FEE69C0A8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils_Core", "..\Utils\Utils\Utils\Utils_Core.csproj", "{E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils-IoT_Core", "..\Utils\Utils-IoT\Utils-IoT\Utils-IoT_Core.csproj", "{04CF6328-3976-44D3-9959-A3B1A2C5C45A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConnectorDataMqtt_Core", "..\Utils\ConnectorDataMqtt\ConnectorDataMqtt\ConnectorDataMqtt_Core.csproj", "{E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "litjson_Core", "..\Librarys\litjson\litjson\litjson_Core.csproj", "{FFC66B7F-B4FB-4E42-B896-2C6772D899AA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "M2Mqtt_Core", "..\Librarys\mqtt\M2Mqtt\M2Mqtt_Core.csproj", "{00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoordinateSharp_Core", "..\Librarys\Coordinates\CoordinateSharp\CoordinateSharp_Core.csproj", "{D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {95D6F48A-9488-42A6-A973-941B45B26DB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {95D6F48A-9488-42A6-A973-941B45B26DB8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {95D6F48A-9488-42A6-A973-941B45B26DB8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {95D6F48A-9488-42A6-A973-941B45B26DB8}.Release|Any CPU.Build.0 = Release|Any CPU - {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.Build.0 = Release|Any CPU - {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Release|Any CPU.Build.0 = Release|Any CPU - {91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.Build.0 = Release|Any CPU - {A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Release|Any CPU.Build.0 = Release|Any CPU - {BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Release|Any CPU.Build.0 = Release|Any CPU - {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU - {E2CA132E-E85C-40AD-BE94-B138AA68772B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E2CA132E-E85C-40AD-BE94-B138AA68772B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2CA132E-E85C-40AD-BE94-B138AA68772B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E2CA132E-E85C-40AD-BE94-B138AA68772B}.Release|Any CPU.Build.0 = Release|Any CPU - {DA8510CE-7899-49DD-9E17-7C974382288D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DA8510CE-7899-49DD-9E17-7C974382288D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DA8510CE-7899-49DD-9E17-7C974382288D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DA8510CE-7899-49DD-9E17-7C974382288D}.Release|Any CPU.Build.0 = Release|Any CPU + {78136B15-FF0B-4DCE-94CA-1D6148DEA232}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78136B15-FF0B-4DCE-94CA-1D6148DEA232}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78136B15-FF0B-4DCE-94CA-1D6148DEA232}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78136B15-FF0B-4DCE-94CA-1D6148DEA232}.Release|Any CPU.Build.0 = Release|Any CPU + {ED37370F-AE65-498D-A425-413FEE69C0A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED37370F-AE65-498D-A425-413FEE69C0A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED37370F-AE65-498D-A425-413FEE69C0A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED37370F-AE65-498D-A425-413FEE69C0A8}.Release|Any CPU.Build.0 = Release|Any CPU + {E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}.Release|Any CPU.Build.0 = Release|Any CPU + {04CF6328-3976-44D3-9959-A3B1A2C5C45A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04CF6328-3976-44D3-9959-A3B1A2C5C45A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04CF6328-3976-44D3-9959-A3B1A2C5C45A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04CF6328-3976-44D3-9959-A3B1A2C5C45A}.Release|Any CPU.Build.0 = Release|Any CPU + {E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}.Release|Any CPU.Build.0 = Release|Any CPU + {FFC66B7F-B4FB-4E42-B896-2C6772D899AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FFC66B7F-B4FB-4E42-B896-2C6772D899AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FFC66B7F-B4FB-4E42-B896-2C6772D899AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FFC66B7F-B4FB-4E42-B896-2C6772D899AA}.Release|Any CPU.Build.0 = Release|Any CPU + {00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}.Release|Any CPU.Build.0 = Release|Any CPU + {D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {1534B636-9FC8-49BB-BB14-FC403ECDF889} + SolutionGuid = {7B1C516B-2EDC-4F6A-A1A5-A9BCA14C8603} EndGlobalSection EndGlobal diff --git a/Lora-Map/Lora-Map.csproj b/Lora-Map/Lora-Map.csproj index 9a40b21..d375764 100644 --- a/Lora-Map/Lora-Map.csproj +++ b/Lora-Map/Lora-Map.csproj @@ -1,261 +1,203 @@ - - - + + - Debug - AnyCPU - {95D6F48A-9488-42A6-A973-941B45B26DB8} Exe + netcoreapp3.0 Fraunhofer.Fit.IoT.LoraMap Lora-Map - v4.7.1 - 512 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - Adminrights.manifest + Lora-Map + Displays Items with Coordinates from Mqtt on a Map + Fraunhofer FIT + LoraMap.IoT.Fit.Fraunhofer + Copyright © Fraunhofer FIT, BlubbFish 2018 - 30.08.2019 + BlubbFish + 1.2.9 + LICENSE + https://github.com/MONICA-Project/lora-map + https://github.com/MONICA-Project/lora-map.git + git + de-DE + 1.2.9 The PüMa Release +1.2.8 Improving the UI +1.2.7 Reorganise a lot of things, add Support for Cameradata +1.2.6 New Types of marker for person +1.2.5 #10 text Letzer Datenempfang is too long when scrollbar is there and #11 set textsize for every zoomlevel +1.2.4 Can draw Textmarkers on the Map, use MGRS (UTM) on the Map +1.2.3 #9 display polygons and marker on the map +1.2.2 Bugfix, if only recieve panic packet with gps data, update the marker on the map also +1.2.1 #6 Load the map from the Device +1.2.0 #4 Possible to Ex and Import Setting +1.1.7 #8 Editor for Names +1.1.6 #5 Create admin area +1.1.5 Add support for alert button +1.1.4 #3 Create icons for devices +1.1.3 #1 Click on icon and show details +1.1.2 #2 Show versions number in Site +1.1.1 Add Debian package config + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + - - - - + PreserveNewest - - - - - - - - - - - + PreserveNewest - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - + PreserveNewest - + PreserveNewest - - + + PreserveNewest - - - - - {da8510ce-7899-49dd-9e17-7c974382288d} - CoordinateSharp - - - {91a14cd2-2940-4500-8193-56d37edddbaa} - litjson_4.7.1 - - - {a11aef5a-b246-4fe8-8330-06db73cc8074} - M2Mqtt_4.7.1 - - - {bb7bfcb5-3db0-49e1-802a-3ce3eecc59f9} - Bot-Utils - - - {ee6c8f68-ed46-4c1c-abdd-cfcdf75104f2} - ConnectorDataMqtt - - - {b870e4d5-6806-4a0b-b233-8907eedc5afc} - Utils-IoT - - - {fac8ce64-bf13-4ece-8097-aeb5dd060098} - Utils - - - - + + PreserveNewest - - - - + + PreserveNewest - + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + True + + - - - \ No newline at end of file + + diff --git a/Lora-Map/Lora-Map_Core.csproj b/Lora-Map/Lora-Map_Core.csproj deleted file mode 100644 index 2df3203..0000000 --- a/Lora-Map/Lora-Map_Core.csproj +++ /dev/null @@ -1,156 +0,0 @@ - - - - Exe - netcoreapp3.0 - Lora_Map - Lora-Map - Adminrights.manifest - - - - - - - - - - - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - diff --git a/Lora-Map/Model/WeatherWarnings.cs b/Lora-Map/Model/WeatherWarnings.cs index 7620277..39d6214 100644 --- a/Lora-Map/Model/WeatherWarnings.cs +++ b/Lora-Map/Model/WeatherWarnings.cs @@ -10,6 +10,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { public class WeatherWarnings { private readonly Settings settings; private Thread bgthread; + private Boolean backgroundrunnerAlive; private readonly WebRequests webrequests = new WebRequests(); public List Warnungen { get; private set; } @@ -21,11 +22,12 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { private void StartBackgroundThread() { this.bgthread = new Thread(this.BackGroundRunner); + this.backgroundrunnerAlive = true; this.bgthread.Start(); } private void BackGroundRunner() { - while(true) { + while(this.backgroundrunnerAlive) { List ret = new List(); foreach(Int32 item in this.settings.GetWeatherCellIds()) { try { @@ -40,11 +42,23 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { } catch { } } this.Warnungen = ret; - Thread.Sleep(60 * 1000); + for (Int32 i = 0; i < 1000; i++) { + if (this.backgroundrunnerAlive) { + Thread.Sleep(60); + } + } } } - internal void Dispose() => this.bgthread.Abort(); + internal void Dispose() { + try { + this.backgroundrunnerAlive = false; + while (this.bgthread.IsAlive) { + Thread.Sleep(10); + } + this.bgthread = null; + } catch { } + } public class Warning { public Warning(JsonData warning) { diff --git a/Lora-Map/Program.cs b/Lora-Map/Program.cs index 80f7cb6..687c249 100644 --- a/Lora-Map/Program.cs +++ b/Lora-Map/Program.cs @@ -5,7 +5,7 @@ using BlubbFish.Utils.IoT.Connector; namespace Fraunhofer.Fit.IoT.LoraMap { class Program { - static void Main(String[] args) { + static void Main(String[] _1) { InIReader.SetSearchPath(new List() { "/etc/loramap", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\loramap" }); if (!InIReader.ConfigExist("settings")) { Helper.WriteError("settings.ini not found!"); diff --git a/Lora-Map/Properties/AssemblyInfo.cs b/Lora-Map/Properties/AssemblyInfo.cs index d3c5f1a..72e9454 100644 --- a/Lora-Map/Properties/AssemblyInfo.cs +++ b/Lora-Map/Properties/AssemblyInfo.cs @@ -11,7 +11,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Fraunhofer FIT")] [assembly: AssemblyProduct("Lora-Map")] -[assembly: AssemblyCopyright("Copyright © 2018 - 30.08.2019")] +[assembly: AssemblyCopyright("Copyright © Fraunhofer FIT, BlubbFish 2018 - 30.08.2019")] [assembly: AssemblyTrademark("Fraunhofer FIT, BlubbFish")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("de-DE")] diff --git a/Lora-Map/dpkg/control b/Lora-Map/dpkg/control index ba69c20..1e0a7ed 100644 --- a/Lora-Map/dpkg/control +++ b/Lora-Map/dpkg/control @@ -3,7 +3,7 @@ Version: x.x-x Section: base Priority: optional Architecture: any -Depends: mono-runtime (>= 5.18), libmono-posix4.0-cil (>= 5.18), libmono-system-web4.0-cil (>= 5.18) +Depends: dotnet-runtime-3.0 (>= 3.0.1) Maintainer: BlubbFish Description: Lora-Map Lora-Map shows a Map to control the Lora Tracker diff --git a/Lora-Map/dpkg/loramap-logrotate b/Lora-Map/dpkg/logrotate-loramap similarity index 100% rename from Lora-Map/dpkg/loramap-logrotate rename to Lora-Map/dpkg/logrotate-loramap diff --git a/Lora-Map/dpkg/make-deb.sh b/Lora-Map/dpkg/make-deb.sh index 2b916f4..33bf55a 100644 --- a/Lora-Map/dpkg/make-deb.sh +++ b/Lora-Map/dpkg/make-deb.sh @@ -2,26 +2,35 @@ HOMEDIR=$HOME ROOT="$HOMEDIR/deb" -OUTPUT="../bin/Release" +OUTPUT="../bin/Release/netcoreapp3.0" -EXEC="$ROOT/usr/local/bin/loramap" -CONFIG="$ROOT/etc/loramap" +DEBNAME="loramap" +CSPROJFILE="Lora-Map.csproj" + +EXEC="$ROOT/usr/local/bin/$DEBNAME" +CONFIG="$ROOT/etc/$DEBNAME" SYSTEMD="$ROOT/lib/systemd/system" LOGROTATE="$ROOT/etc/logrotate.d" +echo "Catch all paths together for $DEBNAME." + DEBIAN="$ROOT/DEBIAN" -VMAJOR=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 1) -VMINOR=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 2) -VBUILD=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 3) +VMAJOR=$(grep -e "" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 1) +VMINOR=$(grep -e "" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 2) +VBUILD=$(grep -e "" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 3) ARCHT=$1 +echo "Versionsumber parsed: $VMAJOR.$VMINOR-$VBUILD." + mkdir -p $EXEC mkdir -p $CONFIG mkdir -p $DEBIAN mkdir -p $SYSTEMD mkdir -p $LOGROTATE -cp control $DEBIAN +echo "Created directorys." + +cp control $DEBIAN/control cp preinst $DEBIAN cp postinst $DEBIAN cp prerm $DEBIAN @@ -29,26 +38,49 @@ sed -i s/Version:\ x\.x-x/"Version: $VMAJOR.$VMINOR-$VBUILD"/ $DEBIAN/control sed -i s/Architecture:\ any/"Architecture: $ARCHT"/ $DEBIAN/control chmod 755 $DEBIAN -R -cp loramap.service $SYSTEMD -chmod 644 $SYSTEMD/loramap.service +echo "Copy deb control files." -cp $OUTPUT/*.exe $EXEC/ -#cp $OUTPUT/gpio.2.44 $EXEC/ -#cp $OUTPUT/libwiringPi.so.2.44 $EXEC/ +cp "service-$DEBNAME" "$SYSTEMD/$DEBNAME.service" +chmod 644 $SYSTEMD/"$DEBNAME.service" + +echo "Copy $DEBNAME.service to $SYSTEMD." + +cp $OUTPUT/*.runtimeconfig.json $EXEC/ find $OUTPUT -name \*.dll -exec cp {} $EXEC/ \; chmod 644 $EXEC/* chmod 755 $EXEC +echo "Copy programm files to $EXEC." + cp $OUTPUT/resources $EXEC -r sed -i s/"
vx.x.x"/"
$VMAJOR.$VMINOR.$VBUILD"/ $EXEC/resources/index.html +echo "Change Versionnumber in index.html" + cp $OUTPUT/config-example/* $CONFIG chmod 644 $CONFIG/* chmod 755 $CONFIG -cp loramap-logrotate $LOGROTATE/loramap +echo "Copy example-conf to $CONFIG." + +cp "logrotate-$DEBNAME" "$LOGROTATE/$DEBNAME.conf" chmod 644 $LOGROTATE/* +echo "Copy $DEBNAME.conf to $LOGROTATE." + dpkg-deb --build $ROOT -mv $HOMEDIR/deb.deb ../../../Builds/"$ARCHT-loramap_$VMAJOR.$VMINOR-$VBUILD.deb" -rm $HOMEDIR/deb -r \ No newline at end of file + +echo "Build deb packet." + + +TARGETFILE="$DEBNAME""_$VMAJOR.$VMINOR-$VBUILD.deb" +mv $HOMEDIR/deb.deb "../../../Builds/$ARCHT-$TARGETFILE" + +echo "Move $ARCHT-$TARGETFILE to Builds." + +rm $HOMEDIR/deb -r + +echo "Remove $HOMEDIR/deb." + +echo "##[set-output name=debuilderfile;]$TARGETFILE" +echo "##[set-output name=builddaterelease;]$(date +"%F_%H%M%S")" \ No newline at end of file diff --git a/Lora-Map/dpkg/postinst b/Lora-Map/dpkg/postinst index 27417e8..29de190 100644 --- a/Lora-Map/dpkg/postinst +++ b/Lora-Map/dpkg/postinst @@ -1,9 +1,17 @@ #!/bin/bash -systemctl enable loramap +DEBNAME="loramap" + +systemctl enable $DEBNAME systemctl daemon-reload -if [ -f /tmp/loramap_service_runner ]; then - service loramap start - rm /tmp/loramap_service_runner +touch /var/log/loramap.log +chown loramapbot:loramapbot /var/log/loramap.log +chmod 644 /var/log/loramap.log + +chown -R loramapbot:loramapbot /usr/local/bin/$DEBNAME + +if [ -f /tmp/$DEBNAME_service_runner ]; then + service $DEBNAME start + rm /tmp/$DEBNAME_service_runner fi \ No newline at end of file diff --git a/Lora-Map/dpkg/preinst b/Lora-Map/dpkg/preinst index 05a7907..ac749ec 100644 --- a/Lora-Map/dpkg/preinst +++ b/Lora-Map/dpkg/preinst @@ -1,2 +1,6 @@ #!/bin/bash +useradd -M loramapbot +usermod -L loramapbot +groupadd loramapbot +usermod -G loramapbot,adm loramapbot \ No newline at end of file diff --git a/Lora-Map/dpkg/prerm b/Lora-Map/dpkg/prerm index 77d10d3..c26ba9f 100644 --- a/Lora-Map/dpkg/prerm +++ b/Lora-Map/dpkg/prerm @@ -1,7 +1,9 @@ #!/bin/bash -if [[ $(systemctl is-active loramap || true) == "active" ]] +DEBNAME="loramap" + +if [[ $(systemctl is-active $DEBNAME || true) == "active" ]] then - touch /tmp/loramap_service_runner - service loramap stop + touch /tmp/$DEBNAME_service_runner + service $DEBNAME stop fi \ No newline at end of file diff --git a/Lora-Map/dpkg/loramap.service b/Lora-Map/dpkg/service-loramap similarity index 77% rename from Lora-Map/dpkg/loramap.service rename to Lora-Map/dpkg/service-loramap index 203bcac..42245a7 100644 --- a/Lora-Map/dpkg/loramap.service +++ b/Lora-Map/dpkg/service-loramap @@ -5,10 +5,10 @@ Description=Lora-Map After=network-online.target [Service] -User=root -Group=root +User=loramapbot +Group=loramapbot WorkingDirectory=/usr/local/bin/loramap -ExecStart=/usr/bin/mono /usr/local/bin/loramap/Lora-Map.exe +ExecStart=/usr/bin/dotnet /usr/local/bin/loramap/Lora-Map.dll KillMode=control-group TimeoutStopSec=5 Restart=on-failure diff --git a/Lora-Map_Core.sln b/Lora-Map_Core.sln deleted file mode 100644 index f58898e..0000000 --- a/Lora-Map_Core.sln +++ /dev/null @@ -1,78 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29519.87 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lora-Map_Core", "Lora-Map\Lora-Map_Core.csproj", "{78136B15-FF0B-4DCE-94CA-1D6148DEA232}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7DD32F31-ACB0-4F5E-B3D8-78564A83ACEF}" - ProjectSection(SolutionItems) = preProject - ..\.dockerignore = ..\.dockerignore - ..\CONTRIBUTING.md = ..\CONTRIBUTING.md - ..\docker-compose.yml = ..\docker-compose.yml - ..\Dockerfile = ..\Dockerfile - ..\LICENSE = ..\LICENSE - ..\README.md = ..\README.md - ..\update.sh = ..\update.sh - EndProjectSection -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot-Utils_Core", "..\Utils\Bot-Utils\Bot-Utils\Bot-Utils_Core.csproj", "{ED37370F-AE65-498D-A425-413FEE69C0A8}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils_Core", "..\Utils\Utils\Utils\Utils_Core.csproj", "{E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils-IoT_Core", "..\Utils\Utils-IoT\Utils-IoT\Utils-IoT_Core.csproj", "{04CF6328-3976-44D3-9959-A3B1A2C5C45A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConnectorDataMqtt_Core", "..\Utils\ConnectorDataMqtt\ConnectorDataMqtt\ConnectorDataMqtt_Core.csproj", "{E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "litjson_Core", "..\Librarys\litjson\litjson\litjson_Core.csproj", "{FFC66B7F-B4FB-4E42-B896-2C6772D899AA}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "M2Mqtt_Core", "..\Librarys\mqtt\M2Mqtt\M2Mqtt_Core.csproj", "{00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoordinateSharp_Core", "..\Librarys\Coordinates\CoordinateSharp\CoordinateSharp_Core.csproj", "{D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {78136B15-FF0B-4DCE-94CA-1D6148DEA232}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {78136B15-FF0B-4DCE-94CA-1D6148DEA232}.Debug|Any CPU.Build.0 = Debug|Any CPU - {78136B15-FF0B-4DCE-94CA-1D6148DEA232}.Release|Any CPU.ActiveCfg = Release|Any CPU - {78136B15-FF0B-4DCE-94CA-1D6148DEA232}.Release|Any CPU.Build.0 = Release|Any CPU - {ED37370F-AE65-498D-A425-413FEE69C0A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {ED37370F-AE65-498D-A425-413FEE69C0A8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {ED37370F-AE65-498D-A425-413FEE69C0A8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {ED37370F-AE65-498D-A425-413FEE69C0A8}.Release|Any CPU.Build.0 = Release|Any CPU - {E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}.Release|Any CPU.Build.0 = Release|Any CPU - {04CF6328-3976-44D3-9959-A3B1A2C5C45A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {04CF6328-3976-44D3-9959-A3B1A2C5C45A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {04CF6328-3976-44D3-9959-A3B1A2C5C45A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {04CF6328-3976-44D3-9959-A3B1A2C5C45A}.Release|Any CPU.Build.0 = Release|Any CPU - {E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}.Release|Any CPU.Build.0 = Release|Any CPU - {FFC66B7F-B4FB-4E42-B896-2C6772D899AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FFC66B7F-B4FB-4E42-B896-2C6772D899AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FFC66B7F-B4FB-4E42-B896-2C6772D899AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FFC66B7F-B4FB-4E42-B896-2C6772D899AA}.Release|Any CPU.Build.0 = Release|Any CPU - {00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}.Release|Any CPU.Build.0 = Release|Any CPU - {D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7B1C516B-2EDC-4F6A-A1A5-A9BCA14C8603} - EndGlobalSection -EndGlobal diff --git a/README.md b/README.md index b3a88df..0626290 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ This projects depends on different librarys. ##### External * litjson * M2Mqtt -* Mono.Posix +* CordinateSharp ## Contributing Contributions are welcome.