-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrunme.sh
More file actions
70 lines (65 loc) · 2.35 KB
/
runme.sh
File metadata and controls
70 lines (65 loc) · 2.35 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
66
67
68
69
70
#!/bin/bash
do=""
proxy=""
echo
echo detecting your environment
if ping -c 1 ix.de &>/dev/null; then
echo "direct internet connection, doing nothing"
else
echo "caged environment detected, setting proxy"
# this is the cntlm proxy, you/we would install
proxy="http://127.0.0.1:53128"
fi
# just another guard before running yum commands
if [ -n "$proxy" -a -f /etc/centos-release ]; then
echo
echo "you must be in an office, right?"
echo
echo "get ready to rock on your Flask!"
echo
git config --global credential.helper "cache --timeout=$(( 8*3600 ))"
git config --global http.proxy $proxy
rpms=""
echo "in office we need sudo to build & run our stack"
echo
echo "lets cache the sudo credentials now"
export do="sudo"
$do pwd
rpms="$rpms python36-virtualenv.noarch python36-pip"
which cntlm &>/dev/null || rpms="$rpms cntlm"
which redis-cli &>/dev/null || rpms="$rpms redis"
rpms="$rpms postgresql postgresql-server pgadmin3"
[ -n "$rpms" ] && echo "installing for you $rpms"
[ -n "$rpms" ] && $do yum install -y $rpms
$do systemctl enable cntlm
$do systemctl enable redis
$do systemctl enable postgresql
echo
echo configuring cntlm
if [ ! -f ~/cntlm.ini ]; then
cat cntlm.ini.head > ~/cntlm.ini
read -p "please type your Windows/DOMAIN username: " aduser
echo -n "creating cntlm hashes for your DOMAIN account, please type your Windows password: "
cntlm -H -u $aduser -d your.DOMAIN | \
sed -e "s/Password:/Username \t$aduser/" | $do tee -a ~/cntlm.ini
else
echo your local cntlm.ini is already created, using it
fi
$do sed -i "s/cntlm.conf/cntlm.ini/" /usr/lib/systemd/system/cntlm.service
$do ln -sf ~/cntlm.ini /etc/cntlm.ini
echo
$do systemctl daemon-reload && echo restarted systemctl daemon
$do systemctl restart cntlm && echo restarted cntlm
$do systemctl restart redis && echo restarted redis
echo
echo initdb the postgresql, if needed
$do postgresql-setup initdb &> /dev/null
$do systemctl restart postgresql && echo restarted postgresql
echo
echo creating the required postgresql databases, if needed
$do -iu postgres createuser --superuser $USER &> /dev/null
$do -iu postgres createdb lunch &> /dev/null
fi
echo
echo running ./local/install.sh
./local/install.sh