#!/bin/sh # # Copyright (C) 2015 Paul Kocialkowski # # This program 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 3 of the License, or # (at your option) any later version. # # This program 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, see . # # Variables SCRIPT=$0 REPLICANT_DIR=$1 MANIFEST=$2 ARGS_COUNT=1 COLOR=1 TMP="/tmp" REPO="../tools/repo" RELEASE_KEY="4A80EB23" REMOTE="replicant" PUSH_REMOTE="git.replicant.us" VERSION="4.2" RELEASE="0004" if [ "$COLOR" = "1" ] then color_start="\033[36m" color_end="\033[0m" else color_start="" color_end="" fi manifest () { dir=$( pwd ) cd "$REPLICANT_DIR" $REPO manifest -r > $MANIFEST cd "$dir" } tag_repos () { list="" default=$( cat $MANIFEST | grep default | grep "remote=\"$REMOTE\"" ) if [ "$default" != "" ] then list=$( cat $MANIFEST | grep project | grep -v "remote=\"" )"\n" fi list="$list"$( cat $MANIFEST | grep project | grep "remote=\"$REMOTE\"" ) echo "$list" | while read repo do path=$( echo "$repo" | sed "s/.*path=\"\([^\"]*\)\".*/\1/g" ) revision=$( echo "$repo" | sed "s/.*revision=\"\([^\"]*\)\".*/\1/g" ) dir=$( pwd ) cd "$REPLICANT_DIR/$path" echo "Tagging ""$color_start""$path""$color_end"" with $revision" git tag -s -u $RELEASE_KEY -m "Replicant $VERSION $RELEASE images release" -a "replicant-$VERSION-$RELEASE" $revision echo "Pusing ""$color_start""$path""$color_end" path=$( echo $path | tr '[:upper:]' '[:lower:]' ) git push "git@$PUSH_REMOTE:replicant/$path.git" "replicant-$VERSION-$RELEASE" cd "$dir" done } print_help () { echo "$SCRIPT: [REPLICANT_DIR] (MANIFEST)" } # Check for the correct number of args if [ "$#" -lt "$ARGS_COUNT" ] then print_help exit 1 fi if [ "$MANIFEST" = "" ] then MANIFEST="$TMP/manifest.xml" manifest fi tag_repos