This repository has been archived by the owner on Dec 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathinstall_debug.sh
executable file
·66 lines (56 loc) · 2.11 KB
/
install_debug.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# This prints some debugging information that may be helpful for debugging enclone installation
# problems.
#
# At one time we had this as part of code in install.sh that attempted to detect installation
# failures. This did not work reliably. Pretty much, there were two lessons of that attempt:
#
# 1. It is not possible for a shell script to determine what would happen if a command was typed
# from a fresh terminal window. You can get close, but not all the way there.
#
# 2. Every line in a shell script should be treated as a liability and dangerous. Do not add
# lines unless they are absolutely needed.
printf "\nSome diagnostic information will be printed out below.\n"
printf "\n1. Determining which shell you are using: $SHELL.\n"
printf "\n2. Show the permissions on ~/bin/enclone:\n\n"
ls -l ~/bin/enclone
printf "\n3. Testing for existence of various initialization files in your home directory\n"
printf " and for each such file, if present, whether it sets your path.\n\n"
cd
NEWLINE=1
# Decide which initialization files to test.
if [ "$SHELL" == "/bin/tcsh" ]; then
files=( ".tcshrc" ".login" ".cshrc" )
elif [ "$SHELL" == "/bin/zsh" ]; then
files=( ".zshenv" ".zprofile" ".zshrc" ".zlogin" )
elif [ "$SHELL" == "/bin/bash" ]; then
files=( ".profile" ".bash_login" ".bash_profile" ".bashrc" )
elif [ "$SHELL" == "/bin/sh" ]; then
files=( ".profile" ".bash_login" ".bash_profile" ".bashrc" )
else
files=( ".profile" \
".zshenv" ".zprofile" ".zshrc" ".zlogin" \
".bash_login" ".bash_profile" ".bashrc" \
".tcshrc" ".login" ".cshrc" )
fi
# Test initialization files.
for i in "${files[@]}"
do
ls -l $i >& /dev/null
if [ "$?" -eq "0" ]; then
if [ "$NEWLINE" -eq "0" ]; then
echo ""
NEWLINE=1
fi
printf "$i: present\ntesting it for setting path\n"
cat $i | grep -i PATH | grep -v "^#" | uniq
echo ""
else
echo "$i: absent"
NEWLINE=0
fi
done
if [ "$NEWLINE" -eq "0" ]; then
echo ""
fi
printf "\nDone with printing diagnostic information.\n\n"