openfortivpn-webview icon indicating copy to clipboard operation
openfortivpn-webview copied to clipboard

alpine linux package ?

Open caywin25 opened this issue 1 year ago • 11 comments

Hello Is it possible to release a package for alpine linux please? Indeed the package is not present in basic Alpine Linux. Thanks

caywin25 avatar Feb 01 '24 13:02 caywin25

Hi, there are no distro specific packages and I'd rather not start making them.

The AppImage and the tar.xz should work on pretty much every distro, they are both statically linked and if there is any external dependency, it is probably something that is everywhere.

So please try them, or else I'm afraid you have to build the application yourself following the instructions.

gm-vm avatar Feb 01 '24 15:02 gm-vm

I want to also add that I'm releasing binaries only for the electron app because the main advantage of the Qt app is that you can get a tiny executable by not statically linking the Qt framework.

The Qt app with statically linked libraries is probably as big as the electron app, so there is no point in it. It is also more complex to make, everything is setup to link the framework dynamically. I definitely don't want to release binaries with dynamically linked Qt libraries, I'd have to release one package per distro and keep up with system updates.

I could use Flatpak or Snap, but it's not something I want to do right now. The binaries that you can grab here should be enough if you don't want to build the application.

gm-vm avatar Feb 01 '24 16:02 gm-vm

I noticed that Alpine Linux uses musl, so I'm not sure the binaries will work there, I haven't tried.

I'll keep this open in case someone wants to do the needful.

gm-vm avatar Feb 01 '24 20:02 gm-vm

Hello,

I noticed that Alpine Linux uses musl, so I'm not sure the binaries will work there, I haven't tried.

Tried and didn't work. Tried to build it from code. npm install worked well, though needed to run npm audit fix after that. But npm start resulted in this:

> [email protected] start
> electron index.js

node:events:497
      throw er; // Unhandled 'error' event
      ^

Error: spawn /path/to/openfortivpn-webview-1.2.0-electron/openfortivpn-webview-electron/node_modules/electron/dist/electron ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:292:12)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /path/to/openfortivpn-webview-1.2.0-electron/openfortivpn-webview-electron/node_modules/electron/dist/electron',
  path: '/path/to/openfortivpn-webview-1.2.0-electron/openfortivpn-webview-electron/node_modules/electron/dist/electron',
  spawnargs: [ 'index.js' ]
}

Node.js v21.4.0

fluxion-t avatar Apr 01 '24 19:04 fluxion-t

It seems that npm is trying to start electron, but it is failing. I don't know why.

What happens if you do things manually? Go to the directory with index.js and run:

/path/to/openfortivpn-webview-1.2.0-electron/openfortivpn-webview-electron/node_modules/electron/dist/electron index.js

gm-vm avatar Apr 01 '24 19:04 gm-vm

$ /path/to/openfortivpn-webview-1.2.0-electron/openfortivpn-webview-electron/node_modules/electron/dist/electron index.js

bash: node_modules/electron/dist/electron: cannot execute: required file not found

There is package called electron, and if executed as $ electron, it says To run a local app, execute the following on the command line: $ /usr/lib/electron/electron path-to-app. Then, I do

/usr/lib/electron/electron /path/to/openfortivpn-webview-1.2.0-electron/openfortivpn-webview-electron/index.js

but it says I need to specify [host:port], so I run (choosing a random port)

/usr/lib/electron/electron /path/to/openfortivpn-webview-1.2.0-electron/openfortivpn-webview-electron/index.js localhost:2020

Then I get a blank electron window open, but also this error:

https://localhost:2020/remote/saml/start
(node:6264) electron: Failed to load URL: https://localhost:2020/remote/saml/start with error: ERR_CONNECTION_REFUSED
(Use electron --trace-warnings ... to show where the warning was created)

fluxion-t avatar Apr 01 '24 20:04 fluxion-t

It looks like it's working then. [host:port] is a mandatory argument and the program errors out if you don't pass it. You should see all the options in the output, as if you passed --help.

You see a blank screen because you don't have a webserver (or one that can handle remote/saml/start) running on port 2020. If you want to quickly check that the browser works, provide a complete and valid URL using the --url option:

/usr/lib/electron/electron /path/to/openfortivpn-webview-1.2.0-electron/openfortivpn-webview-electron/index.js --url https://example.com/

gm-vm avatar Apr 01 '24 20:04 gm-vm

/usr/lib/electron/electron /path/to/openfortivpn-webview-1.2.0-electron/openfortivpn-webview-electron/index.js --url https://example.com/

This worked!

Under Debian, just specifying the root URL (and without https://) automatically redirected to https://root-url/saml/start. However, here I had to write everything explicitly.

Many, many thanks.

fluxion-t avatar Apr 01 '24 20:04 fluxion-t

For completeness (though this is related to openfortivpn and not with its webview), in Alpine you need to start the ppp daemon (and add it to boot):

rc-service pppd start
rc-update add pppd

Only then you can call openfortivpn and use the cookie generated by the webview.

fluxion-t avatar Apr 01 '24 21:04 fluxion-t

Under Debian, just specifying the root URL (and without https://) automatically redirected to https://root-url/saml/start. However, here I had to write everything explicitly.

It should be the same here. If you execute electron index.js root-url, the application builds the URL for you as https://root-url/remote/saml/start.

gm-vm avatar Apr 02 '24 07:04 gm-vm

Sorry for the delay. In my case, using only the root-urldidn't work, but I think this is because the institution I needed to access has set up a different login page than in root-url/saml/start.

Many thanks for your feedback.

fluxion-t avatar Apr 08 '24 08:04 fluxion-t

I quickly looked at this and I don't think electron-builder, which is what I'm using to package the electron-based app, really supports Alpine. Not to mention the fact that even the electron executable downloaded by npm does not work, as shown here above.

For what is worth, building the Qt variant for alpine is way simpler, given that qt is supported officialy:

apk add qt6-qtwebengine-dev g++ make git
git clone https://github.com/gm-vm/openfortivpn-webview
cd openfortivpn-webview/openfortivpn-webview-qt
qmake6 .
make
# There is now an executable named openfortivpn-webview

gm-vm avatar Oct 09 '24 20:10 gm-vm

As I mentioned, I doubt electron-builder supports Alpine, so either you do what fluxion-t did here above, or you build the Qt application as per the instructions in my previous message.

gm-vm avatar Dec 23 '24 12:12 gm-vm