Skip to content

Commit 222393e

Browse files
committed
better handling of switching to tepdir
1 parent 2c45467 commit 222393e

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

Diff for: install.sh

+13-7
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ install_froster() {
280280

281281
if [ "$LOCAL_INSTALL" = "true" ]; then
282282
echo -e "\nInstalling Froster from the current directory in --editable mode..."
283-
pip install -e . >/dev/null 2>&1 &
283+
python3 -m pip install -e . >/dev/null 2>&1 &
284284
spinner $!
285285
echo "...Froster installed"
286286
else
@@ -324,6 +324,9 @@ install_pwalk() {
324324
exit 1
325325
fi
326326

327+
# Get the current directory and change to a new temporary directory
328+
curdir=$(pwd) && tmpdir=$(mktemp -d -t froster.XXX) && cd "$tmpdir"
329+
327330
# Variables of pwalk third-party tool froster is using
328331
pwalk_commit=1df438e9345487b9c51d1eea3c93611e9198f173 # update this commit when new pwalk version released
329332
pwalk_repository=https://github.com/fizwit/filesystem-reporting-tools/archive/${pwalk_commit}.tar.gz
@@ -353,6 +356,9 @@ install_pwalk() {
353356
# Delete downloaded pwalk files
354357
echo " Cleaning up pwalk installation files"
355358
rm -rf ${pwalk_path} >/dev/null 2>&1
359+
360+
# back to PWD
361+
cd $curdir
356362

357363
echo "...pwalk installed"
358364
}
@@ -367,6 +373,9 @@ install_rclone() {
367373
exit 1
368374
fi
369375

376+
# Get the current directory and change to a new temporary directory
377+
curdir=$(pwd) && tmpdir=$(mktemp -d -t froster.XXX) && cd "$tmpdir"
378+
370379

371380
# Check the architecture of the system
372381
arch=$(uname -m)
@@ -408,6 +417,9 @@ install_rclone() {
408417
echo " Cleaning up rclone installation files"
409418
rm -rf rclone-current-linux-*.zip rclone-v*/ >/dev/null 2>&1
410419

420+
# back to PWD
421+
cd $curdir
422+
411423
echo "...rclone installed"
412424
}
413425

@@ -424,9 +436,6 @@ umask 0002
424436
# Backup old installation (if any)
425437
backup_old_installation
426438

427-
# Get the current directory and change to a new temporary directory
428-
curdir=$(pwd) && tmpdir=$(mktemp -d -t froster.XXX) && cd "$tmpdir"
429-
430439
# Install pipx
431440
install_pipx
432441

@@ -439,9 +448,6 @@ install_pwalk
439448
# Install rclone
440449
install_rclone
441450

442-
# back to PWD
443-
cd $curdir
444-
445451
# Get the installed froster version
446452
version=$(froster -v | awk '{print $2}')
447453

0 commit comments

Comments
 (0)