1 #!/bin/sh
3 plugin=$1
4 TMPDIR=/tmp/dh-make-gosa.$$
6 check_plugin() {
7 [[ -r $1/manifest ]]
8 }
10 parse_manifest() {
11 pl_name=gofax
12 pl_version=1.0
13 pl_description="GOfax integration for GOsa"
14 pl_depends=
15 pl_author="Cajus Pollmeier <pollmeier@gonicus.de>"
16 }
19 ##############################################################################
20 # M A I N #
21 ##############################################################################
23 # Sanity check
24 if ! check_plugin $plugin; then
25 echo "Failed"
26 exit 1
27 fi
28 parse_manifest $plugin
30 # Create temporary copy
31 echo "Creating temporary copy of plugin '$plugin'..."
32 mkdir -p $TMPDIR
33 cp -a $plugin/* $TMPDIR
34 rm $TMPDIR/manifest
35 find $TMPDIR -name '*.svn' -type d -exec rm -rf {} \; 2> /dev/null
37 # Add debian infrastructure
38 mkdir $TMPDIR/debian
39 cat <<EOF > $TMPDIR/debian/changelog
40 gosa-plugin-$pl_name ($pl_version-1) unstable; urgency=low
42 * Initial release
44 -- $pl_author $(822-date)
45 EOF
47 echo 5 > $TMPDIR/debian/compat
49 cat <<EOF > $TMPDIR/debian/control
50 Source: gosa-plugin-$pl_name
51 Section: utils
52 Priority: optional
53 Maintainer: $pl_author
54 Standards-Version: 3.7.2.2
55 Build-Depends: debhelper(>= 4.2.32)
57 Package: gosa-plugin-$pl_name
58 Architecture: any
59 Depends: gosa-core $pl_depends
60 Suggests: gosa
61 Description: $pl_description
62 This package includes the $pl_name plugin for use with GOsa.
63 .
64 GOsa is a combination of system-administrator and end-user web
65 interface, designed to handle LDAP based setups.
66 EOF
68 cat <<EOF > $TMPDIR/debian/copyright
69 This package was debianized by $pl_author
70 on $(822-date)
72 Copyright: GPL2
74 This code is released under the terms of the GPLv2 license.
76 See /usr/share/common-licenses/GPL-2 for the full license.
77 EOF
79 dirs=$(find $TMPDIR -maxdepth 1 -type d | grep -v debian)
80 for dir in $(echo $dirs); do
81 [[ $dir == $TMPDIR ]] && continue
82 dir=$(basename $dir)
83 echo usr/share/gosa/plugins/$dir >> $TMPDIR/debian/dirs
84 echo $dir usr/share/gosa/plugins >> $TMPDIR/debian/install
85 done
87 cat <<EOF > $TMPDIR/debian/README.Debian
88 README.Debian for $pl_name
89 --------------------------
91 You need a proper LDAP/GOsa setup to make this run. More
92 text will follow later. Sorry.
94 ----
95 $pl_author $(822-date)
96 EOF
98 cat <<EOF > $TMPDIR/debian/rules
99 #!/usr/bin/make -f
100 # Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
102 # Uncomment this to turn on verbose mode.
103 #export DH_VERBOSE=1
105 build: patch
106 #********************************************************
107 #* Building plugin into a Debian/GNU Linux Package *
108 #* please stand by *
109 #********************************************************
111 clean: clean-patched unpatch
112 clean-patched:
113 dh_testdir
114 rm -f install-stamp
115 -rm -f debian/files
116 -rm -rf debian/tmp
117 -rm -f debian/substvars
118 dh_clean
120 unpatch:
121 dpatch deapply-all
122 rm -rf patch-stamp debian/patched
124 install: install-stamp
125 install-stamp:
126 dh_testdir
127 dh_testroot
128 dh_clean -k
129 dh_installdirs
131 touch install-stamp
133 patch: patch-stamp
134 patch-stamp:
135 dpatch apply-all
136 dpatch cat-all >patch-stamp
138 binary-indep: install
139 dh_testdir
140 dh_testroot
142 dh_install
143 dh_installdocs
144 dh_installcron
145 dh_installexamples
146 dh_installchangelogs
147 dh_link
148 dh_strip
149 dh_compress
150 dh_fixperms
151 dh_perl
152 dh_installdeb
153 dh_shlibdeps
155 dh_gencontrol
156 dh_md5sums
157 dh_builddeb
159 source diff:
160 @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
162 binary: binary-indep
163 .PHONY: build install clean binary-indep binary
165 binary-arch:
167 EOF
169 chmod +x $TMPDIR/debian/rules
171 (cd $TMPDIR && dpkg-buildpackage -uc -us -rfakeroot)
173 # Cleanup
174 echo "Cleaning up..."
175 #rm -rf "$TMPDIR"