Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flatpak support #372

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
674 changes: 674 additions & 0 deletions pkg/flatpak/LICENSE.txt

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions pkg/flatpak/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# What log level should onedriver use (debug, info, and "warn" are recommended).
# - trace - Log everything, including every syscall handled by the filesystem.
# - debug - Log all operations that modify a file or directory.
# - info - Log "big" operations like uploads and downloads.
# - warn - These are warnings. Usually not a problem.
# - error - Things that onedriver doesn't like, but can continue running
# (can possibly result in file corruption or inability to do something).
# - fatal - Only log errors that kill the program (this log level is not recommended).
log: error

# cacheDir specifies which directory onedriver should store its data in.
# This directory can get pretty large. "~" is a placeholder for your home directory.
cacheDir: ~/.cache/onedriver

# Don't uncomment or change this unless you are a super duper expert and have
# registered your own version of onedriver in Azure Active Directory. These are the
# default values.
#auth:
# clientID: "3470c3fa-bc10-45ab-a0a9-2d30836485d1"
# codeURL: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize"
# tokenURL: "https://login.microsoftonline.com/common/oauth2/v2.0/token"
# redirectURL: "https://login.live.com/oauth20_desktop.srf"
Binary file added pkg/flatpak/icons/io.jstaf.Onedriver-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkg/flatpak/icons/io.jstaf.Onedriver-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkg/flatpak/icons/io.jstaf.Onedriver-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkg/flatpak/icons/io.jstaf.Onedriver-256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkg/flatpak/icons/io.jstaf.Onedriver-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkg/flatpak/icons/io.jstaf.Onedriver-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pkg/flatpak/icons/io.jstaf.Onedriver-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions pkg/flatpak/io.jstaf.Onedriver.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=Onedriver
Comment=Mount a Microsoft OneDrive account as a Linux filesystem.
Type=Application
Exec=/app/bin/onedriver-launcher
Icon=io.github.Onedriver
Categories=Utility
105 changes: 105 additions & 0 deletions pkg/flatpak/io.jstaf.Onedriver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
app-id: io.jsaf.Onedriver
runtime: org.gnome.Platform
runtime-version: "45"
sdk: org.gnome.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.golang

finish-args:
- --talk-name=org.freedesktop.Notifications
- --filesystem=xdg-documents
- --filesystem=xdg-run/gvfsd
- --filesystem=~/.config/systemd/user/
- --share=network
- --socket=session-bus
- --socket=fallback-x11
- --filesystem=~/.config/systemd/user/

command: onedriver.sh
modules:
- name: onedriver-app
buildsystem: simple
build-options:
append-path: /usr/lib/sdk/golang/bin
env:
- GOBIN=/app/bin
- GOROOT=/usr/lib/sdk/golang
- GO111MODULE=on
- GOPATH=/run/build/onedriver/onedriver:/usr/lib/sdk/golang
build-args:
- --share=network
- --filesystem=~/.config/systemd/user/
build-commands:
- mkdir -p ~/.config/systemd/user/
- install -Dm755 -t ~/.config/systemd/user/ [email protected]
- make onedriver -j8
- install -Dm755 -t /app/bin/ onedriver
sources:
- type: git
url: https://github.com/jstaf/onedriver.git
tag: v0.14.1
- type: file
path: service/[email protected]
- type: patch
path: patch/0001-add-individual-builds.patch

- name: onedriver-launcher
config-opts:
- --with-systemdsystemunitdir=/app/lib/systemd/system
buildsystem: simple
build-options:
append-path: /usr/lib/sdk/golang/bin
env:
- GOBIN=/app/bin
- GOROOT=/usr/lib/sdk/golang
- GO111MODULE=on
- GOPATH=/run/build/onedriver/onedriver:/usr/lib/sdk/golang
build-args:
- --share=network
sources:
- type: git
url: https://github.com/jstaf/onedriver.git
tag: v0.14.1
- type: file
path: icons/io.jsaf.Onedriver-16.png
- type: file
path: icons/io.jsaf.Onedriver-24.png
- type: file
path: icons/io.jsaf.Onedriver-32.png
- type: file
path: icons/io.jsaf.Onedriver-48.png
- type: file
path: icons/io.jsaf.Onedriver-64.png
- type: file
path: icons/io.jsaf.Onedriver-128.png
- type: file
path: icons/io.jsaf.Onedriver-256.png
- type: file
path: io.jsaf.Onedriver.desktop
- type: file
path: onedriver.sh
- type: file
path: service/[email protected]
- type: patch
path: patch/0001-add-individual-builds.patch

build-commands:
- go get -u os/user
- go get -u github.com/gotk3/gotk3/gtk
- go get -u github.com/godbus/dbus/v5
- go get -u github.com/jstaf/onedriver/ui
- go get -u github.com/jstaf/onedriver/cmd/common
- go get -u github.com/jstaf/onedriver/cmd/onedriver
- go get -u github.com/jstaf/onedriver/cmd/onedriver-launcher
- make -j8
- ls -l
- mkdir -p /app/bin
- mkdir -p /app/share/icons/hicolor/
- mkdir -p /app/share/icons/hicolor/128x128/apps/
- install -Dm755 -t /app/bin/ ./onedriver-launcher
- install -Dm755 -t /app/bin/ onedriver.sh
- install -Dm 644 -t /app/share/applications io.jsaf.Onedriver.desktop
- |
for icon in 16 24 32 48 64 128 256; do
install -Dm 644 io.jsaf.Onedriver-$icon.png /app/share/icons/hicolor/${icon}x${icon}/apps/io.jsaf.Onedriver.png
done
1 change: 1 addition & 0 deletions pkg/flatpak/onedriver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/app/bin/onedriver-launcher
22 changes: 22 additions & 0 deletions pkg/flatpak/patch/0001-add-individual-builds.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
From 54dcf1725e4712182b7275e150c9e1830426bc80 Mon Sep 17 00:00:00 2001
From: "Charles K. Neimog" <[email protected]>
Date: Tue, 28 Nov 2023 19:27:46 -0300
Subject: [PATCH] add individual builds

---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 95179de..dcd02f6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: all, test, test-init, srpm, rpm, dsc, changes, deb, clean, install, uninstall
+.PHONY: all, onedriver, onedriver-launcher, onedriver-headless, test, test-init, srpm, rpm, dsc, changes, deb, clean, install, uninstall

# autocalculate software/package versions
VERSION := $(shell grep Version onedriver.spec | sed 's/Version: *//g')
--
2.43.0

12 changes: 12 additions & 0 deletions pkg/flatpak/service/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=onedriver

[Service]
ExecStart=~/.local/share/flatpak/app/io.github.Onedriver/x86_64/master/active/files/bin/onedriver %f
ExecStopPost=/usr/bin/fusermount -uz /%I
Restart=on-abnormal
RestartSec=3
RestartForceExitStatus=2

[Install]
WantedBy=default.target