All pastes #455545 Raw Edit

Someone

public text v1 · immutable
·published 2007-04-24 07:52 UTC
rendered paste body
#!/bin/bash
# makedebs script for easy compiling and building deb packages for beryl git
#
# (c) 2006-2007 Trevio - Released under GPLv2 Terms
#
#  USAGE
#  You should simply run this script to create and your beryl git
#  tree and package it, but there are also some "advanced" tasks:
#
#    ./makedebs                   performs all the tasks (sync and package)
#    ./makedebs update            just sync the local data to remote git
#    ./makedebs build             try to build the needed items
#    ./makedebs <item>            build only the <item> (if needed)
#    ./makedebs rebuild <item>    force a rebuild of the <item>
#    ./makedebs repack <item>     force a repack of the <item>
#
#   To change the content of a package (or applying patch) you can add
#   some bash script files called "pkgxtra.sh" on each <item> dir to
#   perform extra tasks after that each package has been compiled
#
#   To Package an <item> file not included yet on the $DISTRODIR you can
#   define add an "<item>/debian" folder to your $DISTRODIR_USER (see below)
#

packager="Trevi"
packager_email="trevi55@gmail.com"
package_sufix="3v1ubuntu"

#to test settings-dump properly
export DISPLAY=""

DEFPREFIX="/usr/local"
MYPREFIX=${PREFIX:-$DEFPREFIX}
DISTRODIR="distro-specific-build-files"
DISTRODIR_USER="distro-specific-build-files-user"
PRIOPKGS="beryl-core beryl-settings-bindings beryl-plugins"
GITURL="git+ssh://maniac@git.beryl-project.org/git"
GITWEB="http://gitweb.beryl-project.org"

#for i in $(find |grep "\.git/remotes/origin"); do echo $i; perl -i -p -e 's/git./anongit./' $i; done
#sed -i -e 's;git://git\.;git://anongit.;' ${file}

autogenpkg_cmd="./autogen.sh --prefix=$MYPREFIX"
buildpkg_cmd="fakeroot dpkg-buildpackage -b -us -uc"
repkg_cmd="fakeroot ./debian/rules binary"

git_items="$(wget -q -O - "$GITWEB/?a=project_index"|grep "^$1/" | cut -d' ' -f1)"

if [ -z "$git_items" ]; then
	echo "There are problems while retrieving the beryl items list; exiting..."
	exit 2;
fi

if [ -z "$(which git-clone)" ]; then
	echo -e "\nYou must install the 'git-core' package in order to use needed git tools\n"
	exit 2
fi

for git_item in $git_items; do
	#git_item_name="$(basename $git_item)"
	git_item_name=$git_item
	if [ ! -d "$git_item/.git" ]; then
		echo -e "\n\033[4mNo $git_item_name git folder found! Downloading...\033[0m"
		if ! git-clone $GITURL/$git_item $git_item; then
			echo "There are problems retrieving git data for $git_item_name. Skipping..."
			#exit 2;
		fi
		echo ""
	elif [ -d "$git_item" ]; then
		pushd "$git_item"
		if ! git-log &> /dev/null; then
			echo "The $git_item_name git directory isn't here, please remove the '$git_item' dir and run again this script."
			echo "Whould you like this script make this (all your '$git_item' data will be removed)?"
			read -p " [Y/n]: " -n1 continue;
			if [ "$continue" != "$(echo Y | tr [:upper:] [:lower:])" ]; then
				echo ''
				exit 2
			else
				popd
				rm -rf "$git_item"
				if ! git-clone $GITURL/$git_item $git_item; then
					echo "There are problems retriving git data for $git_item_name. Skipping..."
					#exit 2;
				fi
			fi
		else
			if [ -z "$(echo $* | grep -wE "batch|noupdate|build")" ]; then
				echo -e "\n\033[4mUpdating the $git_item_name package...\033[0m"
				if ! git-pull origin; then
					report="$report\n\033[4mGIT PULL FAILED\033[0m"
					sleep 3
				fi
				git-repo-config user.name "Danny Baumann"
				git-repo-config user.email "dannybaumann@web.de"
			fi
		fi
		popd
	else
		echo "There are some errors with build directories, please report this to the Author"
		exit 2
	fi
done

if [ -n "$(echo $* | grep -wE "update|pull")" ]; then
	exit 0;
fi