-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·94 lines (84 loc) · 3.25 KB
/
install.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env bash
if [[ ! -f $HOME/.zshrc && ! -f $HOME/.bashrc && ! -f $HOME/.bash_profile ]]; then
echo -e "\nCreating an empty $HOME/.bash_profile"
touch $HOME/.bash_profile
fi
if [[ $(uname) == "Darwin" ]]; then
if [[ ! -f /usr/local/bin/brew ]]; then
echo -e "\nInstalling homebrew"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" || exit 1
fi
echo -e "\nGetting the list of packages already installed with brew"
_installed=$(brew list -1)
_brew_install_or_upgrade() {
for x in "$@"; do
echo "checking $x"
if [[ -z "$(echo -e "$_installed" | grep "$x")" ]]; then
brew install $x
else
brew upgrade $x 2>/dev/null
fi
done
}
fi
CLOUD_INSTANCE=
[[ -d /var/lib/cloud/instance ]] && CLOUD_INSTANCE=yes
if [[ -f /usr/bin/apt-get && -n "$(groups | grep sudo)" ]]; then
echo -e "\nUpdating apt-get package listing"
sudo apt-get update || exit 1
echo -e "\nInstalling tools"
sudo apt-get install -y binutils-multiarch gcc g++ python3-dev python3-venv python3-pip python3-setuptools build-essential
sudo apt-get install -y libav-tools
[[ $? -ne 0 ]] && sudo apt-get install -y ffmpeg
sudo apt-get install -y sox rtmpdump
# Requirements for lxml
sudo apt-get install -y libxml2 libxslt1.1 libxml2-dev libxslt1-dev zlib1g-dev
if [[ -z "$CLOUD_INSTANCE" ]]; then
sudo apt-get install -y moc vlc imagemagick wmctrl
# Requirements for dbus-python
sudo apt-get install -y pkg-config libdbus-1-dev libdbus-glib-1-dev
fi
elif [[ -f /usr/local/bin/brew ]]; then
echo -e "\nUpdating homebrew package listing"
brew update || exit 1
echo -e "\nInstalling/upgrading tools"
_brew_install_or_upgrade python3 moc libav sox rtmpdump libxml2
fi
if [[ ! -d "$HOME/.beu" ]]; then
echo -e "\nCreating $HOME/.beu directory"
mkdir -p $HOME/.beu
fi
cd $HOME/.beu || exit 1
PYTHON="python3"
PIP="venv/bin/pip3"
if [[ $(uname) =~ "MINGW" ]]; then
PYTHON="python"
PIP="venv/Scripts/pip"
fi
echo -e "\nCreating $HOME/.beu/venv virtual environment and installing"
[[ ! -d venv ]] && $PYTHON -m venv venv
PYTHON=$(dirname $PIP)/python
$PYTHON -m pip install --upgrade pip wheel
if [[ $(uname) =~ "MINGW" ]]; then
$PIP install beu ipython
elif [[ $(uname) == "Darwin" ]]; then
$PIP install beu ipython pdbpp mocp mocp-cli
elif [[ -z "$CLOUD_INSTANCE" ]]; then
$PIP install beu ipython pdbpp mocp mocp-cli vlc-helper
fi
echo -e "\nSaving latest wrappers.sh"
curl https://raw.githubusercontent.com/kenjyco/beu/master/wrappers.sh > wrappers.sh
if [[ -f $HOME/.zshrc ]]; then
if [[ -z "$(grep '.beu' $HOME/.zshrc)" ]]; then
echo -e '\n[[ -f $HOME/.beu/wrappers.sh ]] && source $HOME/.beu/wrappers.sh' >> $HOME/.zshrc
fi
fi
if [[ -f $HOME/.bashrc ]]; then
if [[ -z "$(grep '.beu' $HOME/.bashrc)" ]]; then
echo -e '\n[[ -f $HOME/.beu/wrappers.sh ]] && source $HOME/.beu/wrappers.sh' >> $HOME/.bashrc
fi
elif [[ -f $HOME/.bash_profile ]]; then
if [[ -z "$(grep '.beu' $HOME/.bash_profile)" ]]; then
echo -e '\n[[ -f $HOME/.beu/wrappers.sh ]] && source $HOME/.beu/wrappers.sh' >> $HOME/.bash_profile
fi
fi