deploy_debian.sh 2.63 KB
Newer Older
1 2 3 4 5
#!/bin/bash

#############################
# CONFIGURATION
#############################
6 7
# Debug option for py2app, if needed
export DISTUTILS_DEBUG=0
8

9 10 11 12 13 14 15
#############################
# PREPARATION
#############################
cd ${MDANSE_SOURCE_DIR}
DEBIAN_ROOT_DIR=${MDANSE_SOURCE_DIR}/BuildServer/Build_Debian
rm -rf ${DEBIAN_ROOT_DIR}
mkdir ${DEBIAN_ROOT_DIR}
16

17 18 19 20
#############################
# PACKAGING
#############################
echo -e "${BLUE}""Build debian tree""${NORMAL}"
21 22

# Set automatically the good version number for the Debian control file
23
sed -i "s/Version:.*/Version: ${VERSION_NAME}/g" BuildServer/Unix/Debian_resources/DEBIAN/control
24 25

# Copy all the debian files (e.g. control, copyright, md5sum ...) into DEBIAN directory
26
cp -r BuildServer/Unix/Debian_resources/DEBIAN ${DEBIAN_ROOT_DIR}/
27 28 29 30 31
chmod -R 755 ${DEBIAN_ROOT_DIR}/DEBIAN

# Build the /usr/share/applications directory inside the debian root directory and copy the mdanse desktop file inside
DEBIAN_APP_DIR=${DEBIAN_ROOT_DIR}/usr/share/applications
mkdir -p ${DEBIAN_APP_DIR}
32
cp BuildServer/Unix/Debian_resources/MDANSE.desktop ${DEBIAN_APP_DIR}/
33 34 35 36 37 38 39 40 41

# Build the /usr/share/pixmaps directory inside the debian root directory and copy the mdanse icon file inside
DEBIAN_PIXMAPS_DIR=${DEBIAN_ROOT_DIR}/usr/share/pixmaps
mkdir -p ${DEBIAN_PIXMAPS_DIR}
cp MDANSE/GUI/Icons/mdanse.png ${DEBIAN_PIXMAPS_DIR}/

# Build the /usr/local/bin directory inside the debian root directory and copy the mdanse scripts inside
DEBIAN_BIN_DIR=${DEBIAN_ROOT_DIR}/usr/local/bin
mkdir -p ${DEBIAN_BIN_DIR}
42
cp Scripts/* ${DEBIAN_BIN_DIR}/
43 44 45 46 47
dos2unix ${DEBIAN_BIN_DIR}/mdanse_*

# Build the usr/local/lib/python2.7/dist-packages directory inside the debian root directory and copy the MDANSE package inside
DEBIAN_DIST_DIR=${DEBIAN_ROOT_DIR}/usr/local/lib/python2.7/dist-packages
mkdir -p ${DEBIAN_DIST_DIR}
48

49 50 51 52
# Copy the localy installed ScientificPython, MMTK and MDANSE
cp -r ${MDANSE_TEMPORARY_INSTALLATION_DIR}/lib/python2.7/site-packages/Scientific ${DEBIAN_DIST_DIR}
cp -r ${MDANSE_TEMPORARY_INSTALLATION_DIR}/lib/python2.7/site-packages/MMTK ${DEBIAN_DIST_DIR}
cp -r ${MDANSE_TEMPORARY_INSTALLATION_DIR}/lib/python2.7/site-packages/MDANSE ${DEBIAN_DIST_DIR}
53 54 55 56 57 58

# Compute the Installed-Size field for the debian package
instSize=$(du ${DEBIAN_ROOT_DIR} -b -s | cut -f1)
sed -i "s/Installed-Size:.*/Installed-Size: $((1+(instSize/1024)))/g" ${DEBIAN_ROOT_DIR}/DEBIAN/control

export TMPDIR=.
59
fakeroot dpkg-deb -b ${DEBIAN_ROOT_DIR} ${MDANSE_SOURCE_DIR}/MDANSE-${VERSION_NAME}-${DISTRO}-${ARCH}.deb
60 61 62 63 64
status=$?
if [ $status -ne 0 ]; then
	echo -e "${RED}" "Cannot build app.""${NORMAL}"
	exit $status
fi
Remi Perenon's avatar
Remi Perenon committed
65

66
rm -rf ${MDANSE_TEMPORARY_INSTALLATION_DIR}