summaryrefslogtreecommitdiffstats
path: root/packaging/dpkg/builddebianpackage
blob: 72472e59e89b61a8281e131e3e2d7f80a85f07d5 (plain) (blame)
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
#!/bin/sh
#
# This script transforms the openslx project files to debians
# binary package format .deb

dpkg_deb=`which dpkg-deb`
if [ -z "$dpkg_deb" ];then 
    echo "You need the program dpkg-deb (contained in package dpkg) to build a debian package"
    exit
fi

# import default paths for debian installation
 . ./debianpaths

# change into folder where we expect the Makefile:
cd $(dirname $(readlink -f $0))/../..
if [ ! -e ./Makefile ]; then
    echo "There is no makefile in this programs directory (`pwd`)."
    echo "Please run this script only embedded in the context of an openslx checkout."
    exit
fi

export SLX_BUILD_PATH=/tmp/slx$$
mkdir -p $SLX_BUILD_PATH
# "make install" will install the slx software into $SLX_BUILD_PATH
if make plain-install; then
  #Create Temporary working directory
  mkdir -p $SLX_BUILD_PATH/DEBIAN
  cp packaging/dpkg/default_files/control  $SLX_BUILD_PATH/DEBIAN/
  cp packaging/dpkg/default_files/pre*     $SLX_BUILD_PATH/DEBIAN/
  cp packaging/dpkg/default_files/post*    $SLX_BUILD_PATH/DEBIAN/

  . ./VERSIONS

  OPENSLX_VERSION_SVNREV=$(svnversion .)


  sed -i -e "4r./packaging/dpkg/debianpaths" \
         $SLX_BUILD_PATH/DEBIAN/postinst

  #update control file
  sed -i -e "s/##version##/$OPENSLX_VERSION_STRING/" \
         -e "s/##size##/$(du -s $SLX_BUILD_PATH | awk '{print $1}')/" \
         $SLX_BUILD_PATH/DEBIAN/control

  #Set permissions
  find $SLX_BUILD_PATH -type d|xargs chmod 755

  #Create the package
  dpkg-deb --build $SLX_BUILD_PATH > /dev/null
  cd packaging/dpkg
  mv $SLX_BUILD_PATH.deb openslx_$OPENSLX_VERSION_STRING.deb
  echo "Written 'openslx_$OPENSLX_VERSION_STRING.deb':"
  ls -lh openslx_$OPENSLX_VERSION_STRING.deb
fi
#Clean up
#rm -rf $SLX_BUILD_PATH