-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjft-deploy
executable file
·59 lines (52 loc) · 2.05 KB
/
jft-deploy
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
#!/bin/sh
### Usage: jft-deploy -h
### Usage: jft-deploy -t HOSTS # host list between quotes, separated by spaces
usage()
{
perl -ne '/^### Usage:/ && do { s/^### ?//; print }' < $0
exit 1
}
help()
{
perl -ne '/^###/ && do { s/^### ?//; print }' < $0
exit 0
}
# Parse command line arguments
# hs is the one argument help 'h'
# t requires a second argument, the host list between quotes
HOSTS=
eval set -- $(getopt -n $0 -o hs:t: -- ${1+"$@"})
[ $? = 0 ] || usage
for arg; do
case $arg in
-t) HOSTS="$2"; shift; shift ;;
-h) help ;;
--) shift; break ;;
-*) usage ;;
esac
done
[ $# = 0 ] || usage
[ X"$HOSTS" = X ] && usage
set -e
for h in $HOSTS; do
# the Infrastructure/Deployment script install system RPMs like the CA certificates, bashs, etc..
sysprep="exec 2>&1; set -ex; hostname -f; \
rm -rf /tmp/foo; mkdir -p /tmp/foo; cd /tmp/foo; \
sudo yum install git.x86_64; \
git clone https://github.com/dmwm/deployment.git cfg; \
[ ! -d /data/user ] || sudo chown \$USER:zh /data/user; \
cfg/Deploy -t dummy -s post \$PWD system/devvm; \
rm -fr /tmp/foo; cd /tmp; \
sudo yum -y install globus-proxy-utils.x86_64 \
globus-gridftp-server-progs.x86_64 globus-gass-copy-progs.x86_64 \
php-cli-5.1.6-32.el5; \
sudo sh -c 'echo \\\"/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=mpetek/CN=676136/CN=Marko Petek\\\" mpetek > /etc/grid-security/grid-mapfile'; \
sudo sh -c 'echo \\\"/DC=org/DC=doegrids/OU=People/CN=Diego da Silva Gomes 849253\\\" diego >> /etc/grid-security/grid-mapfile'; \
sudo sh -c 'echo -e \"\\\$GLOBUS_TCP_PORT_RANGE 40000,45000\nport 2811\" > /etc/gridftp.conf'; \
sudo /sbin/iptables -I RH-Firewall-1-INPUT 4 -m state --state NEW -p tcp -m tcp --dport 2811 -j ACCEPT; \
sudo /sbin/iptables -I RH-Firewall-1-INPUT 5 -m state --state NEW -p tcp -m tcp --dport 40000:45000 -j ACCEPT; \
sudo /sbin/iptables-save; \
"
ssh -t $h sudo -H -u $USER bashs -l -c "$sysprep"
done
exit 0