tweaked
[myplc.git] / build.sh
1 #!/bin/bash
2 #
3 # Builds MyPLC, either inside the MyPLC development environment in
4 # devel/root (if PLC_DEVEL_BOOTSTRAP is true), or in the current host
5 # environment (may be itself a MyPLC development environment or a
6 # Fedora environment with the appropriate development packages
7 # installed).
8 #
9 # Marc E. Fiuczynski <mef@cs.princeton.edu>
10 # Copyright (C) 2007 The Trustees of Princeton University
11 #
12 # $Id$
13 #
14
15 . build.functions
16
17 # Install configuration scripts
18 echo "* Installing configuration scripts"
19 pldistro=$1; shift
20 RPM_BUILD_ROOT=$1 ; shift
21 PYTHON_SITEARCH=`python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib(1)'`
22 rm -rf ${RPM_BUILD_ROOT}
23 mkdir -p ${RPM_BUILD_ROOT}
24
25 echo "* Installing plc_config.py in " ${PYTHON_SITEARCH}
26 install -D -m 755 plc_config.py ${RPM_BUILD_ROOT}/${PYTHON_SITEARCH}/plc_config.py
27
28 echo "* Installing scripts in /usr/bin"
29 mkdir -p ${RPM_BUILD_ROOT}/usr/bin
30 rsync -av --exclude .svn bin/ ${RPM_BUILD_ROOT}/usr/bin/
31 chmod 755 ${RPM_BUILD_ROOT}/usr/bin/*
32
33 # Install initscript 
34 echo "* Installing plc initscript"
35 install -D -m 755 plc.init ${RPM_BUILD_ROOT}/etc/init.d/plc
36
37 # Install initscripts
38 echo "* Installing plc.d initscripts"
39 find plc.d | cpio -p -d -u ${RPM_BUILD_ROOT}/etc/
40 chmod 755 ${RPM_BUILD_ROOT}/etc/plc.d/*
41
42 # Install db-config.d files
43 echo "* Installing db-config.d files"
44 mkdir -p ${RPM_BUILD_ROOT}/etc/planetlab/db-config.d
45 cp db-config.d/* ${RPM_BUILD_ROOT}/etc/planetlab/db-config.d
46 chmod 444 ${RPM_BUILD_ROOT}/etc/planetlab/db-config.d/*
47
48 # Extra scripts (mostly for mail and dns) not installed by myplc by default.  Used in production
49 echo "* Installing scripts in /etc/support-scripts"
50 mkdir -p ${RPM_BUILD_ROOT}/etc/support-scripts
51 cp support-scripts/* ${RPM_BUILD_ROOT}/etc/support-scripts
52 chmod 444 ${RPM_BUILD_ROOT}/etc/support-scripts/*
53
54 # copy initscripts to etc/plc_sliceinitscripts
55 mkdir -p ${RPM_BUILD_ROOT}/etc/plc_sliceinitscripts
56 cp plc_sliceinitscripts/* ${RPM_BUILD_ROOT}/etc/plc_sliceinitscripts
57 chmod 444 ${RPM_BUILD_ROOT}/etc/plc_sliceinitscripts/*
58
59 # Install configuration file
60 echo "* myplc: Installing configuration file"
61 install -D -m 444 default_config.xml ${RPM_BUILD_ROOT}/etc/planetlab/default_config.xml
62 install -D -m 444 plc_config.dtd ${RPM_BUILD_ROOT}/etc/planetlab/plc_config.dtd
63
64 echo "* Installing bashrc convenience"
65 install -D -m 644 bashrc ${RPM_BUILD_ROOT}/usr/share/myplc/bashrc
66
67 # yumgroups.xml and yum repo : let noderepo handle that
68
69 exit 0