All pastes #1483408 Raw Edit

salvador

public text v1 · immutable
#1483408 ·published 2009-07-03 21:54 UTC
rendered paste body
#!/bin/bash## Copyright 2004 Todd Kulesza## The Dropline GNOME Installation System is free software.# You can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This software is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA## ${DLG_ROOT} should be the root directory of the Dropline Build System.# This only needs to be set if you try to run ./build from outside of# the root directory.#DLG_ROOT=/usr/src/dropline-build-systemexport DLG_ROOT=${DLG_ROOT:-`pwd`}. ${DLG_ROOT}/SCRIPTS/dropline-header. ${DLG_ROOT}/configshow_usage (){    echo "Usage:"    echo " $0 <packages>"    echo " $0 -meta <meta-package>"    echo ""    echo "Note: Package definitions in the SCRIPTS-\$DLG_OTHERVERSION directory"    echo "will only be used if the environment variable DLG_OTHERVERSION is"    echo "actually set to something non-null."    die}if [ -z "$1" ]; then    show_usagefibuild_package () {    if [ $# != "1" ]; then      return    fi    NAME=${1}    if [ -n "$DLG_OTHERVERSION" -a -d $DLG_SCRIPTDIR-$DLG_OTHERVERSION/$NAME ]; then      echo "*** ALPHA TESTER MODE ENABLED ***"      DESC="$DLG_SCRIPTDIR-$DLG_OTHERVERSION/$NAME/desc"        BUILD="$DLG_SCRIPTDIR-$DLG_OTHERVERSION/$NAME/build"      else      DESC="${DLG_SCRIPTDIR}/${NAME}/desc"      BUILD="${DLG_SCRIPTDIR}/${NAME}/build"    fi        export DLG_SCRIPTDIR    export DLG_SRCDIR    if [ ! -e ${DLG_SCRIPTDIR}/${NAME} ]; then      echo "Build script directory for ${NAME} not found on the main tree. Searching Dropline extras"            if [ -e ${DLG_EXTRASCRIPTDIR}/${NAME} ]; then        echo "Build script directory for ${NAME} found on Dropline extras"        export DLG_SRCDIR="$DLG_EXTRASRCDIR"        export DLG_SCRIPTDIR="$DLG_EXTRASCRIPTDIR"        DESC="${DLG_SCRIPTDIR}/${NAME}/desc"        BUILD="${DLG_SCRIPTDIR}/${NAME}/build"              elif [ -e ${DLG_CONTRIBSCRIPTDIR}/${NAME} ]; then        echo "Build script directory ${NAME} found on Contrib extras"        export DLG_SRCDIR="$DLG_CONTRIBSRCDIR"        export DLG_SCRIPTDIR="$DLG_CONTRIBSCRIPTDIR"        DESC="${DLG_SCRIPTDIR}/${NAME}/desc"        BUILD="${DLG_SCRIPTDIR}/${NAME}/build"              else        echo "You don't seem to have a build script directory for ${NAME}."        echo -n "Would you like me to create a build script for you? (Y/n)? "        read template_answer        template_answer=$(echo $template_answer | tr [A-Z] [a-z])        if [ "$template_answer" == "n" ]; then          echo "Aborting execution"          exit 0        else          ${DLG_ROOT}/new-build-script.sh ${NAME} || die "Something went wrong."        fi              fi     fi    if [ ! -e ${DESC} ]; then      die "Error: Could not find desc file for ${NAME} on ${DESC}."    fi    if [[ ! -e ${BUILD} && ! -e ${BUILD}.user ]]; then      die "Error: Could not find a build file for ${NAME} on ${BUILD}."    fi    if [ -f ${BUILD}.user ]; then      VERSION="$(grep ^VERSION= ${BUILD}.user | cut -d"=" -f2)"      echo "Using user's build script for package $NAME"            REVISION="$(grep ^REVISION= ${BUILD} | cut -d"=" -f2 | cut -d"\"" -f2)"      ls /var/log/packages/${NAME}-${VERSION}-*-${REVISION}* 2> /dev/null 1>&2      ALREADY_INSTALLED="$?"      if [[ $ALREADY_INSTALLED == 0 && "$META_BUILD" == "YES" ]] ; then        echo "It seems you already have the package ${NAME} version ${VERSION}-${REVISION} installed."        echo -n "Do you want to rebuild? (y/N)?."        read rebuild_answer        rebuild_answer=$(echo $rebuild_answer | tr [A-Z] [a-z])      fi      if [ "$rebuild_answer" == "y" ]; then          echo "Using Dropline's build script for package $NAME"          sh ${BUILD}.user || die "Failed package $NAME"        fi      if [ "$META_BUILD" != "YES" ]; then          echo "Using Dropline's build script for package $NAME"         sh ${BUILD}.user || die "Failed package $NAME"      fi          else      VERSION="$(grep ^VERSION= ${BUILD} | cut -d"=" -f2 | cut -d"\"" -f2)"      REVISION="$(grep ^REVISION= ${BUILD} | cut -d"=" -f2 | cut -d"\"" -f2)"      ls /var/log/packages/${NAME}-${VERSION}-*-${REVISION}* 2> /dev/null 1>&2      ALREADY_INSTALLED="$?"            if [[ $ALREADY_INSTALLED == 0 && "$META_BUILD" == "YES" ]] ; then        echo "It seems you already have the package ${NAME} version ${VERSION}-${REVISION} installed."        echo -n "Do you want to rebuild? (y/N)?."        read rebuild_answer        rebuild_answer=$(echo $rebuild_answer | tr [A-Z] [a-z])      fi             if [ "$rebuild_answer" == "y" ]; then          echo "Using Dropline's build script for package $NAME"          sh ${BUILD} || die "Failed package $NAME"        fi      if [ "$META_BUILD" != "YES" ]; then          echo "Using Dropline's build script for package $NAME"         sh ${BUILD} || die "Failed package $NAME"      fi    fi}build_meta (){    if [ $# != "1" ]; then      return    fi    META=${1}    META_BUILD=YES        if [ ! -f "${DLG_METADIR}/${META}" ]; then      echo "Meta list file for ${META} not found on the main tree. Searching Dropline extras"          if [ ! -f "${DLG_EXTRAMETADIR}/${META}" ]; then        echo "Meta list file for ${META} not found on Dropline Extras. Searching Contrib extras"                if [ ! -f "${DLG_CONTRIBMETADIR}/${META}" ]; then          die "Error: Could not find list file for ${META}."        else          echo "Found meta list file for ${META} on Contrib extras."          LIST="${DLG_CONTRIBMETADIR}/${META}"        fi              else        echo "Found meta list file for ${META} on Dropline extras."        LIST="${DLG_EXTRAMETADIR}/${META}"      fi          else        LIST="${DLG_METADIR}/${META}"    fi    echo "Building meta-package $META"    for PKG in $(cat ${LIST} | grep -v "^#")    do      build_package $PKG      echo "Installing/Upgrading $PKG"      upgradepkg --reinstall --install-new \      ${DLG_PACKAGEROOT}/${NAME}-${VERSION}-*-${REVISION}*.tgz    done    echo "Finished meta-package $META"}if [[ "$1" == "-meta" || "$1" == "-m" ]]; then    build_meta $2else    for PKG in $@    do      build_package $PKG    donefi