2828URL=" https://api.github.com/repos/bashpack-project/bashpack/tarball" # for Github tarball
2929# URL="https://github.com/bashpack-project/bashpack/archive/refs/heads" # for Github main branch
3030
31- VERSION=" 0.2.18 "
31+ VERSION=" 0.2.19 "
3232
3333NAME=" Bashpack"
3434NAME_LOWERCASE=$( echo " $NAME " | tr A-Z a-z)
@@ -283,13 +283,24 @@ delete_systemd() {
283283
284284
285285
286+ # Helper function to assemble all functions that delete something
286287delete_all () {
287288 delete_systemd && delete_cli
288289}
289290
290291
291292
292293
294+ # Helper function to extract a .tar.gz archive
295+ # Usage : archive_extract <archive> <directory>
296+ archive_extract () {
297+ # "tar --strip-components 1" permit to extract sources in /tmp/bashpack and don't create a new directory /tmp/bashpack/bashpack
298+ tar -xf ${1} -C ${2} --strip-components 1
299+ }
300+
301+
302+
303+
293304# Download releases archives from the repository
294305# Usages :
295306# - download_cli <latest>
@@ -312,19 +323,19 @@ download_cli() {
312323 if [[ $( exists_command " curl" ) = " exists" ]]; then
313324 echo -n " with curl... "
314325 loading " curl -sL $archive_url -o $archive_tmp "
326+
327+ archive_extract $archive_tmp $archive_dir_tmp
315328
316329 # Try to download with wget if exists
317330 elif [[ $( exists_command " wget" ) = " exists" ]]; then
318331 echo -n " with wget... "
319332 loading " wget -q $archive_url -O $archive_tmp "
320333
334+ archive_extract $archive_tmp $archive_dir_tmp
335+
321336 else
322337 error_file_not_downloaded $archive_name $archive_url
323338 fi
324-
325- # "tar --strip-components 1" permit to extract sources in /tmp/bashpack and don't create a new directory /tmp/bashpack/bashpack
326- tar -xf $archive_tmp -C $archive_dir_tmp --strip-components 1
327-
328339}
329340
330341
0 commit comments