summaryrefslogtreecommitdiff
path: root/pkg/tools/bitmask-bootstrap.sh
blob: 3f494ccfdabb11ed5fbb612901264a4bfb36ca68 (plain)
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
#!/bin/bash
#######################################
# Bootstrap a bitmask-dev environment #
#######################################

set -e

APT_DEPS="build-essential python-dev python-virtualenv libsqlcipher-dev libssl1.0-dev libffi-dev haveged python-pyqt5 python-pyqt5.qtwebkit"

function add_pew_to_environment()
{
  while true; do
    read -p "Do you want to add pew executable to your .zshrc?> " yn
    case $yn in
	    [Yy]* ) echo "PATH=~/.local/bin:\$PATH" >> ~/.zshrc; echo "source \$(pew shell_config)" >> ~/.zshrc; break;;
	    [Nn]* ) return;;
	    * ) echo "Please answer yes or no.";;
    esac
  done
}

function init_pew()
{
  which pew || pip install pew
  which pew || add_pew_to_environment
  PATH=~/.local/bin:$PATH
  # this hangs when creating for the first time
  pew ls | grep bitmask || echo '[+] bitmask boostrap: creating new bitmask virtualenv. Type "exit" in the shell to continue!' && pew new bitmask
}

function apt_install()
{
  sudo apt install $APT_DEPS
}

function clone_repo()
{
  mkdir -p ~/leap/ && cd ~/leap
  git clone https://0xacab.org/leap/bitmask-dev || echo 'not cloning: bitmask-dev already exists...'
}

function install_deps()
{
  cd ~/leap/bitmask-dev && pew in bitmask pip install -U -r pkg/requirements-dev.pip
  cd ~/leap/bitmask-dev && pew in bitmask pip install -U -r pkg/requirements-testing.pip
  cd ~/leap/bitmask-dev && pew in bitmask make dev-all
}

init_pew
apt_install
clone_repo
install_deps
pew workon bitmask