jstaf / onedriver

A native Linux filesystem for Microsoft OneDrive
GNU General Public License v3.0
1.99k stars 96 forks source link

OpenRc support #229

Open DaereanLegrand opened 2 years ago

DaereanLegrand commented 2 years ago

Hi, I was running Arch with systemd and onedriver worked perfectly, but now i'm using artix with openrc so i was wondering if there is any way of making onedriver work in Artix wirth openrc.

jstaf commented 2 years ago

The filesystem itself should work with no problems (onedriver /path/to/mountpoint), but the GUI and "mount-on-login" functionality currently use systemd as a job launcher. I am open to adding OpenRC compatibility, but not sure how it would work. OpenRC would need a way of starting daemons as the user (equivalent to systemd's systemctl --user), with some form of instancing or other way of passing in info to the daemons launched (currently the name of the user systemd service tells it where to mount things at).

Also, does Artix have dbus? That's the other big requirement for the GUI right now.

DaereanLegrand commented 2 years ago

Well afaik Artix with OpenRc has dbus. The hard part would be starting daemons as the user, wouldn't there be another alternative to do so?

abraunegg commented 2 years ago

@DaereanLegrand , @jstaf

The hard part would be starting daemons as the user, wouldn't there be another alternative to do so?

Is the following helpful? This is how users of 'onedrive' run the client as a user based service:

https://github.com/abraunegg/onedrive/blob/master/docs/USAGE.md#onedrive-service-running-as-a-non-root-user-via-runit-antix-devuan-artix-void

The instructions would have to be massaged to work for 'onedriver' - but I am sure there are enough details to get it working then correctly documented.

DaereanLegrand commented 2 years ago

Yeah that would be helpful if using artix with runit, it would kinda be the same. But with OpenRc there's no such a thing like "systemctl --user start $SERVICE" or its equivalent in runit.

jstaf commented 2 years ago

I did some extra thinking on this and I think there's two takeaways:

  1. As an interim solution, I think we can just get away with pointing users at https://docs.voidlinux.org/config/services/user-services.html plus an example of a working unit. The GUI still won't work for these users, but I think if you're using OpenRC you probably already know what you're doing. (Once we have this sorted out, we can explore adding GUI support for OpenRC folks.)

  2. It would be worthwhile to explore other task manager/daemon launcher tools out there. There's nothing that really "requires" systemd, it was just an easy solution at the time. In particular, anything would work as long as it can launch daemons for a user on login, handle logs somehow, and have a way to stop/start stuff without sudo. systemd has been great so far, but having something a little more "self contained" (ie. not requiring dbus/systemd to be on the host) would make things even more portable than they are already and let us target stuff like a Mac/BSD client (the onedriver filesystem works on Macs/BSD right now, even if the GUI does not).

mcsk8r commented 1 year ago

I managed to get onedriver working on VOID and Alpine Linux using the same method below.

  1. git clone https://github.com/jstaf/onedriver.git

  2. cd onedriver

  3. Modify 'Makefile' replace 'install:' section with below (replace 'username' with your username):

install: onedriver onedriver-launcher
    cp onedriver /usr/bin/
    cp onedriver-launcher /usr/bin/
    mkdir -p /home/username/.icons
    mkdir -p /home/username/.icons/onedriver
    cp resources/onedriver.svg /home/username/.icons/onedriver
    cp resources/onedriver.png /home/username/.icons/onedriver
    cp resources/onedriver-128.png /home/username/.icons/onedriver
    cp resources/onedriver.desktop /home/username/.local/share/applications
    #cp resources/onedriver@.service /etc/systemd/user/
    #gzip -c resources/onedriver.1 > "$out/usr/share/man/man1/onedriver.1.gz"
    #mandb
  1. Modify the resources/onedriver.desktop file replacing the entire content with below (replace 'username' with your username & OneDriveMountLocation with the location you wish to mount OneDrive, folder must exist):
[Desktop Entry]
Name=Onedriver
Comment=Mount a Microsoft OneDrive account as a Linux filesystem.
Type=Application
Exec=sh -c "/usr/bin/onedriver /OneDriveMountLocation"
Icon=/home/username/.icons/onedriver/onedriver.svg
Categories=Utility
  1. Ensure required dependencies are installed to build (make go gcc pkgconfig webkit2gtk-dev json-glib-dev)

  2. Run the following

    make
    sudo make install
  3. Use GNOME Tweaks to add 'OneDriver' to Startup Applications image

  4. Run once "onedriver /OneDriveMountLocation" & login to OneDrive. When you reboot the .desktop file that was created will re-mount your OneDrive.

I've been using this method for months without any issues.