mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] Allow to dig deeper into an archive with ynh_setup_source
This commit is contained in:
parent
0bc8300b88
commit
63d62b4f7a
1 changed files with 13 additions and 3 deletions
|
@ -118,6 +118,8 @@ ynh_backup_before_upgrade () {
|
|||
# SOURCE_FORMAT=tar.gz
|
||||
# # (Optional) Put false if sources are directly in the archive root
|
||||
# # default: true
|
||||
# # Instead of true, SOURCE_IN_SUBDIR could be the number of sub directories
|
||||
# # to remove.
|
||||
# SOURCE_IN_SUBDIR=false
|
||||
# # (Optionnal) Name of the local archive (offline setup support)
|
||||
# # default: ${src_id}.${src_format}
|
||||
|
@ -136,6 +138,8 @@ ynh_backup_before_upgrade () {
|
|||
# If it's ok, the source archive will be uncompressed in $dest_dir. If the
|
||||
# SOURCE_IN_SUBDIR is true, the first level directory of the archive will be
|
||||
# removed.
|
||||
# If SOURCE_IN_SUBDIR is a numeric value, 2 for example, the 2 first level
|
||||
# directories will be removed
|
||||
#
|
||||
# Finally, patches named sources/patches/${src_id}-*.patch and extra files in
|
||||
# sources/extra_files/$src_id will be applied to dest_dir
|
||||
|
@ -200,8 +204,14 @@ ynh_setup_source () {
|
|||
fi
|
||||
else
|
||||
local strip=""
|
||||
if $src_in_subdir ; then
|
||||
strip="--strip-components 1"
|
||||
if [ "$src_in_subdir" != "false" ]
|
||||
then
|
||||
if [ "$src_in_subdir" == "true" ]; then
|
||||
local sub_dirs=1
|
||||
else
|
||||
local sub_dirs="$src_in_subdir"
|
||||
fi
|
||||
strip="--strip-components $sub_dirs"
|
||||
fi
|
||||
if [[ "$src_format" =~ ^tar.gz|tar.bz2|tar.xz$ ]] ; then
|
||||
tar -xf $src_filename -C "$dest_dir" $strip
|
||||
|
|
Loading…
Add table
Reference in a new issue