From ef1f1f61daaf59d3e07d41ddd0ea713834f35e38 Mon Sep 17 00:00:00 2001 From: Silvino Silva Date: Sun, 25 Feb 2018 17:33:12 +0000 Subject: core install revision --- core/conf/ports/drivers/git | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 core/conf/ports/drivers/git (limited to 'core/conf/ports/drivers/git') diff --git a/core/conf/ports/drivers/git b/core/conf/ports/drivers/git new file mode 100755 index 0000000..654a8c7 --- /dev/null +++ b/core/conf/ports/drivers/git @@ -0,0 +1,47 @@ +#!/bin/sh +# +# /etc/ports/drivers/git: git driver script for ports(8) +# + +if [ $# -ne 1 ]; then + echo "usage: $0 " >&2 + exit 1 +fi + +. $1 + +if [ -z "$URL" ]; then + echo "URL not set in '$1'" >&2 + exit 2 +fi +if [ -z "$NAME" ]; then + echo "NAME not set in '$1'" >&2 + exit 2 +fi +if [ -z "$BRANCH" ]; then + echo "BRANCH not set in '$1'" >&2 + exit 2 +fi + +REPOSITORY="$PORTS_DIR/$NAME" +if [ -n "$LOCAL_REPOSITORY" ]; then + REPOSITORY="$LOCAL_REPOSITORY" +fi + +echo "Fetching updates from $URL" +echo "Updating collection $NAME" + +cd "$REPOSITORY" 2> "/dev/null" + +if [ $? -lt 1 ]; then + git checkout -q "$BRANCH" + git fetch -q + git diff --pretty=format: --name-status "$BRANCH" origin/"$BRANCH" | sed "s/M\t/ Edit /g; s/A\t/ Checkout /g; s/D\t/ Delete /g" | sort + git clean -q -f + git reset -q --hard origin/"$BRANCH" +else + git clone -q -b "$BRANCH" "$URL" "$REPOSITORY" + ls -1 $REPOSITORY | sed "s/^/ Checkout /" +fi + +echo "Finished successfully" -- cgit 1.4.1-2-gfad0