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
97 if test -z "$PKG"; then
98 echo "Specify .dsc file"
101 if test ! -e "$PKG"; then
102 echo "${PKG} does not exist"
105 if test -z "$PRODUCT"; then
106 PRODUCT=`echo *.dsc|sed 's/_.*//g'`
109 if grep "Architecture: all" $PKG >/dev/null; then
114 echo "Dsc $PKG . Product $PRODUCT"
115 echo "Ubuntu distros: $UBUNTU_DIST"
116 echo "Debian distros: $DEBIAN_DIST"
117 if test "${SUDO_USER}"; then
118 echo "Running as sudo."
119 echo "You can avoid it by adding the following in /etc/sudoers"
120 echo "${SUDO_USER} ALL=NOPASSWD: ${ID_DEB_BUILD}/id-pbuild-root.sh"
121 HOME_EXPORT=/home/${SUDO_USER}
125 if test ! -f ${HOME_EXPORT}/.pbuilderrc; then
126 echo "${HOME_EXPORT}/.pbuilderrc missing"
131 for dist in ${UBUNTU_DIST}; do
132 scp ${dist}-*/* ftp.indexdata.dk:/home/ftp/pub/${PRODUCT}/ubuntu/${dist}
134 for dist in ${DEBIAN_DIST}; do
135 scp ${dist}-*/* ftp.indexdata.dk:/home/ftp/pub/${PRODUCT}/debian/${dist}
138 echo "===================================================="
139 echo "Remember to update APT on ftp.indexdata.dk !!!"
141 echo "ssh ftp.indexdata.dk"
142 echo "cd ~/proj/git-tools/update-archive"
144 echo "./update-archive.sh"
145 echo "===================================================="
150 # call our privileged wrapper to clean the directories, no --dsc option
151 for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
152 for arch in ${USE_ARCHS}; do
153 sudo -n $PBUILDROOT --home=${HOME_EXPORT} --dist=$dist --arch=$arch
157 # call our privileged wrapper to do the real work, with --dsc option
160 for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
161 for arch in ${USE_ARCHS}; do
162 sudo -n $PBUILDROOT --home=${HOME_EXPORT} \
163 --dist=$dist --arch=$arch --dsc=$PKG >${dist}-${arch}.log 2>&1 &
165 if test $i -eq $concurrency; then
168 if test -f ${dist}-${arch}/*.dsc; then
171 echo "No .dsc file for ${dist}-${arch}"
178 for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
179 for arch in ${USE_ARCHS}; do
180 if test -f ${dist}-${arch}/*.dsc; then
183 echo "No .dsc file for ${dist}-${arch}"