Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eget
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eget
Commits
9f513b0b
Commit
9f513b0b
authored
Dec 09, 2025
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eget: add a few url support
parent
a01815f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
2 deletions
+56
-2
eget
eget
+56
-2
No files found.
eget
View file @
9f513b0b
...
@@ -326,6 +326,7 @@ CURLTRUSTSERVERNAMES=''
...
@@ -326,6 +326,7 @@ CURLTRUSTSERVERNAMES=''
CURLOUTPUTDIR
=
''
CURLOUTPUTDIR
=
''
WGETOUTPUTDIR
=
''
WGETOUTPUTDIR
=
''
USEOUTPUTDIR
=
''
WGETNODIRECTORIES
=
''
WGETNODIRECTORIES
=
''
WGETCONTINUE
=
''
WGETCONTINUE
=
''
CURLCONTINUE
=
''
CURLCONTINUE
=
''
...
@@ -484,6 +485,7 @@ while [ -n "$1" ] ; do
...
@@ -484,6 +485,7 @@ while [ -n "$1" ] ; do
shift
shift
CURLOUTPUTDIR
=
"--create-dirs --output-dir
$1
"
CURLOUTPUTDIR
=
"--create-dirs --output-dir
$1
"
WGETOUTPUTDIR
=
"-P
$1
"
WGETOUTPUTDIR
=
"-P
$1
"
USEOUTPUTDIR
=
"
$1
"
;;
;;
-U
|
-A
|
--user-agent
)
-U
|
-A
|
--user-agent
)
user_agent
=
"Mozilla/5.0 (X11; Linux
$arch
) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
user_agent
=
"Mozilla/5.0 (X11; Linux
$arch
) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36"
...
@@ -996,6 +998,15 @@ url_sget()
...
@@ -996,6 +998,15 @@ url_sget()
cp
-av
"
$(
path_from_url
"
$URL
"
)
"
.
cp
-av
"
$(
path_from_url
"
$URL
"
)
"
.
}
}
url_pget
()
{
#[ -n "$USEOUTPUTDIR" ] || fatal "USEOUTPUTDIR is not set"
local
URL
for
URL
in
"
$@
"
;
do
cp
-av
"
$(
path_from_url
"
$URL
"
)
"
$USEOUTPUTDIR
done
}
url_check_accessible
()
url_check_accessible
()
{
{
local
URL
=
"
$1
"
local
URL
=
"
$1
"
...
@@ -1026,6 +1037,7 @@ url_scat()
...
@@ -1026,6 +1037,7 @@ url_scat()
local
URL
=
"
$1
"
local
URL
=
"
$1
"
ipfs_cat
"
$(
cid_from_url
"
$URL
"
)
"
ipfs_cat
"
$(
cid_from_url
"
$URL
"
)
"
}
}
# download to default name of to $2
# download to default name of to $2
url_sget
()
url_sget
()
{
{
...
@@ -1047,6 +1059,19 @@ url_sget()
...
@@ -1047,6 +1059,19 @@ url_sget()
ipfs_get
"
$(
cid_from_url
"
$URL
"
)
"
ipfs_get
"
$(
cid_from_url
"
$URL
"
)
"
}
}
url_pget
()
{
#[ -n "$USEOUTPUTDIR" ] || fatal "USEOUTPUTDIR is not set"
local
URL
for
URL
in
"
$@
"
;
do
local
fn
=
"
$(
url_print_filename_from_url
"
$URL
"
)
"
if
[
-z
"
$fn
"
]
;
then
fn
=
"
$(
basename
$URL
)
"
fi
ipfs_get
"
$(
cid_from_url
"
$URL
"
)
"
"
$USEOUTPUTDIR
/
$fn
"
done
}
url_check_accessible
()
url_check_accessible
()
{
{
local
URL
=
"
$1
"
local
URL
=
"
$1
"
...
@@ -1104,6 +1129,7 @@ url_scat()
...
@@ -1104,6 +1129,7 @@ url_scat()
unset_quiet
unset_quiet
download_with_mirroring __wget
"
$URL
"
-O-
download_with_mirroring __wget
"
$URL
"
-O-
}
}
# download to default name of to $2
# download to default name of to $2
url_sget
()
url_sget
()
{
{
...
@@ -1122,6 +1148,12 @@ url_sget()
...
@@ -1122,6 +1148,12 @@ url_sget()
download_with_mirroring __wget
"
$URL
"
$WGETNAMEOPTIONS
download_with_mirroring __wget
"
$URL
"
$WGETNAMEOPTIONS
}
}
url_pget
()
{
#[ -n "$USEOUTPUTDIR" ] || fatal "USEOUTPUTDIR is not set"
download_with_mirroring __wget
$WGETNAMEOPTIONS
"
$@
"
}
url_get_response
()
url_get_response
()
{
{
local
URL
=
"
$1
"
local
URL
=
"
$1
"
...
@@ -1155,6 +1187,7 @@ url_scat()
...
@@ -1155,6 +1187,7 @@ url_scat()
unset_quiet
unset_quiet
download_with_mirroring __curl
"
$URL
"
--output
-
download_with_mirroring __curl
"
$URL
"
--output
-
}
}
# download to default name of to $2
# download to default name of to $2
url_sget
()
url_sget
()
{
{
...
@@ -1177,6 +1210,15 @@ url_sget()
...
@@ -1177,6 +1210,15 @@ url_sget()
download_with_mirroring __curl
"
$URL
"
$CURLFILENAMEOPTIONS
download_with_mirroring __curl
"
$URL
"
$CURLFILENAMEOPTIONS
}
}
url_pget
()
{
#[ -n "$USEOUTPUTDIR" ] || fatal "USEOUTPUTDIR is not set"
local
URL
for
URL
in
"
$@
"
;
do
download_with_mirroring __curl
$CURLFILENAMEOPTIONS
"
$URL
"
done
}
url_get_response
()
url_get_response
()
{
{
local
URL
=
"
$1
"
local
URL
=
"
$1
"
...
@@ -1482,6 +1524,11 @@ sget()
...
@@ -1482,6 +1524,11 @@ sget()
url_sget
"
$@
"
url_sget
"
$@
"
}
}
pget
()
{
url_pget
"
$@
"
}
check_url_is_accessible
()
check_url_is_accessible
()
{
{
url_check_accessible
"
$@
"
url_check_accessible
"
$@
"
...
@@ -1653,8 +1700,15 @@ if [ -z "$NOGLOB" ] && echo "$URL" | grep -q -P "[*\[\]]" ; then
...
@@ -1653,8 +1700,15 @@ if [ -z "$NOGLOB" ] && echo "$URL" | grep -q -P "[*\[\]]" ; then
fatal
"Error: there are globbing symbol (*[]) in
$URL
. It is allowed only for mask part"
fatal
"Error: there are globbing symbol (*[]) in
$URL
. It is allowed only for mask part"
fi
fi
is_url
"
$MASK
"
&&
fatal
"eget supports only one URL as argument"
if
is_url
"
$MASK
"
;
then
[
-n
"
$3
"
]
&&
fatal
"too many args: extra '
$3
'. May be you need use quotes for arg with wildcards."
#[ -z "$USEOUTPUTDIR" ] && fatal "eget supports only one URL as argument by default, use --output-dir to download in parallel"
USEOUTPUTDIR
=
"."
CURLOUTPUTDIR
=
"--create-dirs --output-dir
$USEOUTPUTDIR
"
pget
"
$@
"
exit
else
[
-n
"
$3
"
]
&&
fatal
"too many args: extra '
$3
'. May be you need use quotes for arg with wildcards."
fi
# TODO: curl?
# TODO: curl?
# If ftp protocol, just download
# If ftp protocol, just download
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment