3
|
1 |
#!/bin/bash
|
|
2 |
|
|
3 |
# Add environment settings to user's
|
|
4 |
# .bashrc
|
|
5 |
# .bash_profile
|
|
6 |
|
|
7 |
# Add a .pvmrc
|
|
8 |
|
|
9 |
. `dirname $0`/user.bash_profile
|
|
10 |
|
|
11 |
|
|
12 |
echo "Configuring user account $USER for sbsv2 in: $SBS_HOME"
|
|
13 |
|
|
14 |
if [ ! -d "$SBS_HOME" ]; then
|
|
15 |
echo "SBS_HOME appears to not be set correctly: $SBS_HOME" 1>&2
|
|
16 |
exit 1
|
|
17 |
fi
|
|
18 |
|
|
19 |
patchfile()
|
|
20 |
{
|
|
21 |
echo "Adding '$2' to $1"
|
|
22 |
grep -q '# SBS_SETTINGS' "$1"
|
|
23 |
if [ $? -eq 0 ]; then
|
|
24 |
sed "s%.* # SBS_SETTINGS (do not edit this line).*%$2 # SBS_SETTINGS (do not edit this line)%" "$1" > "$1.sbsv2" &&
|
|
25 |
mv "$1" "$1.orig" &&
|
|
26 |
mv "$1.sbsv2" "$1"
|
|
27 |
else
|
|
28 |
cp "$1" "$1.orig" &&
|
|
29 |
echo "$2 # SBS_SETTINGS (do not edit this line)" >> "$1"
|
|
30 |
fi
|
|
31 |
}
|
|
32 |
|
|
33 |
# Patch the bash profile
|
|
34 |
patchfile ~/.bash_profile ". $SBS_HOME/bin/user.bash_profile"
|
|
35 |
patchfile ~/.bashrc ". $SBS_HOME/bin/user.bashrc"
|
|
36 |
|
|
37 |
if [ -f ~/.pvmrc ]; then
|
|
38 |
cp ~/.pvmrc ~/.pvmrc.orig
|
|
39 |
fi
|
|
40 |
|
|
41 |
cp $SBS_HOME/util/install-linux/linux_pvmrc ~/.pvmrc
|