Skip to content

Conversation

@bigsmile74
Copy link
Contributor

UNTESTED:

Split process_url into two parts:

  • set_dl that figures out the best download tool
  • process_url for downloading

I did not know what to put in my configuration of PBR to test it on short notice. So this is untested. Maybe you have suggestions for a couple of triggers.

Also I traded in the sed regex for xargs which I interpreted as compatible, but needs to be tested. Download is redirected to stdout where its split into arguments by xargs. (no temp file needed anymore)

Please if you think of a good error text, I could not.

Split process_url into two parts:
set_dl that figures out which download tool to use
process_url for downloading

I did not know what to put in my configuration of PBR to test it on short notice. So this is UNTESTED.

Also I traded in the sed regex for xargs which I interpreted as compatible. Download is redirected to stdout where its split into arguments by xargs. (no temp file needed anymore)


Signed-off-by: bigsmile74 <118111679+bigsmile74@users.noreply.github.com>
-f FILE		- FILE exists and is a regular file
-x FILE		- FILE exists and the user has execute (or search) access

changed dl_scheme into dl_schemes
set_dl(){
[ -x "$wget" ] && {
dl_schemes='ftp http'
dl_command='$wget -q --no-check-certificate'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use double quotes for dl_command expressions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, otherwise it does not work 🤣

Changed single quotes, to variable friendly double quotes ;)
@stangri
Copy link
Owner

stangri commented Oct 25, 2024

I like the introduction of dl_schemes per each download utility and just checking it against the schema used in the download.

I think it would make sense to incorporate the code from dl_set() function back into process_download tho, and declare dl_schemes as a local variable in process_download.

If you have curl installed you can test with a local file containing some domains.

I can bump compat variables and improve/bring the error string into luci app after merging PR.

@bigsmile74
Copy link
Contributor Author

(Would have gotten back sooner, but I'm swamped a the moment) Personally I would move dl_set into _system_health_check and check everything beforehand. Aborting then would prevent the system to become semi-configured.

@stangri
Copy link
Owner

stangri commented Nov 2, 2024

(Would have gotten back sooner, but I'm swamped a the moment) Personally I would move dl_set into _system_health_check and check everything beforehand. Aborting then would prevent the system to become semi-configured.

Now that there is a _system_health_check, that might not be a bad idea, even at the expense of having to parse the pbr config to look for links on start. Let me sleep on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants