Skip to content

Commit a2a67dc

Browse files
ggtrdggtrd
authored andcommitted
adding option to not delete main file during update
1 parent 18b5c48 commit a2a67dc

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

bashpack.sh

Lines changed: 18 additions & 8 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.19"
31+
VERSION="0.2.20"
3232

3333
NAME="Bashpack"
3434
NAME_LOWERCASE=$(echo "$NAME" | tr A-Z a-z)
@@ -203,12 +203,21 @@ COMMAND_SYSTEMD_STATUS="systemctl status $file_systemd_update.timer"
203203
# Delete the installed command from the system
204204
delete_cli() {
205205

206-
local files=(
207-
$dir_src
208-
$file_autocompletion
209-
$file_main_alias
210-
$file_main
211-
)
206+
local exclude_main=${1}
207+
208+
if [[ $exclude_main = "exclude_main" ]]; then
209+
local files=(
210+
$dir_src
211+
$file_autocompletion
212+
)
213+
else
214+
local files=(
215+
$dir_src
216+
$file_autocompletion
217+
$file_main_alias
218+
$file_main
219+
)
220+
fi
212221

213222

214223
if [[ $(exists_command "$NAME_ALIAS") != "exists" ]]; then
@@ -286,7 +295,7 @@ delete_systemd() {
286295

287296
# Helper function to assemble all functions that delete something
288297
delete_all() {
289-
delete_systemd && delete_cli
298+
delete_systemd && delete_cli
290299
}
291300

292301

@@ -474,6 +483,7 @@ update_cli() {
474483
# # Delete current installed version to clean all old files
475484
# /!\ Deactivated for now because if we delete the last release from Github, the CLI is just beeing removed from the system...
476485
# delete_all
486+
delete_systemd && delete_cli exclude_main
477487

478488
echo ""
479489

0 commit comments

Comments
 (0)