arkenfox / user.js

Firefox privacy, security and anti-tracking: a comprehensive user.js template for configuration and hardening
MIT License
10.34k stars 519 forks source link

bash script #537

Closed bogachenko closed 6 years ago

bogachenko commented 6 years ago

Hi, I have a question about your script. https://github.com/ghacksuserjs/ghacks-user.js/blob/master/updater.sh

There are 2 mentions of two packages, wget and curl. These are packages that load something (in our case, user.js). In this script, they are selected to choose from, because there is an "if" condition. The first package is "curl", but if it is not available (not installed or broken?), Then "wget" comes into play. However, what if there are none. ALL. NOT What then? second "if" is not there? this is not about debian distributions (for which they are available by default), but about (say) archlinux. On it, as far as I remember, you need to manually install it (although I could be wrong, I did not use it for a long time).

and so it is possible to supplement the conditions on the verification (presence or absence) of these packages? Is there a guru js here?

I am not a guru in js, and maybe I’ll repeat myself I don’t understand. Explain to me?

I hope I wrote without errors :cry:

Atavic commented 6 years ago

wget is a common GNU package.

bogachenko commented 6 years ago

Are you sure?I'm not very

Atavic commented 6 years ago

Are you using Arch, right? It's in Extra Repo: https://www.archlinux.org/packages/?name=wget

bogachenko commented 6 years ago

now there is no (win10), But I used it. and I don’t remember that he installed these packages by default

upd look https://www.archlinux.org/groups/x86_64/base/ archlinux is installed using the main "base" package but wget or curl is not there

upd2 and even in base-devel there are none (these are just basic build tools (packages). they may not be needed) https://www.archlinux.org/groups/x86_64/base-devel/

earthlng commented 6 years ago

I agree there's room for improvement. Pull requests are welcome :)

overdodactyl commented 6 years ago

I was just messing with a variant that uses perl to download files instead of wget or curl.

It's using File::Fetch, which appears to be base perl. It's a little slower than wget and curl, but I think macOS and linux should all have perl pre-installed.

It could also just be added as a third-option I guess.

Anyone have any thoughts on that?

pinging @earthlng and @claustromaniac

claustromaniac commented 6 years ago

Sounds like a good idea to me.

It still might be a good plan to add a check for simply aborting when even perl is missing, though. There are a gazillion distros out there and more will spawn on time, we can't possibly know for sure whether they all have/will have one of those or not.

overdodactyl commented 6 years ago

Good point - do you think we should keep the wget and curl options, or just switch to perl entirely?

claustromaniac commented 6 years ago

At just 2-3 lines per additional check I'd just keep them all :) Then again, I'm not too finicky when it comes to etiquette and saving bytes and such... :sweat_smile:

Edit: readability is not my specialty either...

earthlng commented 6 years ago

just FYI: curl in ArchLinux is required by 241 packages, 1 being pacman ie the archlinux package manager so I'm pretty sure most if not all Archlinux' will have curl installed. But a check in the script is still a good idea.

do you think we should keep the wget and curl options

I would keep it and just add perl as a last resort because you said it's slower

overdodactyl commented 6 years ago

Sounds good! It looks like @claustromaniac already added a check in #540, so we're good there.

If curl is that widely used, the pearl option probably doesn't add a whole lot, but I can throw it in!

earthlng commented 6 years ago

Feel free to add a perl fallback but I think every system with Firefox installed will almost certainly also have curl or wget. At least so far nobody reported a problem and OP only guessed about Arch not having it.

bogachenko commented 6 years ago

@earthlng

and OP only guessed about Arch not having it

I am (practically) sure on 60 percent. in base and base-devel they are not. (I don’t know if you are using Linux, but) archlinux is installed along this guide https://wiki.archlinux.org/index.php/Installation_guide. and they are not in any group of packages. nobody pulls them

You can check for yourself

earthlng commented 6 years ago

@bogachenko pacman is a base package and curl is a dependency of pacman

bogachenko commented 6 years ago

@earthlng damn, you're right

earthlng commented 6 years ago

new version of the updater.sh is in the works so I'm closing this