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

Use wget if curl is not available #451

Merged
merged 2 commits into from Jul 6, 2018
Merged

Use wget if curl is not available #451

merged 2 commits into from Jul 6, 2018

Conversation

ema-pe
Copy link
Contributor

@ema-pe ema-pe commented Jun 25, 2018

After the discussion on #447 I decided to send single pull requests improving the existent script instead of writing a new one.

This pull request add wget as fallback if curl is not installed. Why? Because wget is often preinstalled on most GNU/Linux distributions, and the end user doesn't need to install a new software for keeping updated the user.js.

If you use wget or curl the behaviour is the same, only the output can change a bit. For example with curl:


This script should be run from your Firefox profile directory.

Updating the user.js for Firefox profile:
/home/emanuele/Projects/ghacks-user.js

Your current user.js file for this profile will be backed up and the latest ghacks version from github will take its place.

If currently using the ghacks user.js, please compare versions:
  Available online: * version 61-alpha: You Can't Hurry Pants
  Currently using:  * version 61-alpha: You Can't Hurry Pants

If a user-overrides.js file exists in this profile, it will be appended to the user.js.

Continue Y/N? y


Your previous user.js file was backed up: userjs_backups/user.js.backup.2018-06-25_1749
downloading latest ghacks user.js file
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  130k  100  130k    0     0   177k      0 --:--:-- --:--:-- --:--:--  177k
ghacks user.js has been downloaded

And with wget:


This script should be run from your Firefox profile directory.

Updating the user.js for Firefox profile:
/home/emanuele/Projects/ghacks-user.js

Your current user.js file for this profile will be backed up and the latest ghacks version from github will take its place.

If currently using the ghacks user.js, please compare versions:
  Available online: * version 61-alpha: You Can't Hurry Pants
  Currently using:  * version 61-alpha: You Can't Hurry Pants

If a user-overrides.js file exists in this profile, it will be appended to the user.js.

Continue Y/N? y


Your previous user.js file was backed up: userjs_backups/user.js.backup.2018-06-25_1749
downloading latest ghacks user.js file
--2018-06-25 17:49:28--  https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/user.js
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.112.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.112.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 133308 (130K) [text/plain]
Saving to: ‘user.js’

user.js                 100%[==============================>] 130.18K   528KB/s    in 0.2s    

2018-06-25 17:49:29 (528 KB/s) - ‘user.js’ saved [133308/133308]

ghacks user.js has been downloaded

Emanuele Petriglia added 2 commits June 25, 2018 17:39
On most GNU/Linux distributions wget is often preinstalled, while curl
is not.
@KOLANICH
Copy link

KOLANICH commented Jun 25, 2018

You may also want to use aria2c (a multistream downloader, which speeds up large downloads a lot) if it is available ;) IMHO using multiple of very widespread downloaders is a bit overkill, the most advanced one should be used.

@earthlng
Copy link
Contributor

After the discussion on #447 I decided to send single pull requests improving the existent script instead of writing a new one.

thanks! 👍

Looks good to me. If @overdodactyl gives the thumbs up I'll merge it

@ema-pe
Copy link
Contributor Author

ema-pe commented Jun 25, 2018 via email

@KOLANICH
Copy link

KOLANICH commented Jun 25, 2018

But aria2c is not preinstalled, while curl and wget are.

1 If curl were preinstalled, there would be no such a PR
2 aria2c is a must-have anyway
3 for lulz, of course

I mean there is no reason to use either wget or curl since they are both installed on most of systems and selecting a one present makes the code more complex. In an ideal world there is only one ideal downloader used by everyone and supporting everything. In real world embedding the dispatching looks untidy, but abstracting it into a lib just adds a yet other dependency.

@ema-pe
Copy link
Contributor Author

ema-pe commented Jun 25, 2018 via email

@KOLANICH
Copy link

KOLANICH commented Jun 25, 2018

Then it makes sense, thank you for the clarification.

@earthlng
Copy link
Contributor

earthlng commented Jul 6, 2018

Okay, I'm just gonna merge this because it doesn't look like @overdodactyl is checking his github very often.

@overdodactyl if you don't like these changes, feel free to create a new PR

@earthlng earthlng merged commit 857cbd8 into arkenfox:master Jul 6, 2018
@overdodactyl
Copy link
Contributor

Changes look great, thanks @ema-pe :) Sorry for being MIA, glad you went ahead with the merge!

@ema-pe ema-pe deleted the add-wget-fallback branch July 16, 2018 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants