Skip to content

Commit

Permalink
properly address #37 by only creating a tmp dir during install or sef…
Browse files Browse the repository at this point in the history
…-update
  • Loading branch information
NicolasCARPi committed Apr 15, 2024
1 parent 8982829 commit dad670c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for elabctl

## Version 5.0.3

* Properly address #37 by only creating a tmp dir during install or sef-update

## Version 5.0.2

* Cleanup tmp dir created during `self-update` function. fix #37
Expand Down
10 changes: 7 additions & 3 deletions elabctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://github.com/elabftw/elabctl/
# © 2022 Nicolas CARPi @ Deltablot
# License: GPLv3
declare -r ELABCTL_VERSION='5.0.2'
declare -r ELABCTL_VERSION='5.0.3'

# default backup dir
declare BACKUP_DIR='/var/backups/elabftw'
Expand All @@ -13,8 +13,6 @@ declare DUMP_DELETE_DAYS=+0

# default config file for docker-compose
declare CONF_FILE='/etc/elabftw.yml'
declare TMP_DIR=$(mktemp -d)
declare TMP_CONF_FILE="${TMP_DIR}/elabftw.yml"
# default data directory
declare DATA_DIR='/var/elabftw'

Expand Down Expand Up @@ -245,6 +243,9 @@ function install
sudo mkdir -pv $DATA_DIR
fi

declare TMP_DIR=$(mktemp -d)
declare TMP_CONF_FILE="${TMP_DIR}/elabftw.yml"

if [ "$unattended" -eq 0 ]; then
set +e
########################################################################
Expand Down Expand Up @@ -352,6 +353,8 @@ function install
# use sudo in case it's in /etc and we are not root
sudo mv "$TMP_CONF_FILE" "$CONF_FILE"

rmdir -v ${TMP_DIR}

# final screen
if [ "$unattended" -eq 0 ]; then
dialog --colors --backtitle "$backtitle" --title "Installation finished" --msgbox "\nCongratulations, eLabFTW was successfully installed! :)\n\n
Expand Down Expand Up @@ -441,6 +444,7 @@ function select-dc-cmd
function self-update
{
me=$(command -v "$0")
TMP_DIR=$(mktemp -d)
tmp_filepath="${TMP_DIR}/elabctl"
echo "Downloading new version to $tmp_filepath"
curl -sL https://raw.githubusercontent.com/elabftw/elabctl/master/elabctl.sh -o "$tmp_filepath"
Expand Down

0 comments on commit dad670c

Please sign in to comment.