Permalink
Browse files

Simplify the creation of the deb packages.

  • Loading branch information...
1 parent db2a982 commit f868a47fe162ad3c9081a0cfb93e5019909be58b @SokoloffA SokoloffA committed Feb 4, 2012
View
@@ -1,20 +1,5 @@
This script will help you to build the binary or source DEB packages.
USAGE
-makeDeb.sh [otions] <path-to-source>
-
-Options
- -h|--help display this message
- -o|--outdirt=DIR write result to DIR
- -d|--dist=DIST buld for distributive ubuntu/debian
- -r|--release=RELEASES release name, you can specify several releases - "maveric natty oneiric"
- -ver=VERSION razor version
- -s|--sign sign a result files
- -b|--binary build a binary package, if ommited build only only a source package
-
-EXAMPLES
- Build the binary debs.
- ~/razor_src/distr/deb/makeDeb.sh -d ubuntu -r oneiric -o ./Ubuntu ~/razor_src/
-
- Build the source DEB for several releases.
- ~/razor_src/distr/deb/makeDeb.sh -b -d ubuntu -r "oneiric natty" -o ./Ubuntu ~/razor_src/
+ Just run the script. Deb packages can be found in the ~/razorqt_{VER}_deb directory.
+ See 'makeDeb.sh --help' for more information on an options.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -1,22 +1,24 @@
#!/bin/bash
function help {
- echo "Usage: makeDeb.sh [otions] <path-to-source>"
- echo
- echo "Options"
- echo " -h|--help display this message"
- echo " -o|--outdirt=DIR write result to DIR"
- echo " -d|--dist=DIST buld for distributive ubuntu/debian"
- echo " -r|--release=RELEASES release name, you can specify several releases - \"maveric oneiric\""
- echo " -ver=VERSION razor version"
- echo " -s|--sign sign a result files"
- echo " -b|--binary build a binary package, if ommited build only only a source package"
+ cat << HELP_TEXT
+Usage: makeDeb.sh [otions] <path-to-source>
+
+Options
+ -h|--help display this message
+ -o|--outdirt=DIR write result to DIR, home directory by default
+ -r|--release=RELEASE release name (sid, maveric, natty etc.), autodetect if ommited
+ -ver=VERSION razor version
+ -S|--sign sign a result files
+ -s|--source build a source package, if ommited build a binary package
+HELP_TEXT
}
NAME='razorqt'
-TYPE='-S'
+TYPE='-b'
SIGN='-uc -us'
-OUT_DIR='./'
+DEST_DIR=${HOME}
+SRC_DIR="../.."
while [ $# -gt 0 ]; do
case $1 in
@@ -36,7 +38,7 @@ while [ $# -gt 0 ]; do
;;
-r|--release)
- RELEASES=$2
+ RELEASE=$2
shift 2
;;
@@ -45,15 +47,16 @@ while [ $# -gt 0 ]; do
shift 2
;;
- -b|--binary)
- TYPE='-b'
+ -s|--source)
+ TYPE='-S'
shift
;;
- -s|--sign)
+ -S|--sign)
SIGN=''
shift
;;
+
--)
shift
break
@@ -74,43 +77,40 @@ if [ -z "${SRC_DIR}" ]; then
exit 2
fi
+SRC_DIR=`cd ${SRC_DIR}; pwd`
-if [ -z "${DIST}" ]; then
- echo "missing dist option"
- help
- exit 2
+if [ -z "${RELEASE}" ]; then
+ RELEASE=`awk -F"=" '/DISTRIB_CODENAME=/ {print($2)}' /etc/lsb-release`
fi
-
-if [ -z "${RELEASES}" ]; then
+if [ -z "${RELEASE}" ]; then
echo "missing release option"
help
exit 2
fi
-if [ ! -d ${OUT_DIR} ]; then
- echo "${OUT_DIR}: No such directory"
+if [ ! -d ${DEST_DIR} ]; then
+ echo "${DEST_DIR}: No such directory"
exit 2
fi
-OUT_DIR=`cd ${OUT_DIR}; pwd`
-
-
-
if [ -z "$VER" ]; then
MAJOR_VER=`awk -F'[)( ]' '/set\s*\(MAJOR_VERSION / {print($3)}' ${SRC_DIR}/CMakeLists.txt`
MINOR_VER=`awk -F'[)( ]' '/set\s*\(MINOR_VERSION / {print($3)}' ${SRC_DIR}/CMakeLists.txt`
PATCH_VER=`awk -F'[)( ]' '/set\s*\(PATCH_VERSION / {print($3)}' ${SRC_DIR}/CMakeLists.txt`
VER="${MAJOR_VER}.${MINOR_VER}.${PATCH_VER}"
fi
+OUT_DIR=`cd ${DEST_DIR}; pwd`/razorqt_${VER}_deb
+
+
echo "*******************************"
echo " Name: ${NAME}"
echo " Ver: ${VER}"
[ "${TYPE}" = "-b" ] && echo " Type: binary"
[ "${TYPE}" = "-S" ] && echo " Type: source"
-echo " Release: ${DIST}:: ${RELEASES}"
+echo " Release: ${RELEASE}"
echo " Src dir: ${SRC_DIR}"
echo " Out dir: ${OUT_DIR}"
echo "*******************************"
@@ -125,54 +125,45 @@ cp -r ${SRC_DIR} ${DIR}
rm -rf ${DIR}/.git \
${DIR}/build
-cd ${DIR}/.. && tar -czf ${NAME}_${VER}.orig.tar.gz ${NAME}-${VER}
-
-for RELEASE in ${RELEASES}; do
- rm -r ${DIR}/debian
- cp --force -R ${DIR}/distr/deb/$DIST/debian ${DIR}/
-
- DATE=`date -R`
- for f in `find ${DIR}/debian -type f `; do
- sed -i \
- -e"s/%NAME%/${NAME}/g" \
- -e"s/%VERSION%/${VER}/g" \
- -e"s/%DIST%/${RELEASE}/g" \
- -e"s/%DATE%/${DATE}/g" \
- $f
- done
-
- cd ${DIR} && debuild ${TYPE} ${SIGN} -rfakeroot
- RES=$?
+cd ${DIR}/.. && tar czf ${NAME}_${VER}.orig.tar.gz ${NAME}-${VER}
+cp --force -R ${DIR}/distr/deb/debian ${DIR}/
+
+DATE=`date -R`
+for f in `find ${DIR}/debian -type f `; do
+ sed -i \
+ -e"s/%NAME%/${NAME}/g" \
+ -e"s/%VERSION%/${VER}/g" \
+ -e"s/%DIST%/${RELEASE}/g" \
+ -e"s/%DATE%/${DATE}/g" \
+ $f
+done
+cd ${DIR} && debuild ${TYPE} ${SIGN} -rfakeroot
- if [ $RES -ne 0 ]; then
- exit $RES
- fi
+echo "................................."
+echo "Check files:"
+PKGS=`awk '/Package:/ {print $2}' ${DIR}/debian/control`
- echo "................................."
- echo "Check files:"
- PKGS=`awk '/Package:/ {print $2}' ${DIR}/debian/control`
+for file in `find ${DIR}/debian/tmp -type f 2>/dev/null`; do
+ file=`echo $file | sed -e"s|${DIR}/debian/tmp||"`
+ #echo $file
+ pkgNames=''
+ let 'pkgCount=0'
- for file in `find ${DIR}/debian/tmp -type f 2>/dev/null`; do
- file=`echo $file | sed -e"s|${DIR}/debian/tmp||"`
- #echo $file
- pkgNames=''
- let 'pkgCount=0'
+ for pkg in ${PKGS}; do
+ if [ `ls "${DIR}/debian/${pkg}$file" 2>/dev/null` ]; then
+ let 'pkgCount++'
+ pkgNames="${pkgNames}\n\t${pkg}"
+ fi
+ done
- for pkg in ${PKGS}; do
- if [ `ls "${DIR}/debian/${pkg}$file" 2>/dev/null` ]; then
- let 'pkgCount++'
- pkgNames="${pkgNames}\n\t${pkg}"
- fi
- done
+ if [ $pkgCount -eq 0 ]; then
+ echo -e "Missing file: ${file}";
- if [ $pkgCount -eq 0 ]; then
- echo -e "Missing file: ${file}";
+ elif [ $pkgCount -gt 1 ]; then
+ echo -e "Douplicates: ${file}$pkgNames"
+ fi
- elif [ $pkgCount -gt 1 ]; then
- echo -e "Douplicates: ${file}$pkgNames"
- fi
- done
done

0 comments on commit f868a47

Please sign in to comment.