mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Windows: Creating an installer with a custom data directory path
This commit is contained in:
parent
f661457617
commit
daedd60f3d
2
.github/workflows/analysis.yml
vendored
2
.github/workflows/analysis.yml
vendored
@ -1,5 +1,5 @@
|
||||
name: Analysis
|
||||
on: [push, pull_request]
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
analysis:
|
||||
|
29
.github/workflows/build.yml
vendored
29
.github/workflows/build.yml
vendored
@ -1,5 +1,5 @@
|
||||
name: Build
|
||||
on: [push, pull_request]
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -43,13 +43,16 @@ jobs:
|
||||
if: matrix.artifact == 'windows'
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: Build the app
|
||||
shell: bash
|
||||
env:
|
||||
INCLUDE: ${{env.INCLUDE}};C:\Program Files\FFmpeg\include
|
||||
LIB: ${{env.LIB}};C:\Program Files\FFmpeg\lib
|
||||
LIBPATH: ${{env.LIBPATH}};C:\Program Files\FFmpeg\lib
|
||||
CFLAGS: -I/usr/local/include
|
||||
LDFLAGS: -L/usr/local/lib
|
||||
run: dotnet publish -r ${{matrix.runtime}} -c Release -o dist Kyoo
|
||||
run: |
|
||||
project=$([ "${{runner.os}}" == "Windows" ] && echo Kyoo.WindowsHost || echo Kyoo)
|
||||
dotnet publish -r ${{matrix.runtime}} -c Release -o dist $project
|
||||
- name: Compression output
|
||||
shell: bash
|
||||
run: |
|
||||
@ -71,7 +74,7 @@ jobs:
|
||||
*.tar.gz
|
||||
|
||||
release:
|
||||
name: Create debian, rpm & arch releases
|
||||
name: Create windows, debian, rpm & arch releases
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.ref == 'refs/heads/master'
|
||||
@ -80,12 +83,26 @@ jobs:
|
||||
version: v0.0.1 #${{ github.ref }}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/download-artifact@v2
|
||||
- name: Download linux build
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: kyoo_linux
|
||||
path: artifact
|
||||
- name: Unzip the published files.
|
||||
run: mkdir dist && tar -C dist -xzf artifact/kyoo_linux.tar.gz
|
||||
- name: Download windows build
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: kyoo_windows
|
||||
path: artifact
|
||||
- name: Unzip windows files
|
||||
run: mkdir dist_win && 7z e artifact/kyoo_windows.zip -o dist_win
|
||||
- name: Install Inno Setup
|
||||
run: |
|
||||
curl -L https://jrsoftware.org/download.php/is.exe > innosetup.exe
|
||||
./innosetup.exe /VERYSILENT /SUPPRESSMSGBOXES /Log=log.txt || (cat log.txt && exit 1)
|
||||
- name: Create windows installer
|
||||
run: iscc -Dkyoo=$(realpath dist_win) -O./ -Fkyoo-windows deployment/kyoo-windows.iss
|
||||
- name: Create the package structure
|
||||
run: |
|
||||
sudo mkdir -p pkg/usr/lib/
|
||||
@ -119,6 +136,10 @@ jobs:
|
||||
with:
|
||||
pkgdir: deployment
|
||||
namcapDisable: true
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: kyoo_windows
|
||||
path: ./*.exe
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: kyoo_rpm
|
||||
|
3
.github/workflows/docker.yml
vendored
3
.github/workflows/docker.yml
vendored
@ -1,6 +1,5 @@
|
||||
name: Docker
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -3,7 +3,6 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<RootNamespace>Kyoo.Host.Windows</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Autofac;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Kyoo.Host.Windows
|
||||
{
|
||||
@ -13,6 +15,10 @@ namespace Kyoo.Host.Windows
|
||||
/// </summary>
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
object dataDir = Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\SDG\Kyoo\Settings", "DataDir", null)
|
||||
?? Registry.GetValue(@"HKEY_CURRENT_USER\Software\SDG\Kyoo\Settings", "DataDir", null);
|
||||
if (dataDir is string data)
|
||||
Environment.SetEnvironmentVariable("KYOO_DATA_DIR", data);
|
||||
Kyoo.Program.SetupDataDir(args);
|
||||
|
||||
IHost host = Kyoo.Program.CreateWebHostBuilder(args)
|
||||
|
@ -23,7 +23,7 @@ namespace Kyoo.Host.Windows
|
||||
/// <summary>
|
||||
/// The thread where the trait is running.
|
||||
/// </summary>
|
||||
private Thread? _thread;
|
||||
private Thread _thread;
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
@ -59,4 +59,8 @@
|
||||
<Visible>false</Visible>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="../LICENSE" CopyToOutputDirectory="Always" Visible="false" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -65,13 +65,13 @@ namespace Kyoo
|
||||
{
|
||||
try
|
||||
{
|
||||
host.Services.GetRequiredService<ILogger<Application>>()
|
||||
.LogInformation("Running as {Name}", System.Environment.UserName);
|
||||
Log.Information("Running as {Name}", System.Environment.UserName);
|
||||
Log.Information("Data directory: {DataDirectory}", System.Environment.CurrentDirectory);
|
||||
await host.RunAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
host.Services.GetRequiredService<ILogger<Application>>().LogCritical(ex, "Unhandled exception");
|
||||
Log.Fatal(ex, "Unhandled exception");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,12 @@ AppUpdatesURL=https://github.com/AnonymusRaccoon/Kyoo
|
||||
DefaultDirName={commonpf}\Kyoo
|
||||
DisableProgramGroupPage=yes
|
||||
LicenseFile={#kyoo}\LICENSE
|
||||
OutputBaseFilename=kyoo-windows
|
||||
SetupIconFile={#kyoo}\wwwroot\favicon.ico
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
AppCopyright=GPL-3.0
|
||||
ArchitecturesInstallIn64BitMode=x64 arm64 ia64
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
@ -26,14 +26,41 @@ Name: "none"; Description: "Do not start automatically"; GroupDescription: "Star
|
||||
|
||||
[Files]
|
||||
Source: "{#kyoo}\Kyoo.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "{#kyoo}\Kyoo.WindowsHost.exe"; DestDir: "{app}"; Flags: ignoreversion
|
||||
Source: "{#kyoo}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
|
||||
[Registry]
|
||||
Root: HKA; Subkey: "Software\SDG"; Flags: uninsdeletekeyifempty
|
||||
Root: HKA; Subkey: "Software\SDG\Kyoo"; Flags: uninsdeletekey
|
||||
Root: HKA; Subkey: "Software\SDG\Kyoo\Settings"; ValueType: string; ValueName: "DataDir"; ValueData: "{code:GetDataDir}"
|
||||
|
||||
[UninstallDelete]
|
||||
Type: filesandordirs; Name: "{commonappdata}\Kyoo"
|
||||
Type: filesandordirs; Name: "{code:GetDataDir}"
|
||||
|
||||
[Icons]
|
||||
Name: "{autoprograms}\Kyoo"; Filename: "{app}\Kyoo.exe"
|
||||
Name: "{autodesktop}\Kyoo"; Filename: "{app}\Kyoo.exe"; Tasks: desktopicon
|
||||
Name: "{autoprograms}\Kyoo"; Filename: "{app}\Kyoo.WindowsHost.exe"
|
||||
Name: "{autoprograms}\Kyoo (Console)"; Filename: "{app}\Kyoo.exe"
|
||||
Name: "{autodesktop}\Kyoo"; Filename: "{app}\Kyoo.WindowsHost.exe"; Tasks: desktopicon
|
||||
|
||||
[Run]
|
||||
Filename: "{app}\Kyoo.exe"; Description: "{cm:LaunchProgram,Kyoo}"; Flags: nowait postinstall skipifsilent
|
||||
Filename: "{app}\Kyoo.WindowsHost.exe"; Description: "{cm:LaunchProgram,Kyoo}"; Flags: nowait postinstall skipifsilent
|
||||
|
||||
[Code]
|
||||
var
|
||||
DataDirPage: TInputDirWizardPage;
|
||||
|
||||
procedure InitializeWizard;
|
||||
begin
|
||||
DataDirPage := CreateInputDirPage(wpSelectDir,
|
||||
'Choose Data Location', 'Choose the folder in which to install the Kyoo data',
|
||||
'The installer will set the following folder for Kyoo. To install in a different folder, click Browse and select another folder.' +
|
||||
'Please make sure the folder exists and is accessible. Do not choose the server install folder. Click Next to continue.',
|
||||
False, '');
|
||||
DataDirPage.Add('');
|
||||
DataDirPage.Values[0] := GetPreviousData('DataDir', 'C:\ProgramData\Kyoo');
|
||||
end;
|
||||
|
||||
function GetDataDir(Param: String): String;
|
||||
begin
|
||||
Result := DataDirPage.Values[0];
|
||||
end;
|
@ -5,7 +5,7 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
User=kyoo
|
||||
WorkingDirectory=/var/lib/kyoo
|
||||
Environment=KYOO_DATA_DIR=/var/lib/kyoo
|
||||
ExecStart=/usr/lib/kyoo/Kyoo
|
||||
Restart=on-abort
|
||||
TimeoutSec=20
|
||||
|
Loading…
x
Reference in New Issue
Block a user