#!/bin/sh - # # sccs wrapper script # Oliver Fromme # BSD-style copyright and standard disclaimer applies. # # This is a wrapper-script to prevent using certain # SCCS commands as root (particularly edit and delta). # It has been tested with GNU-SCCS (a.k.a. CSSC) on # FreeBSD. To use this, perform these steps: # # # cd /usr/ports/devel/cssc # # make install # # cd /usr/local/bin # # mv sccs ../libexec/cssc # # Then copy this script to /usr/local/bin/sccs and # make it executable (chmod 755). # SCCS_BIN="/usr/local/libexec/cssc/sccs" MY_EUID=`id -u` CMD="" SKIP=false for i in "$@"; do if $SKIP; then SKIP=false continue fi case "$i" in -[dp]|-[!-]*[dp]) SKIP=true;; -*) ;; *) CMD="$i"; break;; esac done case "$CMD" in admin|cdc|get|prs|prt|sact|sccsdiff|unget|val|what) ROOTOK=true;; create|fix|clean|info|check|tell|diffs|print) ROOTOK=true;; delta|rmdel|edit|delget|deledit|unedit) ROOTOK=false;; *) echo "sccs: Syntax error (unrecognized command)" >&2 echo "Usage: sccs [flags] command [flags]" >&2 exit 1;; esac if ! $ROOTOK && [ $MY_EUID -lt 1000 -o $MY_EUID -gt 59998 ]; then echo "ERROR: Please use the \"sccs $CMD\" command as normal user only!" >&2 echo " Do NOT use it as root or any other pseudo-user!" >&2 exit 1 fi exec $SCCS_BIN "$@" #--