From 3a23ae215bb68614c6b0d6c62e0a7c634133ccf0 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Nov 14 2016 05:06:31 +0000 Subject: Add fetch-sources.sh script to fetch upstream sources --- diff --git a/fetch-sources.sh b/fetch-sources.sh new file mode 100755 index 0000000..c8a754c --- /dev/null +++ b/fetch-sources.sh @@ -0,0 +1,31 @@ +#!/bin/bash +if [ -f fetch-sources.sh ] ; then + if [ -z "$1" ] ; then + echo "Usage: ./fetch-sources.sh DIR or cd dir; ../fetch-sources.sh" + exit 1 + elif [ -d "$1" ] ; then + cd "$1" + else + echo "$1 is not a directory name" + exit 1 + fi +fi +if [ ! -f ../fetch-sources.sh ] ; then + echo "Usage: ./fetch-sources.sh DIR or cd dir; ../fetch-sources.sh" + exit 1 +fi +echo "downloading sources" +spectool -g *.spec +echo "adding new sources to .gitignore" +SOURCES=`spectool -l *.spec | grep '://' | sed 's!^.*/\([^/]*\)$!/\1!g'` || exit 1 +for NEWSRC in $SOURCES ; do + if grep -Fx "$NEWSRC" .gitignore >/dev/null ; then + echo "skipping $NEWSRC (already listed)" + else + echo "$NEWSRC" + echo "$NEWSRC" >>.gitignore || exit 1 + fi +done +echo "adding the modified .gitignore to git" +git add .gitignore || exit 1 +echo "sources fetched"