Skip to content

Commit dd5220a

Browse files
update nuget packages and add genswu.sh
1 parent 285fb5c commit dd5220a

6 files changed

Lines changed: 104 additions & 7 deletions

File tree

FileSyncApp/FileSyncApp.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFramework>net9.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>
99
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
1010
<PackageReference Include="Serilog" Version="4.2.0" />
11-
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.0" />
11+
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.1" />
1212
<PackageReference Include="Serilog.Sinks.Async" Version="2.1.0" />
1313
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
14-
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
14+
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
1515
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
1616
</ItemGroup>
1717

FileSyncApp/buildcommand.cmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dotnet publish -o pub-winx64 -c Release -p:PublishSingleFile=true -p:PublishTrimmed=false -p:Version=0.0.19-dev -r win-x64 --self-contained .\FileSyncApp.csproj
2+
dotnet publish -o pub-linux64 -c Release -p:PublishSingleFile=true -p:PublishTrimmed=false -p:Version=0.0.19-dev -r linux-x64 --self-contained .\FileSyncApp.csproj

FileSyncApp/genswu.sh

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/bin/bash
2+
3+
# Set variables
4+
APP_VERSION="0.0.19-dev"
5+
APP_NAME="FileSyncApp"
6+
APP_DIR="/opt/$APP_NAME"
7+
SERVICE_FILE="$APP_NAME.service"
8+
SW_DESCRIPTION="sw-description"
9+
OUTPUT_DIR="FileSyncAppPackage"
10+
PUBLISH_DIR="publish"
11+
12+
dotnet publish -o $PUBLISH_DIR -c Release -p:PublishSingleFile=true -p:PublishTrimmed=false -p:Version=$APP_VERSION -r linux-x64 --self-contained ./FileSyncApp.csproj
13+
# Create directory structure
14+
15+
mkdir -p ${OUTPUT_DIR}
16+
mount -t ramfs ramfs ${OUTPUT_DIR}
17+
18+
# Create systemd service file
19+
cat <<EOL > ${OUTPUT_DIR}/${SERVICE_FILE}
20+
[Unit]
21+
Description=FileSyncApp - Datei-Synchronisation
22+
After=network.target
23+
24+
[Service]
25+
ExecStart=$APP_DIR/$APP_NAME
26+
WorkingDirectory=$APP_DIR
27+
Restart=on-failure
28+
User=root
29+
Environment=DOTNET_EnableDiagnostics=0
30+
31+
[Install]
32+
WantedBy=multi-user.target
33+
EOL
34+
35+
# Create sw-description filex
36+
cat <<EOL > ${OUTPUT_DIR}/${SW_DESCRIPTION}
37+
software =
38+
{
39+
version = "$APP_VERSION";
40+
description = "FileSyncApp Deployment";
41+
bootloader_transaction_marker = false;
42+
bootloader_state_marker = false;
43+
hardware-compatibility: [ "#RE:.*" ];
44+
files: (
45+
{
46+
filename = "$APP_NAME";
47+
path = "$APP_DIR/$APP_NAME";
48+
},
49+
{
50+
filename = "$APP_NAME.service";
51+
path = "/etc/systemd/system/$SERVICE_FILE";
52+
}
53+
);
54+
scripts: (
55+
{
56+
filename = "update.sh";
57+
type = "shellscript";
58+
}
59+
);
60+
preinstall = " || true && mkdir -p /opt/$APP_NAME";
61+
postinstall = "systemctl daemon-reexec && systemctl daemon-reload && systemctl enable --now $APP_NAME.service";
62+
};
63+
EOL
64+
cat <<\EOFUPDATE > ${OUTPUT_DIR}/update.sh
65+
#!/bin/sh
66+
67+
if [ $# -lt 1 ]; then
68+
exit 0;
69+
fi
70+
if [ $1 = "preinst" ]; then
71+
systemctl stop FileSyncApp.service
72+
mkdir -p /opt/FileSyncApp
73+
echo "PREINST -> directory created"
74+
fi
75+
76+
if [ $1 = "postinst" ]; then
77+
chmod +x /opt/FileSyncApp/FileSyncApp
78+
systemctl daemon-reexec
79+
systemctl daemon-reload
80+
systemctl enable --now FileSyncApp.service
81+
fi
82+
83+
EOFUPDATE
84+
85+
# Copy the compiled binary to the package directory
86+
cp ${PUBLISH_DIR}/$APP_NAME ${OUTPUT_DIR}
87+
88+
# Create CPIO archive
89+
cd $OUTPUT_DIR
90+
cpio -H crc -o < <(printf '%s\n' sw-description; find . ! -name sw-description -type f | sort) > ../$APP_NAME-$APP_VERSION.swu
91+
cd ..
92+
umount ${OUTPUT_DIR}
93+
rm -r ${OUTPUT_DIR}
94+
95+
echo "SWUpdate package created: $APP_NAME-$APP_VERSION.swu"

FileSyncAppConfigEditor/FileSyncAppConfigEditor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net8.0-windows</TargetFramework>
5+
<TargetFramework>net9.0-windows</TargetFramework>
66
<Nullable>enable</Nullable>
77
<UseWindowsForms>true</UseWindowsForms>
88
<ImplicitUsings>enable</ImplicitUsings>

FileSyncAppWin/FileSyncAppWin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net8.0-windows</TargetFramework>
5+
<TargetFramework>net9.0-windows</TargetFramework>
66

77
<UseWindowsForms>true</UseWindowsForms>
88
<ImplicitUsings>enable</ImplicitUsings>

FileSyncLibNet/FileSyncLibNet.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.4" />
1616
<PackageReference Include="RoboSharp" Version="1.6.0" />
1717
<PackageReference Include="SMBLibrary" Version="1.5.4" />
18-
<PackageReference Include="SSH.NET" Version="2024.2.0" />
19-
<PackageReference Include="System.Text.Json" Version="9.0.1" />
18+
<PackageReference Include="SSH.NET" Version="2025.0.0" />
19+
<PackageReference Include="System.Text.Json" Version="9.0.4" />
2020
</ItemGroup>
2121
<ItemGroup>
2222
<Content Include="../README.md">

0 commit comments

Comments
 (0)