2 # This script builds Debian packages for one or more distributions
3 # in i386/amd64 architectures. It uses pbuilder. pbuilder requires root
4 # privilege and so this script should be invoked with sudo.
9 Usage: id-pbuild.sh [OPTIONS]
20 # things that might be set by options
25 if test -f IDMETA; then
28 while test $# -gt 0; do
30 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
57 if test "$do_help" = "yes"; then
62 ID_DEB_BUILD=`cd $D0; pwd`
63 PBUILDROOT=${ID_DEB_BUILD}/id-pbuild-root.sh
64 if test ! -x $PBUILDROOT; then
65 echo "$PBUILDROOT not found"
69 MKDEBSRC=${ID_DEB_BUILD}/id-mk-deb-src.sh
70 if test ! -x $MKDEBSRC; then
71 echo "$MKDEBSRC not found"
75 if test -d deb-src; then
81 if test -d deb-src; then
90 if test -z "$PKG"; then
91 echo "Specify .dsc file"
94 if test ! -e "$PKG"; then
95 echo "${PKG} does not exist"
98 if test -z "$PRODUCT"; then
99 PRODUCT=`echo *.dsc|sed 's/_.*//g'`
102 if grep "Architecture: all" $PKG >/dev/null; then
107 echo "Dsc $PKG . Product $PRODUCT"
108 echo "Ubuntu distros: $UBUNTU_DIST"
109 echo "Debian distros: $DEBIAN_DIST"
110 if test "${SUDO_USER}"; then
111 echo "Running as sudo."
112 echo "You can avoid it by adding the following in /etc/sudoers"
113 echo "${SUDO_USER} ALL=NOPASSWD: ${ID_DEB_BUILD}/id-pbuild-root.sh"
114 HOME_EXPORT=/home/${SUDO_USER}
118 if test ! -f ${HOME_EXPORT}/.pbuilderrc; then
119 echo "${HOME_EXPORT}/.pbuilderrc missing"
124 for dist in ${UBUNTU_DIST}; do
125 scp ${dist}-*/* ftp.indexdata.dk:/home/ftp/pub/${PRODUCT}/ubuntu/${dist}
127 for dist in ${DEBIAN_DIST}; do
128 scp ${dist}-*/* ftp.indexdata.dk:/home/ftp/pub/${PRODUCT}/debian/${dist}
131 echo "===================================================="
132 echo "Remember to update APT on ftp.indexdata.dk !!!"
134 echo "ssh ftp.indexdata.dk"
135 echo "cd ~/proj/git-tools/update-archive"
137 echo "./update-archive.sh"
138 echo "===================================================="
143 # call our privileged wrapper to clean the directories, no --dsc option
144 for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
145 for arch in ${USE_ARCHS}; do
146 sudo -n $PBUILDROOT --home=${HOME_EXPORT} --dist=$dist --arch=$arch
150 # call our privileged wrapper to do the real work, with --dsc option
153 for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
154 for arch in ${USE_ARCHS}; do
155 sudo -n $PBUILDROOT --home=${HOME_EXPORT} \
156 --dist=$dist --arch=$arch --dsc=$PKG >${dist}-${arch}.log 2>&1 &
158 if test $i -eq $concurrency; then
161 if test -f ${dist}-${arch}/*.dsc; then
164 echo "No .dsc file for ${dist}-${arch}"
171 for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
172 for arch in ${USE_ARCHS}; do
173 if test -f ${dist}-${arch}/*.dsc; then
176 echo "No .dsc file for ${dist}-${arch}"