5 echo "usage: mconfigure [options] <package>"
9 echo " -p : pack default: do all"
10 echo " -o : support old Debian 7 format"
13 function check_unversioned {
14 # has to be called in the projects base directory
15 # result: "M" in stdout or nothing
18 # check if build is running in a sandbox
19 if ! [ -f .cm.ignore ]
22 echo ".cm.ignore" > .cm.ignore
23 echo "debian.*" >> .cm.ignore
24 echo "up.*" >> .cm.ignore
28 project=${project##*/}
30 mCM $project -b -an > /dev/null
31 wc=$(wc $project.batch)
33 if [ "${wc:0:5}" != "0 0 0" ]
47 build="$build$(check_unversioned)"
50 tag=$(git describe --tags --match "${paket}_*" 2>/dev/null) || true
55 changes=$(check_unversioned)
58 version=${version##*_}
61 echo "No configuration system found. Cannot determine version."
66 function check_version {
69 vline=$(head -1 debian/$paket.changelog)
72 if [ $version = "0.0" ]
78 # do no check on a modified git repos
79 if [ "${build: -1}" == "M" ]
84 if [ "$clversion" != $version ]
86 echo "version mismatch: git: $version, changelog: $clversion"
93 echo "run mconfigure in the project base directory with a debian directory in it!"
100 while getopts "a:cdpo" opt; do
112 \?) echo "Invalid option: -$OPTARG"
116 :) echo "Option -$OPTARG requires an argument."
132 # if nothing is selected, select all
133 if [ $configure -eq 0 -a $compile -eq 0 -a $pack -eq 0 ]
140 if [ $configure -eq 1 ]
142 # delete changelog and control
143 rm debian/changelog debian/control 2>/dev/null || true
145 # mconfigure builds 2 environment files: setenv.sh + rules.pre
151 dpkg-architecture $arch_opt > debian/setenv.sh
152 echo "" > debian/rules.pre
154 echo "paket=$paket" >> debian/setenv.sh
155 echo "oldpack=\"$oldpack\"" >> debian/setenv.sh
159 echo "version=$version" >> debian/setenv.sh
160 echo "build=$build" >> debian/setenv.sh
162 # get repository name
166 # echo "pwd=$pwd" >> debian/rules.pre
168 echo "building $paket with build $version-$build"
170 pushd debian >/dev/null
171 # ./debian -------------------------------------
173 ln -sf /usr/share/mbuild/rules .
180 # check for pre/post installation scripts
181 if [ -f $paket.preinst ]
183 echo "add_inst_tgt += debian/tmp/DEBIAN/preinst" >> rules.pre
185 if [ -f $paket.postinst ]
187 echo "add_inst_tgt += debian/tmp/DEBIAN/postinst" >> rules.pre
189 if [ -f $paket.prerm ]
191 echo "add_inst_tgt += debian/tmp/DEBIAN/prerm" >> rules.pre
193 if [ -f $paket.postrm ]
195 echo "add_inst_tgt += debian/tmp/DEBIAN/postrm" >> rules.pre
200 # add export to setenv.sh
201 sed -i "s/^/export /" setenv.sh
204 # ./. ---------------------------------------------
206 # copy package control
207 if [ -f debian/$paket.control ]
212 echo "warning: control file not found"
213 echo " this file is necessary for any package production."
217 if [ -x debian/$paket.prepare ]
220 debian/$paket.prepare
222 if [ -e debian/$paket.build ]
229 if grep -- "-prepare" debian/$paket.build >/dev/null
232 debian/$paket.build -prepare
239 if [ -x debian/$paket.prebuild ]
241 pushd ~/build >/dev/null
242 debian/$paket.prebuild
248 if [ -f debian/$paket.cp -a -f debian/$paket.control ]
250 echo "PACK=binary" >> debian/rules.pre
251 if grep "^Architecture: *all" debian/$paket.control >/dev/null
253 echo "arch = all" >> debian/rules.pre
254 echo "BINARY_INDEP = copy ../${paket}_$version-${build}_all.deb" >> debian/rules.pre
256 echo 'arch = ${DEB_HOST_ARCH}' >> debian/rules.pre
257 echo "BINARY_ARCH = copy ../${paket}_$version-${build}_"'$(arch).deb' >> debian/rules.pre
259 elif [ -f debian/$paket.cp ]
261 echo "PACK=zip" >> debian/rules.pre
263 echo "PACK=version" >> debian/rules.pre
267 if [ $compile -eq 1 -a ! -e debian/$paket.build ]
269 echo "no debian/$paket.build: skipping build step"
272 if [ $compile -eq 1 ]