X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fdh-make-gosa;h=fe36fe41b9abd206ea6d6dd5af2bc62b254df5cc;hb=37641869264025f1a977b56703fb3ec1fbe1c7d8;hp=0c0e2290d8771db3b6e30ead3366541f991eeaef;hpb=cd251cc6db7bcd7da76523a7c43e501cec5df96f;p=gosa.git diff --git a/gosa-core/dh-make-gosa b/gosa-core/dh-make-gosa index 0c0e2290d..fe36fe41b 100755 --- a/gosa-core/dh-make-gosa +++ b/gosa-core/dh-make-gosa @@ -1,26 +1,13 @@ -#!/bin/sh - -# file plugin.tgz -# dir plugin -# --download -# --branch | -b -# --email | -e EMAIL -# --depends DEPENDS -# -# DEBFULLNAME - get the real name of the maintainer -# -# LOGNAME or USER - get the username -# -# DEBEMAIL or EMAIL - get the email address of the user +#!/bin/bash usage() { - echo "Usage: " >&2 + echo "Usage: ${0##*/} [--download] [-b|--branch branch] [-e|--email mail] [--depends] plugin-dir|plugin.tar.gz" >&2 exit 1 } load_dsc() { - if [[ -r "$1" ]]; then + if [ -r "$1" ]; then PL_NAME=$(sed -n 's/"//g;s/^name\s*=\s*\(.*\)$/\1/p' "$1") PL_VERSION=$(sed -n 's/"//g;s/^version\s*=\s*\(.*\)$/\1/p' "$1") TDEPENDS=$(sed -n 's/"//g;s/^depends\s*=\s*\(.*\)$/\1/p' "$1") @@ -38,7 +25,7 @@ load_dsc() { TEMP=`getopt -o e:r: --long download,release:,email:,depends: -n 'dh-make-gosa' -- "$@"` -if [[ $? != 0 ]] ; then +if [ $? != 0 ] ; then echo "Error: cannot get command line information" >&2 exit 1 fi @@ -49,14 +36,14 @@ eval set -- "$TEMP" RELEASE=trunk DOWNLOAD= DEPENDS= -DEST=/tmp/ +DEST= while true; do case "$1" in -e|--email) DEBMAIL=$2 shift 2 ;; -r|--release) - if [[ "$2" != "trunk" ]]; then + if [ "$2" != "trunk" ]; then RELEASE=tags/$2 fi shift 2 @@ -78,36 +65,55 @@ while true; do esac done -[[ $# -ne 1 ]] && usage +[ $# -ne 1 ] && usage file=$* # Three possiblities -if [[ -d "$file" ]]; then +if [ -d "$file" ]; then # It's a local directory load_dsc $file/plugin.dsc + # Setup build environment BUILD_PATH=${DEST}gosa-plugin-${PL_NAME}-${PL_VERSION} - if [[ -d "$BUILD_PATH" ]]; then + if [ -d "$BUILD_PATH" ]; then echo "Error: build path $BUILD_PATH already exists" >&2 exit 2 fi cp -a "$PL_NAME" "$BUILD_PATH" -elif [[ -f "$file" ]]; then +elif [ -f "$file" ]; then # It's a compressed user contributed file - echo not implemented - exit 5 + TMPDIR="/tmp/dh-make-gosa-$PPID" + if [ -d "/tmp/dh-make-gosa-$PPID" ]; then + echo "Error: directory $TMPDIR exists" >&2 + exit 4 + fi + + # Untar + mkdir -p "$TMPDIR" + tar --extract --directory "$TMPDIR" -fz "$file" &> /dev/null + if [ $? -ne 0 ]; then + echo "Error: cannot extract plugin file - invalid file format" >&2 + exit 5 + fi + + # It's a local directory + load_dsc TMPDIR/*/plugin.dsc + + # Setup build environment + BUILD_PATH=${DEST}gosa-plugin-${PL_NAME}-${PL_VERSION} + mv "$TMPDIR/*" "$BUILD_PATH" else - # It's a plugin name to be downloaded - echo not implemented + echo "Error: cannot find plugin $file" >&2 exit 5 fi + PL_DEPENDS=$(echo $PL_DEPENDS$DEPENDS | sed 's/,\s*$//') echo "Debian package summary ========================================" echo "Plugin: $PL_NAME" @@ -118,7 +124,7 @@ echo "Author name: $PL_AUTHOR" echo "Author email: $PL_MAIL" echo read -s -n 1 -p "Do you want to continue? (y/n)" ans; echo -[[ "$ans" != "y" ]] && exit 0 +[ "$ans" != "y" ] && exit 0 pushd . &> /dev/null @@ -126,16 +132,17 @@ cd "$BUILD_PATH" # Use gosa-plugin skelleton echo "Calling dh_make..." -echo | dh_make -e "$PL_MAIL" -c gpl -s -n -f gosa-plugin-${PL_NAME}-${PL_VERSION}.tar.gz # &> /dev/null -if [[ $? -ne 0 ]]; then +echo | dh_make -e "$PL_MAIL" -c gpl -s -n -f gosa-plugin-${PL_NAME}-${PL_VERSION}.tar.gz &> /dev/null +if [ $? -ne 0 ]; then echo "Failed to call dh_make - aborting!" exit 1 fi echo "Apdapting debian descriptive files..." + # Generate install file for dir in admin personal addons; do - [[ -d $dir ]] && echo -e "$dir\t\t\t/usr/share/gosa/plugins" > debian/install + [ -d $dir ] && echo -e "$dir\t\t\t/usr/share/gosa/plugins" > debian/install done for dir in help/*; do echo -e "$dir\t\t\t/usr/share/gosa/plugins/$PL_NAME" >> debian/install @@ -147,6 +154,16 @@ done # Generate dirs echo "usr/share/gosa" > debian/dirs +# If we've a contrib directory include it to the docs +if [ -d contrib ]; then + echo "contrib /usr/share/doc/gosa-plugin-$PL_NAME" >> debian/install +fi +if [ -d html ]; then + for i in html/*; do + echo "$i /usr/share/gosa/html/plugins/$PL_NAME" >> debian/install + done +fi + # Adapt control sed -i 's/^Section: unknown/Section: web/g' debian/control sed -i 's/^Depends: .*$/Depends: gosa/g' debian/control @@ -179,7 +196,7 @@ sed 's!#DEBHELPER#!#DEBHELPER#\ # Get apache versions running\ servers=""\ for srv in apache apache-ssl apache2; do\ - if [[ -x /usr/sbin/$srv ]]; then\ + if [ -x /usr/sbin/$srv ]; then\ servers="$srv $servers"\ fi\ done\ @@ -189,7 +206,7 @@ done\ \ # Finally restart servers\ for server in $servers; do\ - if [[ -x /usr/sbin/invoke-rc.d ]]; then\ + if [ -x /usr/sbin/invoke-rc.d ]; then\ invoke-rc.d $server restart\ else\ /etc/init.d/$server restart\