Skip to content

Commit 6fec26d

Browse files
authored
Replaces Flatpak with normal binary (#1140)
1 parent 3c916a6 commit 6fec26d

File tree

10 files changed

+17
-175
lines changed

10 files changed

+17
-175
lines changed

.github/workflows/ci-linux.yml

+17-47
Original file line numberDiff line numberDiff line change
@@ -4,69 +4,39 @@ on:
44
jobs:
55
build:
66
name: Linux
7-
runs-on: ubuntu-22.04
7+
runs-on: ubuntu-22.04 # Lowest version that support Vulkan 1.3.
88
steps:
99
- name: Checkout repository
1010
uses: actions/checkout@v4
1111
- name: Install System Packages
1212
run: |
1313
sudo apt-get update
14-
sudo apt-get install -y flatpak flatpak-builder
14+
sudo apt-get install -y libvulkan-dev
1515
- name: Update Rust
1616
run: rustup update stable
1717
- name: Add additional Rust targets
1818
run: rustup target add x86_64-unknown-none
1919
- name: Lint Rust sources
2020
run: cargo clippy --package obkrnl --target x86_64-unknown-none -- -D warnings
21+
- name: Build
22+
run: ./build.py -r
2123
- name: Run tests
2224
run: cargo test --workspace --exclude gui --exclude kernel
23-
- name: Add Flathub
24-
run: flatpak remote-add --user flathub https://flathub.org/repo/flathub.flatpakrepo
25-
- name: Generate cache keys
25+
- name: Generate launch script
2626
run: |
27-
echo "flatpak-runtime=${{ runner.os }}-flatpak-runtime-${{ hashFiles('flatpak.yml') }}" >> $GITHUB_OUTPUT
28-
id: cache-keys
29-
- name: Restore Flatpak runtimes
30-
uses: actions/cache/restore@v4
31-
with:
32-
path: ~/.local/share/flatpak/runtime
33-
key: ${{ steps.cache-keys.outputs.flatpak-runtime }}
34-
id: flatpak-runtime
35-
- name: Install Flatpak runtimes
36-
run: |
37-
flatpak install --noninteractive flathub \
38-
org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08
39-
if: ${{ steps.flatpak-runtime.outputs.cache-hit != 'true' }}
40-
- name: Generate Flatpak branch
41-
run: |
42-
my $name;
27+
#!/bin/sh -e
28+
this=$(readlink -f "$0")
29+
root=$(dirname "$this")
4330
44-
if ($ENV{GITHUB_REF} =~ /^refs\/pull\/(\d+)\//) {
45-
$name = "pr-$1";
46-
} else {
47-
$name = 'dev';
48-
}
49-
50-
open(my $fh, '>>', $ENV{GITHUB_OUTPUT}) || die "Cannot open $ENV{GITHUB_OUTPUT}: $!\n";
51-
print $fh "flatpak-branch=$name\n";
52-
shell: perl {0}
53-
id: flatpak-branch
54-
- name: Change KVM permission
55-
run: sudo chmod o+rw /dev/kvm
56-
- name: Build Flatpak
57-
run: flatpak-builder --default-branch ${{ steps.flatpak-branch.outputs.flatpak-branch }} build flatpak.yml
58-
- name: Export Flatpak
59-
run: flatpak build-export flatpak build
60-
- name: Bundle Flatpak
61-
run: flatpak build-bundle flatpak obliteration.flatpak io.github.obhq.Obliteration --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
62-
- name: Cache Flatpak runtimes
63-
uses: actions/cache/save@v4
64-
with:
65-
path: ~/.local/share/flatpak/runtime
66-
key: ${{ steps.cache-keys.outputs.flatpak-runtime }}-${{ github.run_id }}
67-
if: startsWith(github.ref, 'refs/heads/')
68-
- name: Upload Flatpak
31+
exec "$root/bin/obliteration"
32+
shell: cp {0} dist/obliteration.sh
33+
- name: Create distribution tarball
34+
run: |
35+
mv dist obliteration
36+
chmod +x obliteration/obliteration.sh
37+
tar -cvf obliteration.tar obliteration
38+
- name: Upload artifacts
6939
uses: actions/upload-artifact@v4
7040
with:
7141
name: obliteration-linux-amd64
72-
path: obliteration.flatpak
42+
path: obliteration.tar

flatpak.yml

-38
This file was deleted.

gui/core.h

-5
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ void profile_set_display_resolution(struct Profile *p, enum DisplayResolution v)
6868

6969
struct RustError *profile_save(const struct Profile *p, const char *path);
7070

71-
struct RustError *update_firmware(const char *root,
72-
const char *fw,
73-
void *cx,
74-
void (*status)(const char*, uint64_t, uint64_t, void*));
75-
7671
#ifdef __cplusplus
7772
} // extern "C"
7873
#endif // __cplusplus

