mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
add support for downloading tar-files
this is needed for invoiceninja, see https://github.com/YunoHost-Apps/invoiceninja5_ynh/pull/280
This commit is contained in:
parent
1c62960e25
commit
e75b4b3b3b
1 changed files with 7 additions and 5 deletions
|
@ -23,10 +23,10 @@
|
||||||
# ##### Optional flags in the 'sources' resource
|
# ##### Optional flags in the 'sources' resource
|
||||||
#
|
#
|
||||||
# ```text
|
# ```text
|
||||||
# format = "tar.gz"/xz/bz2 # automatically guessed from the extension of the URL, but can be set explicitly. Will use `tar` to extract
|
# format = "tar.gz"/xz/bz2/tar # automatically guessed from the extension of the URL, but can be set explicitly. Will use `tar` to extract
|
||||||
# "zip" # automatically guessed from the extension of the URL, but can be set explicitly. Will use `unzip` to extract
|
# "zip" # automatically guessed from the extension of the URL, but can be set explicitly. Will use `unzip` to extract
|
||||||
# "docker" # useful to extract files from an already-built docker image (instead of rebuilding them locally). Will use `docker-image-extract` to extract
|
# "docker" # useful to extract files from an already-built docker image (instead of rebuilding them locally). Will use `docker-image-extract` to extract
|
||||||
# "whatever" # an arbitrary value, not really meaningful except to imply that the file won't be extracted
|
# "whatever" # an arbitrary value, not really meaningful except to imply that the file won't be extracted
|
||||||
#
|
#
|
||||||
# in_subdir = true # default, there's an intermediate subdir in the archive before accessing the actual files
|
# in_subdir = true # default, there's an intermediate subdir in the archive before accessing the actual files
|
||||||
# false # sources are directly in the archive root
|
# false # sources are directly in the archive root
|
||||||
|
@ -107,6 +107,8 @@ ynh_setup_source() {
|
||||||
elif [[ "$src_url" =~ ^.*\.tar\.bz2$ ]]
|
elif [[ "$src_url" =~ ^.*\.tar\.bz2$ ]]
|
||||||
then
|
then
|
||||||
src_format="tar.bz2"
|
src_format="tar.bz2"
|
||||||
|
elif [[ "$src_url" =~ ^.*\.tar$ ]]
|
||||||
|
src_format="tar"
|
||||||
elif [[ -z "$src_extract" ]]
|
elif [[ -z "$src_extract" ]]
|
||||||
then
|
then
|
||||||
src_extract="false"
|
src_extract="false"
|
||||||
|
@ -212,7 +214,7 @@ ynh_setup_source() {
|
||||||
fi
|
fi
|
||||||
strip="--strip-components $sub_dirs"
|
strip="--strip-components $sub_dirs"
|
||||||
fi
|
fi
|
||||||
if [[ "$src_format" =~ ^tar.gz|tar.bz2|tar.xz$ ]]; then
|
if [[ "$src_format" =~ ^tar.gz|tar.bz2|tar.xz|tar$ ]]; then
|
||||||
tar --extract --file=$src_filename --directory="$dest_dir" $strip
|
tar --extract --file=$src_filename --directory="$dest_dir" $strip
|
||||||
else
|
else
|
||||||
ynh_die "Archive format unrecognized."
|
ynh_die "Archive format unrecognized."
|
||||||
|
|
Loading…
Add table
Reference in a new issue