mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 12:42:34 +00:00
feat(linux): include MD5 sums in Debian distributions
This commit is contained in:
2
.github/workflows/notify.yml
vendored
2
.github/workflows/notify.yml
vendored
@@ -58,7 +58,7 @@ jobs:
|
||||
BUILD_TITLE: ${{ inputs.build-title }}
|
||||
with:
|
||||
result-encoding: string
|
||||
script: return require('.github/scripts/notify-embed.js')();
|
||||
script: return require('.github/scripts/notify_discord_embed.js')();
|
||||
|
||||
- name: Send Discord Message
|
||||
uses: Ilshidur/action-discord@0.3.2
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -78,10 +78,13 @@ jspm_packages/
|
||||
|
||||
# Artifacts
|
||||
output/
|
||||
debian/
|
||||
*.apk
|
||||
*.aab
|
||||
*.ipa
|
||||
*.dmg
|
||||
*.pkg
|
||||
|
||||
# Linux Artifacts
|
||||
debian/DEBIAN/md5sums
|
||||
debian/usr/local/lib/LunaSea
|
||||
*.snap
|
||||
|
||||
6
debian/DEBIAN/control
vendored
Normal file
6
debian/DEBIAN/control
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
Package:LunaSea
|
||||
Architecture:amd64
|
||||
Essential:no
|
||||
Priority:optional
|
||||
Maintainer:LunaSea Support <hello@lunasea.app>
|
||||
Description:Self-hosted software controller built using Flutter
|
||||
3
debian/DEBIAN/postinst
vendored
Executable file
3
debian/DEBIAN/postinst
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
ln -sf '/usr/local/lib/LunaSea/lunasea' '/usr/local/bin/lunasea'
|
||||
3
debian/DEBIAN/postrm
vendored
Executable file
3
debian/DEBIAN/postrm
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
rm -f '/usr/local/bin/lunasea'
|
||||
9
debian/usr/share/applications/lunasea.desktop
vendored
Normal file
9
debian/usr/share/applications/lunasea.desktop
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Name=LunaSea
|
||||
Comment=Self-hosted software controller built using Flutter
|
||||
Icon=/usr/share/icons/lunasea.png
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Utilities;Entertainment;
|
||||
Exec=/usr/local/bin/lunasea
|
||||
TryExec=/usr/local/bin/lunasea
|
||||
BIN
debian/usr/share/icons/lunasea.png
vendored
Normal file
BIN
debian/usr/share/icons/lunasea.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
@@ -1,73 +1,55 @@
|
||||
import 'dart:io';
|
||||
|
||||
void main(List<String> args) {
|
||||
_createSkeleton();
|
||||
|
||||
_generateControl(args[0]);
|
||||
_generateDesktopEntry();
|
||||
_copyIcon();
|
||||
_setVersion(args[0]);
|
||||
_copyBuild();
|
||||
|
||||
_determineMD5Sums();
|
||||
_buildDebian();
|
||||
}
|
||||
|
||||
Future<void> _createSkeleton() async {
|
||||
if (Directory('debian').existsSync()) {
|
||||
Directory('debian').deleteSync(recursive: true);
|
||||
}
|
||||
|
||||
Directory('debian/DEBIAN').createSync(recursive: true);
|
||||
Directory('debian/usr/local/lib').createSync(recursive: true);
|
||||
Directory('debian/usr/share/applications').createSync(recursive: true);
|
||||
Directory('debian/usr/share/icons').createSync(recursive: true);
|
||||
}
|
||||
|
||||
void _generateControl(String version) {
|
||||
void _setVersion(String version) {
|
||||
final control = File('debian/DEBIAN/control');
|
||||
|
||||
String data = '';
|
||||
data += 'Version:$version\n';
|
||||
data += 'Architecture:amd64\n';
|
||||
data += 'Package:LunaSea\n';
|
||||
data += 'Essential:no\n';
|
||||
data += 'Priority:optional\n';
|
||||
data += 'Maintainer:LunaSea Support <hello@lunasea.app>\n';
|
||||
data += 'Description:Self-hosted software controller built using Flutter\n';
|
||||
|
||||
control.writeAsStringSync(data);
|
||||
}
|
||||
|
||||
void _generateDesktopEntry() {
|
||||
final entry = File('debian/usr/share/applications/lunasea.desktop');
|
||||
|
||||
String data = '';
|
||||
data += '[Desktop Entry]\n';
|
||||
data += 'Name=LunaSea\n';
|
||||
data += 'Comment=Self-hosted software controller built using Flutter\n';
|
||||
data += 'Icon=/usr/share/icons/lunasea.png\n';
|
||||
data += 'Terminal=false\n';
|
||||
data += 'Type=Application\n';
|
||||
data += 'Categories=Utilities;Entertainment;\n';
|
||||
data += 'Exec=/usr/local/lib/LunaSea/lunasea\n';
|
||||
data += 'TryExec=/usr/local/lib/LunaSea/lunasea\n';
|
||||
|
||||
entry.writeAsStringSync(data);
|
||||
}
|
||||
|
||||
void _copyIcon() {
|
||||
final icon = File('assets/icon/icon_linux.png');
|
||||
icon.copySync('debian/usr/share/icons/lunasea.png');
|
||||
control.writeAsStringSync('Version:$version\n', mode: FileMode.append);
|
||||
}
|
||||
|
||||
void _copyBuild() {
|
||||
Process.runSync(
|
||||
'cp',
|
||||
['-r', 'build/linux/x64/release/bundle', 'debian/usr/local/lib'],
|
||||
);
|
||||
Process.runSync(
|
||||
'mv',
|
||||
['debian/usr/local/lib/bundle', 'debian/usr/local/lib/LunaSea'],
|
||||
);
|
||||
const path = 'debian/usr/local/lib';
|
||||
|
||||
final directory = Directory(path);
|
||||
if (directory.existsSync()) directory.deleteSync(recursive: true);
|
||||
directory.createSync(recursive: true);
|
||||
|
||||
Process.runSync('cp', [
|
||||
'-r',
|
||||
'build/linux/x64/release/bundle',
|
||||
path,
|
||||
]);
|
||||
Process.runSync('mv', [
|
||||
'$path/bundle',
|
||||
'$path/LunaSea',
|
||||
]);
|
||||
}
|
||||
|
||||
void _determineMD5Sums() {
|
||||
final find = Process.runSync(
|
||||
'find',
|
||||
[".", "-type", "f", "-not", "-path", "'./DEBIAN/*'"],
|
||||
workingDirectory: 'debian',
|
||||
).stdout as String;
|
||||
|
||||
final files = find
|
||||
.split('\n')
|
||||
.where((file) => !file.startsWith('./DEBIAN'))
|
||||
.map((file) => file.replaceAll('./', ''))
|
||||
.toList();
|
||||
|
||||
final md5 = Process.runSync(
|
||||
'md5sum',
|
||||
files,
|
||||
workingDirectory: 'debian',
|
||||
).stdout as String;
|
||||
|
||||
File('debian/DEBIAN/md5sums').writeAsStringSync(md5);
|
||||
}
|
||||
|
||||
void _buildDebian() {
|
||||
@@ -75,10 +57,10 @@ void _buildDebian() {
|
||||
Directory('output').createSync(recursive: true);
|
||||
}
|
||||
|
||||
Process.runSync(
|
||||
'dpkg-deb',
|
||||
['--build', 'debian'],
|
||||
);
|
||||
Process.runSync('dpkg-deb', [
|
||||
'--build',
|
||||
'debian',
|
||||
]);
|
||||
Process.runSync('mv', [
|
||||
'debian.deb',
|
||||
'output/lunasea-linux-amd64.deb',
|
||||
|
||||
Reference in New Issue
Block a user