Skip to content

Commit 287d661

Browse files
authored
Merge pull request #157 from dirkpetersen/fix
Fix
2 parents 321b600 + b4e4fb7 commit 287d661

File tree

2 files changed

+36
-11
lines changed

2 files changed

+36
-11
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,4 @@ dmypy.json
133133

134134
# Pyre type checker
135135
.pyre/
136+
.aider*

install.sh

+35-11
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@
33
# Make sure script ends as soon as an error arises
44
set -e
55

6+
# Parse command line arguments
7+
VERBOSE=false
8+
while [[ $# -gt 0 ]]; do
9+
case $1 in
10+
--verbose)
11+
VERBOSE=true
12+
shift
13+
;;
14+
*)
15+
echo "Unknown option: $1"
16+
exit 1
17+
;;
18+
esac
19+
done
20+
21+
# Function to conditionally redirect output
22+
redirect_output() {
23+
if [ "$VERBOSE" = true ]; then
24+
cat
25+
else
26+
cat >/dev/null 2>&1
27+
fi
28+
}
29+
630
#################
731
### VARIABLES ###
832
#################
@@ -279,12 +303,12 @@ install_pipx() {
279303

280304
echo -e "\nInstalling pipx..."
281305

282-
python3 -m pip install --user pipx >/dev/null 2>&1 || python3 -m pip install --user --break-system-packages pipx >/dev/null 2>&1
306+
python3 -m pip install --user pipx 2>&1 | redirect_output || python3 -m pip install --user --break-system-packages pipx 2>&1 | redirect_output
283307

284308
# ensure path for pipx
285309
pipx_version=$(python3 -m pipx --version 2> /dev/null)
286310
if [[ $pipx_version =~ $version_regex ]]; then
287-
python3 -m pipx ensurepath >/dev/null 2>&1
311+
python3 -m pipx ensurepath 2>&1 | redirect_output
288312
echo "...pipx installed"
289313
else
290314
echo "...pipx ensurepath failed"
@@ -312,7 +336,7 @@ install_froster() {
312336
else
313337

314338
echo " Installing from PyPi package repository"
315-
python3 -m pipx install froster >/dev/null 2>&1 &
339+
python3 -m pipx install froster 2>&1 | redirect_output &
316340

317341
if pipx list | grep froster >/dev/null 2>&1; then
318342
echo -e "\nUninstalling old Froster..."
@@ -363,24 +387,24 @@ install_pwalk() {
363387
pwalk_path=filesystem-reporting-tools-${pwalk_commit}
364388

365389
# Delete previous downloaded pwalk files (if any)
366-
rm -rf ${pwalk_path} >/dev/null 2>&1
390+
rm -rf ${pwalk_path} 2>&1 | redirect_output
367391

368392
# Gather pwalk repository files
369393
echo " Downloading pwalk files"
370-
curl -s -L ${pwalk_repository} | tar xzf - >/dev/null 2>&1 &
394+
curl -s -L ${pwalk_repository} | tar xzf - 2>&1 | redirect_output &
371395
spinner $!
372396

373397
# Compile pwalk tool and put exec file in froster's binaries folder
374398
echo " Compiling pwalk"
375-
gcc -pthread ${pwalk_path}/pwalk.c ${pwalk_path}/exclude.c ${pwalk_path}/fileProcess.c -o ${pwalk_path}/pwalk >/dev/null 2>&1 &
399+
gcc -pthread ${pwalk_path}/pwalk.c ${pwalk_path}/exclude.c ${pwalk_path}/fileProcess.c -o ${pwalk_path}/pwalk 2>&1 | redirect_output &
376400
spinner $!
377401

378402
# Get the froster's binaries folder
379403
froster_dir=$(dirname "$(readlink -f $(which froster))")
380404
echo " Moving pwalk to froster's binaries folder"
381405

382406
# Move pwalk to froster's binaries folder
383-
mv ${pwalk_path}/pwalk ${froster_dir}/pwalk >/dev/null 2>&1
407+
mv ${pwalk_path}/pwalk ${froster_dir}/pwalk 2>&1 | redirect_output
384408
echo " Installed pwalk at ${froster_dir}/pwalk"
385409

386410
# Delete downloaded pwalk files
@@ -423,24 +447,24 @@ install_rclone() {
423447
fi
424448

425449
# Remove previous downloaded zip file (if any)
426-
rm -rf rclone-current-linux-*.zip rclone-v*/ >/dev/null 2>&1
450+
rm -rf rclone-current-linux-*.zip rclone-v*/ 2>&1 | redirect_output
427451

428452
# Download the rclone zip file
429453
echo " Downloading rclone files"
430-
curl -LO $rclone_url >/dev/null 2>&1 &
454+
curl -LO $rclone_url 2>&1 | redirect_output &
431455
spinner $!
432456

433457
# Extract the zip file
434458
echo " Extracting rclone files"
435-
unzip rclone-current-linux-*.zip >/dev/null 2>&1 &
459+
unzip rclone-current-linux-*.zip 2>&1 | redirect_output &
436460
spinner $!
437461

438462
# Get the froster's binaries folder
439463
froster_dir=$(dirname "$(readlink -f $(which froster))")
440464
echo " Moving rclone to froster's binaries folder"
441465

442466
# Move rclone to froster's binaries folder
443-
mv rclone-v*/rclone ${froster_dir}/rclone >/dev/null 2>&1
467+
mv rclone-v*/rclone ${froster_dir}/rclone 2>&1 | redirect_output
444468
echo " Installed rclone at ${froster_dir}/rclone"
445469

446470
# Remove the downloaded zip file

0 commit comments

Comments
 (0)