gui/initialize_wizard.cpp

-19
Original file line numberDiff line numberDiff line change
@@ -215,25 +215,6 @@ class FirmwarePage : public QWizardPage {
215215

216216
setLayout(layout);
217217
}
218-
219-
bool validatePage() override
220-
{
221-
// Check file path.
222-
QFileInfo path(m_input->text());
223-
224-
if (!path.isFile()) {
225-
QMessageBox::critical(this, "Error", "The specified file does not exist.");
226-
return false;
227-
}
228-
229-
// Get system path.
230-
auto systemPath = wizard()->hasVisitedPage(PageSystem)
231-
? field(FIELD_SYSTEM_LOCATION).toString()
232-
: readSystemDirectorySetting();
233-
234-
// Install.
235-
return initSystem(systemPath, path.canonicalFilePath(), this);
236-
}
237218
private:
238219
QLayout *setupInputRow()
239220
{

gui/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ mod graphics;
77
mod hv;
88
mod profile;
99
mod string;
10-
mod system;
1110
mod vmm;
1211

1312
#[cfg(feature = "qt")]

gui/src/main.rs

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ mod profile;
2525
mod rlim;
2626
mod setup;
2727
mod string;
28-
mod system;
2928
mod ui;
3029
mod vmm;
3130

gui/src/system/ffi.rs

-18
This file was deleted.

gui/src/system/mod.rs

-2
This file was deleted.

gui/system.cpp

-43
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "system.hpp"
2-
#include "core.hpp"
32
#include "path.hpp"
4-
#include "progress_dialog.hpp"
53
#include "settings.hpp"
64

75
#include <QMessageBox>
@@ -28,44 +26,3 @@ bool isSystemInitialized(const QString &path)
2826

2927
return status.type() == std::filesystem::file_type::regular;
3028
}
31-
32-
bool initSystem(const QString &path, const QString &firmware, QWidget *parent)
33-
{
34-
// Setup progress dialog.
35-
ProgressDialog progress("Initializing system", QString("Opening %1").arg(firmware), parent);
36-
37-
// Update firmware.
38-
auto root = path.toStdString();
39-
auto fw = firmware.toStdString();
40-
Rust<RustError> error;
41-
42-
error = update_firmware(
43-
root.c_str(),
44-
fw.c_str(),
45-
&progress, [](const char *status, std::uint64_t total, std::uint64_t written, void *cx) {
46-
auto progress = reinterpret_cast<ProgressDialog *>(cx);
47-
48-
if (progress->statusText() != status) {
49-
progress->setStatusText(status);
50-
progress->setValue(0);
51-
progress->setMaximum(total);
52-
} else {
53-
progress->setValue(written);
54-
}
55-
});
56-
57-
progress.complete();
58-
59-
// Check result.
60-
if (error) {
61-
QMessageBox::critical(
62-
parent,
63-
"Error",
64-
QString("Failed to install %1 to %2: %3").arg(firmware).arg(path).arg(error_message(error)));
65-
return false;
66-
}
67-
68-
QMessageBox::information(parent, "Success", "Firmware installed successfully.");
69-
70-
return true;
71-
}

gui/system.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ class QWidget;
66

77
bool isSystemInitialized();
88
bool isSystemInitialized(const QString &path);
9-
bool initSystem(const QString &path, const QString &firmware, QWidget *parent = nullptr);

0 commit comments

Comments
 (0)