Skip to content

Commit 61fee3c

Browse files
ggtrdggtrd
authored andcommitted
0.2.19 archive_extract() + creating HOW_TO_RELEASE
1 parent ff230c6 commit 61fee3c

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

HOW_TO_RELEASE

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
After you're satisfied of your code (it means it must be tested) :
2+
- Edit the $VERSION in bashpack.sh with the new version
3+
- Commit to the working branch
4+
- On Github, merge the working branch to main
5+
- Create a new release & tag with the same version written in $VERSION earlier
6+
- Test on a Linux that the update is working as expected with: sudo bp -u

bashpack.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
URL="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

3333
NAME="Bashpack"
3434
NAME_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
286287
delete_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

Comments
 (0)