-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstall
More file actions
executable file
·65 lines (50 loc) · 1.59 KB
/
install
File metadata and controls
executable file
·65 lines (50 loc) · 1.59 KB
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
#!/bin/sh
bro_repo=https://github.com/ludbek/bro.git
bro_expand () {
echo `sh -c "echo $1"`
}
# Check if git is installed
command -v git > /dev/null || {
echo "Please install 'git' first."
exit 2;
}
# Abort if 'bro' is already installed
if command -v bro > /dev/null && [ -d $BRO_STATION ]; then
echo "'bro' is already installed at '$BRO_STATION'. Please use 'git' to update it.";
exit 1;
fi
# Get location where bro will be installed
read -p "BRO_STATION? ($HOME/.bro):" BRO_STATION
if [ "$BRO_STATION" = "" ]; then
BRO_STATION="$HOME/.bro"
fi
# Get home directory for projects
read -p "WORKSTATION? ($HOME/projects):" WORKSTATION
if [ "$WORKSTATION" = "" ]; then
WORKSTATION="$HOME/projects"
fi
mkdir -p `bro_expand $WORKSTATION`
backup_directory=~/bro_projects_reference_backup_directory
# remove borken installation
if [ -d $BRO_STATION ] ; then
echo "\nBacking up existing project references."
mv $BRO_STATION/projects $backup_directory
echo "Removing broken installation at $BRO_STATION"
rm -rf $BRO_STATION
fi
# Clone bro to home directory
git clone $bro_repo $BRO_STATION || {
echo "Could not install 'bro'. Please report the issue at 'https://github.com/ludbek/bro/issues'."
exit 2
}
if [ -d $backup_directory ]; then
echo "Restoring project references."
mv $backup_directory $BRO_STATION/projects
fi
mkdir -p $BRO_STATION/projects
# Register 'bro' config files at .bashrc
echo "\n### Bro" >> ~/.bashrc
echo "export BRO_STATION=$BRO_STATION" >> ~/.bashrc
echo "export WORKSTATION=$WORKSTATION" >> ~/.bashrc
echo "source $BRO_STATION/activate" >> ~/.bashrc
echo "\nPlease source ~/.bashrc ."