PageRenderTime 23ms CodeModel.GetById 20ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/ntp/scripts/fixautomakedepsmagic

https://bitbucket.org/freebsd/freebsd-head/
Shell | 28 lines | 22 code | 5 blank | 1 comment | 2 complexity | 1bb578fc0a376bacda97d3733e08695a MD5 | raw file
 1#!/bin/sh
 2
 3prog=`basename $0`
 4
 5
 6t=/tmp/$prog.$$
 7
 8trap 'rm -f ${t} ; exit 1' 1 3 15
 9
10while [ $# -gt 0 ]; do
11        f=$1
12	shift
13	sed -e '/^DEPS_MAGIC :=/,/^-include \$/s/^/#/' $f > $t
14	c="diff $f $t"
15	echo $c
16	$c
17	tstatus=$?
18	if [ $tstatus = 0 ]; then
19		echo "$prog":" $f not modified"
20	elif [ ! -w $f ]; then
21		echo "$prog":" $f not not writable"
22	else
23		c="cp $t $f"
24		echo $c
25		$c
26	fi
27	rm -f $t
28done