From 60577d5d53a4f22a3524f7a293c8c8da66a79f10 Mon Sep 17 00:00:00 2001 From: "Siegfried-Angel Gevatter Pujals (RainCT)" Date: Sat, 27 Oct 2007 17:49:10 +0200 Subject: [PATCH] Add get-build-deps. --- get-build-deps | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100755 get-build-deps diff --git a/get-build-deps b/get-build-deps new file mode 100755 index 0000000..0ab794c --- /dev/null +++ b/get-build-deps @@ -0,0 +1,87 @@ +#!/bin/bash +# Copyright 2007 (C) Siegfried-A. Gevatter +# License: GPLv3 or later +# +# If you don't pass it any argument, this script will check if +# there's a control (debian/control) file somewhere in the current +# directory, and if it's so, it'll install the build dependencies +# listed there. +# +# If it gets a single argument, and it's the name of a file, it will +# read it, supposing that each line contains the name of a package, +# and install the build dependencies for all those. +# +# Otherwise, if there is more than one argument, or the given argument +# isn't the name of an existing file, it will suppose that the each +# argument is the name of a package, and install the dependencies for +# all of them. + +if [ $# -eq 0 ] +then + ######################################################### + # Install the dependencies for the source package the + # user is working on. + + if [ -f ../debian/control ]; then + cd .. + elif [ ! -f ./debian/control ]; then + echo "\ +Couldn't find the file debian/control. You have to be inside the \ +source directory of a Debian package or pass the name of the \ +package(s) whose build dependencies you want to install in order \ +to use this script." + exit 1 + fi + + if [ ! -x /usr/lib/pbuilder/pbuilder-satisfydepends ]; then + # The package «pbuilder» isn't installed, but it's required + # to install the build dependencies of a source package. + # Ask the user if he wants to install it automatically. + echo -n "\ +This script requires a component that's included in the «pbuilder» \ +package, which isn't currently installed, in order to install the \ +dependencies required to build the source package in the current \ +directory. + +Would you like to install pbuilder now? [y/N] " + read install_now + + if [ ! $install_now ] || ([ $install_now != 'y' ] && [ $install_now != 'Y' ]) + then + # Don't install it. Abort. + exit 1 + fi + + echo 'Installing package «pbuilder»...' + sudo aptitude install pbuilder + echo; echo + fi + + echo "Installing the build dependencies described in «`pwd`/debian/control»..." + sudo /usr/lib/pbuilder/pbuilder-satisfydepends + exit 0 +elif [ $# -eq 1 ] +then + ######################################################### + # Check if the given argument is a file name, else + # continue after the if. + if [ -f $1 ] + then + packages='' + echo "Installing the build dependencies for the following packages:" + while read line + do + echo $line + packages="$packages $line" + done < $1 + echo + sudo apt-get build-dep $packages + exit 0 + fi +fi + +######################################################### +# All arguments should be package names, install +# their build dependencies. + +sudo apt-get build-dep $*