#!/bin/sh # install-magic for VideoteXt # # $Id: install-magic,v 1.1 1997/09/14 01:49:18 mb Exp mb $ # # Copyright (c) 1997 Martin Buck # Read COPYING for more information # This script installs entries for VideoteXt's file types in the system magic # file. set -e if [ $# -ne 2 ]; then echo "Usage: $0 magic-file vtx-magic" >&2 exit 1 fi trap 'rm -f "$1.vtxnew"' 0 cp -p "$1" "$1.vtxnew" gawk ' /^#.*Id: Localstuff/ { localfound++ } /^$/ { if (localfound == 1) { print "" system("cat " VTXMAGIC) localfound++ } } { print $0 } END { if (!localfound) { print "" system("cat " VTXMAGIC) } } ' VTXMAGIC="$2" "$1" > "$1.vtxnew" ln -f "$1.vtxnew" "$1"