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"
78 if test "${SUDO_USER}"; then
79 if test ! -d deb-src; then
83 if test -d deb-src; then
85 if test $? -ne 0; then
86 echo "deb-src could not be removed. Remove deb-src manually"
100 if test -z "$PKG"; then
101 echo "Specify .dsc file"
104 if test ! -e "$PKG"; then
105 echo "${PKG} does not exist"
108 if test -z "$PRODUCT"; then
109 PRODUCT=`echo *.dsc|sed 's/_.*//g'`
112 if grep "Architecture: all" $PKG >/dev/null; then
117 echo "Dsc $PKG . Product $PRODUCT"
118 echo "Ubuntu distros: $UBUNTU_DIST"
119 echo "Debian distros: $DEBIAN_DIST"
120 if test "${SUDO_USER}"; then
121 echo "Running as sudo."
122 echo "Tip: You can avoid it by adding the following in /etc/sudoers"
123 echo "${SUDO_USER} ALL=NOPASSWD: ${ID_DEB_BUILD}/id-pbuild-root.sh"
124 HOME_EXPORT=/home/${SUDO_USER}
129 if test ! -f ${HOME_EXPORT}/.pbuilderrc; then
130 echo "${HOME_EXPORT}/.pbuilderrc missing"
135 for dist in ${UBUNTU_DIST}; do
136 scp ${dist}-*/* ftp.indexdata.dk:/home/ftp/pub/${PRODUCT}/ubuntu/${dist}
138 for dist in ${DEBIAN_DIST}; do
139 scp ${dist}-*/* ftp.indexdata.dk:/home/ftp/pub/${PRODUCT}/debian/${dist}
142 echo "===================================================="
143 echo "Remember to update APT on ftp.indexdata.dk !!!"
145 echo "ssh ftp.indexdata.dk"
146 echo "cd ~/proj/git-tools/update-archive"
148 echo "./update-archive.sh"
149 echo "===================================================="
154 # call our privileged wrapper to clean the directories, no --dsc option
155 for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
156 for arch in ${USE_ARCHS}; do
157 sudo -n $PBUILDROOT --home=${HOME_EXPORT} --dist=$dist --arch=$arch
158 if test $? -ne 0; then
160 echo "Run id-pbuild.sh using sudo or add yourself to /etc/sudoers:"
161 echo "${USER} ALL=NOPASSWD: ${ID_DEB_BUILD}/id-pbuild-root.sh"
167 # call our privileged wrapper to do the real work, with --dsc option
170 for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
171 for arch in ${USE_ARCHS}; do
172 sudo -n $PBUILDROOT --home=${HOME_EXPORT} \
173 --dist=$dist --arch=$arch --dsc=$PKG >${dist}-${arch}.log 2>&1 &
175 if test $i -eq $concurrency; then
178 if test -f ${dist}-${arch}/*.dsc; then
181 echo "FAILED: No .dsc file for ${dist}-${arch}"
188 for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
189 for arch in ${USE_ARCHS}; do
190 if test -f ${dist}-${arch}/*.dsc; then
193 echo "FAILED: No .dsc file for ${dist}-${arch}"