This file is indexed.

/usr/bin/update-ifupdown-scripts-zg2.d-symlinks is in ifupdown-scripts-zg2 0.6-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash

DIR="/etc/network"
CONFFILE="$DIR/ifupdown-scripts-zg2.d-symlinks.conf"

dump-ifupdown-scripts-zg2.d-symlinks() {
	DIR="$1"
	SEDEXP=`echo "$DIR" | sed 's/\//\\\\\//g'`
	echo "# This file has been generated automatically by dump-ifupdown-scripts-zg2.d-symlinks"
	for i in `find $DIR -mindepth 2 -type l -name 'ifupdown-scripts-zg2-*'`; do
		echo -n "$i " | sed "s/^$SEDEXP\/\?//"
		readlink $i
	done
}

kill-symlink() {
	# symlink will only be killed if it points to a file in
	# /etc/network/ifupdown-scripts-zg2.d
	LINK="$1"
	if [ -L "$LINK" ]; then
		TARGET="$(readlink $LINK)"
		if [ "${TARGET%/*}" = "../ifupdown-scripts-zg2.d" ]; then
			rm -f $LINK
		fi
	fi
}

kill-ifupdown-scripts-zg2.d-symlinks() {
	DIR="$1"
	while read link target; do
		if [ -n "${link%%#*}" ]; then
			kill-symlink $DIR/$link
		fi
	done	
}

update-ifupdown-scripts-zg2.d-symlinks() {
	# this function dumps the symlinks listed in the conffile
	DIR="$1"
	HANDLEDDIRS="|"
	while read link target; do
		if [ -n "${link%%#*}" ]; then
			linkdir=${link%/*}
			if [ "${HANDLEDDIRS/|$linkdir|/}" = "$HANDLEDDIRS" ]; then
				HANDLEDDIRS="$HANDLEDDIRS|$linkdir|"
				mkdir -p $DIR/$linkdir
				for llink in $(find $DIR/$linkdir -type l); do
					kill-symlink "$llink"
				done
			fi
			ln -sf $target $DIR/$link
		fi
	done	
}

check-ifupdown-scripts-zg2.d-symlinks() {
	# this function barfs if the conffile is not in sync with the actual
	# directory
	DIR="$1"
	if ! TMPFILE1=`tempfile`; then
		echo >&2 "ERR: creating temporary file failed"
		exit 1
	fi
	if ! TMPFILE2=`tempfile`; then
		echo >&2 "ERR: creating temporary file failed"
		exit 1
	fi
	dump-ifupdown-scripts-zg2.d-symlinks $DIR | grep -v '\(00README\|^[[:space:]]*#\|^[[:space:]]*$\)' | sort > $TMPFILE1
	< $CONFFILE grep -v '\(00README\|^[[:space:]]*#\|^[[:space:]]*$\)' | sort > $TMPFILE2
	if ! diff --brief $TMPFILE1 $TMPFILE2 > /dev/null; then
		echo >&2 "WARN: symlink farm and $CONFFILE not in sync!"
		echo >&2 "please re-sync manually using update-ifupdown-scripts-zg2.d-symlinks or"
		echo >&2 "manual modification of symlinks and $CONFFILE"
		diff --unified=0 $TMPFILE1 $TMPFILE2 | tail --lines=+4
		rm -f $TMPFILE1 $TMPFILE2
		exit 1
	fi
	rm -f $TMPFILE1 $TMPFILE2
}

# get -c parameter. if not given, take $0.
if [ "x$1" == "x-c" ]; then
	COMMAND="$2"
	shift 2
else
	COMMAND="`basename $0`"
fi

case "$COMMAND" in
	dump-ifupdown-scripts-zg2.d-symlinks) dump-ifupdown-scripts-zg2.d-symlinks $DIR ;;
	update-ifupdown-scripts-zg2.d-symlinks) < $CONFFILE update-ifupdown-scripts-zg2.d-symlinks $DIR ;;
	check-ifupdown-scripts-zg2.d-symlinks) < $CONFFILE check-ifupdown-scripts-zg2.d-symlinks $DIR ;;
	kill-ifupdown-scripts-zg2.d-symlinks) < $CONFFILE kill-ifupdown-scripts-zg2.d-symlinks $DIR ;;
        default) echo >&2 "ERR: called with unknown name"; exit 1;;
esac