From 84dffc81edcae45991d429d979cd7ef4bae94e69 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 19 Feb 2009 17:09:09 +0100 Subject: [PATCH] Add helpers to install MinGW packages The pre-install.sh and post-install.sh helper are meant to help the stuff in /src/, of course. Call pre-install.sh before installing stuff. This script will output the name of a temporary Git index which contains the current state. Now install whatever you want. Afterwards, call post-install.sh with the name of the temporary Git index and a commit message as arguments; this will commit the changes. The advantage to the earlier installation method of packages in /src/ is that you can do that with a non-pristine state (in other words, you can have untracked files lying around; they may be overwritten, though). Note: the use of the plumbing 'diff-files' in post-install.sh is crucial; we do _not_ want the index to be auto-refreshed; instead, we want to catch all files that have been touched in the meantime. Signed-off-by: Johannes Schindelin --- share/msysGit/install-mingw-tar.sh | 23 +++++++++++++++++++++++ share/msysGit/post-install.sh | 18 ++++++++++++++++++ share/msysGit/pre-install.sh | 10 ++++++++++ 3 files changed, 51 insertions(+) create mode 100644 share/msysGit/install-mingw-tar.sh create mode 100644 share/msysGit/post-install.sh create mode 100644 share/msysGit/pre-install.sh diff --git a/share/msysGit/install-mingw-tar.sh b/share/msysGit/install-mingw-tar.sh new file mode 100644 index 0000000000..bfd7d03e4d --- /dev/null +++ b/share/msysGit/install-mingw-tar.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +die () { + echo "$*" >&2 + exit 1 +} + +test $# -ne 1 && die "Usage: $0 " + +cd /mingw || echo "/mingw does not exist?" + +index=$(/share/msysGit/pre-install.sh) || die "Pre-install stage failed" + +uncompress= +case "$1" in +*.bz2) uncompress=j;; +*.gz|*.tgz) uncompress=z;; +esac + +tar x${uncompress}mf "$1" || die "Could not untar $1" + +/share/msysGit/post-install.sh $index Install "$(basename "$1")" || +die "Post-install stage failed" diff --git a/share/msysGit/post-install.sh b/share/msysGit/post-install.sh new file mode 100644 index 0000000000..7757b5ac05 --- /dev/null +++ b/share/msysGit/post-install.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +test $# -lt 2 && { + echo "Usage: $0 " + exit 1 +} + +# bashism +set -o pipefail + +cd / && +(export GIT_INDEX_FILE=$1 && + git diff-files --name-only -z && + git ls-files --exclude-standard --others -z) | +git update-index -z --add --remove --stdin && +shift && +git commit -s -m "$*" + diff --git a/share/msysGit/pre-install.sh b/share/msysGit/pre-install.sh new file mode 100644 index 0000000000..60c6f79346 --- /dev/null +++ b/share/msysGit/pre-install.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# This script records the current state of the msysGit root tree in a +# temporary Git index + +cd / && +export GIT_INDEX_FILE=/.git/install-index.$$ && +cp .git/index $GIT_INDEX_FILE && +git add . && +echo $GIT_INDEX_FILE -- 2.11.4.GIT