]> Frank Brehm's Git Trees - scripts/solaris.git/commitdiff
endlich ins Repo
authorFrank Brehm <frank@brehm-online.com>
Wed, 16 Dec 2009 13:30:39 +0000 (13:30 +0000)
committerFrank Brehm <frank@brehm-online.com>
Wed, 16 Dec 2009 13:30:39 +0000 (13:30 +0000)
checkin [new file with mode: 0755]

diff --git a/checkin b/checkin
new file mode 100755 (executable)
index 0000000..adbf2fa
--- /dev/null
+++ b/checkin
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+# $Id$
+# $URL$
+
+for p in ci rcs rcsdiff stat chmod ; do
+       type -p ${p} >/dev/null 
+       if [ "$?" != "0" ] ; then
+               echo "Command '${p}' not found." >&2
+               exit 6
+       fi
+done
+
+for FILE in "$@"; do
+
+       echo
+
+       if [ ! -e "${FILE}" ] ; then
+               echo "File '${FILE}' doesn't exists." >&2
+               continue
+       fi
+
+       if [ ! -f "${FILE}" ] ; then
+               echo "File '${FILE}' isn't a normal file." >&2
+               continue
+       fi
+
+       case "${FILE}" in
+               *,v)
+                       echo "File '${FILE}' is a RCS repository." >&2
+                       continue
+                       ;;
+       esac
+
+       MSG="Initial"
+       if [ -f "${FILE},v" ] ; then
+               MSG="Checked in."
+               rcsdiff -q "${FILE}" >/dev/null
+               RES="$?"
+               if [ "${RES}" = "0" ] ; then
+                       echo "File '${FILE}' wasn't changed." >&2
+                       continue
+               fi
+       fi
+
+       echo "Checking in '${FILE}' ..."
+       PERM=`stat -c "%a" "${FILE}"`
+       echo "    rcs -q -l \"${FILE}\""
+       rcs -q -l "${FILE}" >/dev/null
+       echo "    echo \"${MSG}\" | ci -l -d \"${FILE}\""
+       echo "${MSG}" | ci -u -d "${FILE}"
+       echo "    rcs -q -u \"${FILE}\""
+       rcs -q -u "${FILE}" >/dev/null
+       echo "    chmod ${PERM} \"${FILE}\""
+       chmod "${PERM}" "${FILE}"
+
+done
+
+# vim: ts=4 syntax=sh