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
19 project=${project##*/}
21 mCM $project -b -an > /dev/null
22 wc=$(wc $project.batch)
24 if [ "${wc:0:5}" != "0 0 0" ]
38 build="$build$(check_unversioned)"
41 tag=$(git describe --tags --match "${paket}_*" 2>/dev/null) || true
46 changes=$(check_unversioned)
49 version=${version##*_}
52 echo "No configuration system found. Cannot determine version."
57 function check_version {
60 vline=$(head -1 debian/$paket.changelog)
63 if [ $version = "0.0" ]
69 # do no check on a modified git repos
70 if [ "${build: -1}" == "M" ]
75 if [ "$clversion" != $version ]
77 echo "version mismatch: git: $version, changelog: $clversion"
84 echo "run mconfigure in the project base directory with a debian directory in it!"
91 while getopts "a:cdpo" opt; do
103 \?) echo "Invalid option: -$OPTARG"
107 :) echo "Option -$OPTARG requires an argument."
123 # if nothing is selected, select all
124 if [ $configure -eq 0 -a $compile -eq 0 -a $pack -eq 0 ]
131 if [ $configure -eq 1 ]
133 # delete changelog and control
134 rm debian/changelog debian/control 2>/dev/null || true
136 # mconfigure builds 2 environment files: setenv.sh + rules.pre
142 dpkg-architecture $arch_opt > debian/setenv.sh
143 echo "" > debian/rules.pre
145 echo "paket=$paket" >> debian/setenv.sh
146 echo "oldpack=\"$oldpack\"" >> debian/setenv.sh
150 echo "version=$version" >> debian/setenv.sh
151 echo "build=$build" >> debian/setenv.sh
153 # get repository name
157 # echo "pwd=$pwd" >> debian/rules.pre
159 echo "building $paket with build $version-$build"
161 pushd debian >/dev/null
162 # ./debian -------------------------------------
164 ln -sf /usr/share/mbuild/rules .
171 # check for pre/post installation scripts
172 if [ -f $paket.preinst ]
174 echo "add_inst_tgt += debian/tmp/DEBIAN/preinst" >> rules.pre
176 if [ -f $paket.postinst ]
178 echo "add_inst_tgt += debian/tmp/DEBIAN/postinst" >> rules.pre
180 if [ -f $paket.prerm ]
182 echo "add_inst_tgt += debian/tmp/DEBIAN/prerm" >> rules.pre
184 if [ -f $paket.postrm ]
186 echo "add_inst_tgt += debian/tmp/DEBIAN/postrm" >> rules.pre
191 # add export to setenv.sh
192 sed -i "s/^/export /" setenv.sh
195 # ./. ---------------------------------------------
197 # copy package control
198 if [ -f debian/$paket.control ]
203 echo "warning: control file not found"
204 echo " this file is necessary for any package production."
208 if [ -x debian/$paket.prepare ]
210 debian/$paket.prepare
212 if [ -e debian/$paket.build ]
219 if grep -- "-prepare" debian/$paket.build >/dev/null
222 debian/$paket.build -prepare
229 if [ -x debian/$paket.prebuild ]
231 pushd ~/build >/dev/null
232 debian/$paket.prebuild
238 if [ -f debian/$paket.cp -a -f debian/$paket.control ]
240 echo "PACK=binary" >> debian/rules.pre
241 if grep "^Architecture: *all" debian/$paket.control >/dev/null
243 echo "arch = all" >> debian/rules.pre
244 echo "BINARY_INDEP = copy ../${paket}_$version-${build}_all.deb" >> debian/rules.pre
246 echo 'arch = ${DEB_HOST_ARCH}' >> debian/rules.pre
247 echo "BINARY_ARCH = copy ../${paket}_$version-${build}_"'$(arch).deb' >> debian/rules.pre
249 elif [ -f debian/$paket.cp ]
251 echo "PACK=zip" >> debian/rules.pre
253 echo "PACK=version" >> debian/rules.pre
257 if [ $compile -eq 1 -a ! -e debian/$paket.build ]
259 echo "no debian/$paket.build: skipping build step"
262 if [ $compile -eq 1 ]