Skip to content

Commit

Permalink
Replaces Flatpak with normal binary (#1140)
Browse files Browse the repository at this point in the history
  • Loading branch information
ultimaweapon authored Nov 24, 2024
1 parent 3c916a6 commit 6fec26d
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 175 deletions.
64 changes: 17 additions & 47 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,69 +4,39 @@ on:
jobs:
build:
name: Linux
runs-on: ubuntu-22.04
runs-on: ubuntu-22.04 # Lowest version that support Vulkan 1.3.
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install System Packages
run: |
sudo apt-get update
sudo apt-get install -y flatpak flatpak-builder
sudo apt-get install -y libvulkan-dev
- name: Update Rust
run: rustup update stable
- name: Add additional Rust targets
run: rustup target add x86_64-unknown-none
- name: Lint Rust sources
run: cargo clippy --package obkrnl --target x86_64-unknown-none -- -D warnings
- name: Build
run: ./build.py -r
- name: Run tests
run: cargo test --workspace --exclude gui --exclude kernel
- name: Add Flathub
run: flatpak remote-add --user flathub https://flathub.org/repo/flathub.flatpakrepo
- name: Generate cache keys
- name: Generate launch script
run: |
echo "flatpak-runtime=${{ runner.os }}-flatpak-runtime-${{ hashFiles('flatpak.yml') }}" >> $GITHUB_OUTPUT
id: cache-keys
- name: Restore Flatpak runtimes
uses: actions/cache/restore@v4
with:
path: ~/.local/share/flatpak/runtime
key: ${{ steps.cache-keys.outputs.flatpak-runtime }}
id: flatpak-runtime
- name: Install Flatpak runtimes
run: |
flatpak install --noninteractive flathub \
org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08
if: ${{ steps.flatpak-runtime.outputs.cache-hit != 'true' }}
- name: Generate Flatpak branch
run: |
my $name;
#!/bin/sh -e
this=$(readlink -f "$0")
root=$(dirname "$this")
if ($ENV{GITHUB_REF} =~ /^refs\/pull\/(\d+)\//) {
$name = "pr-$1";
} else {
$name = 'dev';
}
open(my $fh, '>>', $ENV{GITHUB_OUTPUT}) || die "Cannot open $ENV{GITHUB_OUTPUT}: $!\n";
print $fh "flatpak-branch=$name\n";
shell: perl {0}
id: flatpak-branch
- name: Change KVM permission
run: sudo chmod o+rw /dev/kvm
- name: Build Flatpak
run: flatpak-builder --default-branch ${{ steps.flatpak-branch.outputs.flatpak-branch }} build flatpak.yml
- name: Export Flatpak
run: flatpak build-export flatpak build
- name: Bundle Flatpak
run: flatpak build-bundle flatpak obliteration.flatpak io.github.obhq.Obliteration --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
- name: Cache Flatpak runtimes
uses: actions/cache/save@v4
with:
path: ~/.local/share/flatpak/runtime
key: ${{ steps.cache-keys.outputs.flatpak-runtime }}-${{ github.run_id }}
if: startsWith(github.ref, 'refs/heads/')
- name: Upload Flatpak
exec "$root/bin/obliteration"
shell: cp {0} dist/obliteration.sh
- name: Create distribution tarball
run: |
mv dist obliteration
chmod +x obliteration/obliteration.sh
tar -cvf obliteration.tar obliteration
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: obliteration-linux-amd64
path: obliteration.flatpak
path: obliteration.tar
38 changes: 0 additions & 38 deletions flatpak.yml

This file was deleted.

5 changes: 0 additions & 5 deletions gui/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ void profile_set_display_resolution(struct Profile *p, enum DisplayResolution v)

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

struct RustError *update_firmware(const char *root,
const char *fw,
void *cx,
void (*status)(const char*, uint64_t, uint64_t, void*));

#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
19 changes: 0 additions & 19 deletions gui/initialize_wizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,25 +215,6 @@ class FirmwarePage : public QWizardPage {

setLayout(layout);
}

bool validatePage() override
{
// Check file path.
QFileInfo path(m_input->text());

if (!path.isFile()) {
QMessageBox::critical(this, "Error", "The specified file does not exist.");
return false;
}

// Get system path.
auto systemPath = wizard()->hasVisitedPage(PageSystem)
? field(FIELD_SYSTEM_LOCATION).toString()
: readSystemDirectorySetting();

// Install.
return initSystem(systemPath, path.canonicalFilePath(), this);
}
private:
QLayout *setupInputRow()
{
Expand Down
1 change: 0 additions & 1 deletion gui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ mod graphics;
mod hv;
mod profile;
mod string;
mod system;
mod vmm;

#[cfg(feature = "qt")]
Expand Down
1 change: 0 additions & 1 deletion gui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ mod profile;
mod rlim;
mod setup;
mod string;
mod system;
mod ui;
mod vmm;

Expand Down
18 changes: 0 additions & 18 deletions gui/src/system/ffi.rs

This file was deleted.

2 changes: 0 additions & 2 deletions gui/src/system/mod.rs

This file was deleted.

43 changes: 0 additions & 43 deletions gui/system.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "system.hpp"
#include "core.hpp"
#include "path.hpp"
#include "progress_dialog.hpp"
#include "settings.hpp"

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

return status.type() == std::filesystem::file_type::regular;
}

bool initSystem(const QString &path, const QString &firmware, QWidget *parent)
{
// Setup progress dialog.
ProgressDialog progress("Initializing system", QString("Opening %1").arg(firmware), parent);

// Update firmware.
auto root = path.toStdString();
auto fw = firmware.toStdString();
Rust<RustError> error;

error = update_firmware(
root.c_str(),
fw.c_str(),
&progress, [](const char *status, std::uint64_t total, std::uint64_t written, void *cx) {
auto progress = reinterpret_cast<ProgressDialog *>(cx);

if (progress->statusText() != status) {
progress->setStatusText(status);
progress->setValue(0);
progress->setMaximum(total);
} else {
progress->setValue(written);
}
});

progress.complete();

// Check result.
if (error) {
QMessageBox::critical(
parent,
"Error",
QString("Failed to install %1 to %2: %3").arg(firmware).arg(path).arg(error_message(error)));
return false;
}

QMessageBox::information(parent, "Success", "Firmware installed successfully.");

return true;
}
1 change: 0 additions & 1 deletion gui/system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ class QWidget;

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

0 comments on commit 6fec26d

Please sign in to comment.