This file is indexed.

/usr/bin/dpsyco-skel is in dpsyco-lib 1.0.36.

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
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/sh
# DocumentId:	$Id: dpsyco-skel 2318 2006-07-19 17:58:05Z ola $
# Author:	$Author: ola $
# Date:		$Date: 2006-07-19 19:58:05 +0200 (ons, 19 jul 2006) $
# Summary:
#	Handle the syncronization of the skels.
# Arguments:	$1	Source.
#		$2	Destination.
#    (optional)	$3	Rsync options.
#
#
# Copyright (C) 2001-2006 Ola Lundqvist <opal@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#

SOURCE="$1"
DESTR="$2"
RSYNCOPT="$3"

if [ ! -d "$SOURCE" ] ; then
    echo "Source $SOURCE is not a directory, exiting."
    exit 0
fi

if [ ! -d "$DESTR" ] ; then
    echo "Destination $DEST is not a directory, exiting."
    exit 0
fi
DESTAPP=$(echo "$DESTR" | sed -e "s|^/||;")
DEST=$(echo "$DESTR" | sed -e "s|/$||;")

SKELBDB="/var/lib/dpsyco-skel/skel"
SKELTBDFORMAT=
#SKELTBDFORMAT="%Y-%m-%d"

if [ -r /etc/dpsyco/defaults.conf ] ; then
    . /etc/dpsyco/defaults.conf
fi

CDIR=$(echo "$SKELBDB/$DESTAPP" | sed -e "s|/$||;")
mkdir -p $CDIR
OLDLISTF=$CDIR/skel.list
LISTF=$CDIR/tmpskel.list
BDIR=$CDIR/skel
TBDIR=$CDIR/back
if [ -n "$SKELTBDFORMAT" ] ; then
    TBDIR=$CDIR/back-$(date +"$SKELTBDFORMAT")
fi
touch $OLDLISTF

find $SOURCE -depth | sed -e "s|^$SOURCE||;" | sed -e "s|^/||;" | grep -v "^$" | sort > $LISTF

SEPREM="< "
SEPADD="> "
# Compare the two skeleton files and see what files that have been removed.
diff $OLDLISTF $LISTF | grep "$SEPREM" | sed -e "s|^$SEPREM||;" | {
    while read FILE ; do
	if [ -e "$DEST/$FILE" -a ! -d "$DEST/$FILE" -a ! -L "$DEST/$FILE" ] ; then
	    # Should it be restored or should it be deleted?
	    if [ -e "$BDIR/$FILE" ] ; then
		echo "Restore $DEST/$FILE from backup."
		mv "$BDIR/$FILE" "$DEST/$FILE"
	    else
		if [ -e "$DEST/$FILE" ] ; then
		    echo "Searching for $DEST/$FILE in the installed packages."
		    if dpkg -S "$DEST/$FILE" > /dev/null 2>&1 ; then
			echo "$DEST/$FILE found, not removed. Nothing to restore from though."
		    else
			echo "Remove $DEST/$FILE. Removed from dpsyco skel and nothing to restore."
			rm -f "$DEST/$FILE"
		    fi
		else
		    echo "File $DEST/$FILE removed from skel and but was already deleted."
		fi
	    fi
	elif [ -d "$DEST/$FILE" ] ; then
	    if rmdir "$DEST/$FILE" > /dev/null 2>&1 ; then
		echo "Directory $DEST/$FILE successfully removed."
	    fi
	fi
    done
}
# Compare the two skeleton files and see what directories that have been
# removed.
diff $OLDLISTF $LISTF | grep "$SEPREM" | sed -e "s|^$SEPREM||;" | {
    while read FILE ; do
	if [ -d "$DEST/$FILE" ] ; then
	    if rmdir "$DEST/$FILE" > /dev/null 2>&1 ; then
		echo "Directory $DEST/$FILE successfully removed."
	    fi
	fi
    done
}

# Sync in a new version.
mkdir -p $TBDIR
rsync -rltD -b --backup-dir=$TBDIR -I $RSYNCOPT "$SOURCE/" "$DESTR"

find $TBDIR -type f | sed -e "s|^$TBDIR||;" | {
    while read FILE ; do
	#echo diff -q "$TBDIR$FILE" "$SOURCE$FILE"
	if ! diff -q "$TBDIR$FILE" "$SOURCE$FILE" > /dev/null ; then
	    # If they differ back it up.
	    if [ ! -e "$TBDIR$FILE" ] ; then
		echo "Backing up $DEST$FILE."
	    else
		echo "Backing (destroy old backup) up $DEST$FILE (was modified)."
	    fi
	    TMPC=$(echo "$BDIR$FILE" | sed -e "s|/[^/]*$||;")
	    mkdir -p $TMPC
	    #echo "Copy $TBDIR$FILE to $BDIR$FILE"
	    cp -a "$TBDIR$FILE" "$BDIR$FILE"
	else
	    #echo "No need to back up $DEST$FILE (rm $TBDIR$FILE)."
	    rm "$TBDIR$FILE"
	fi
    done
}
if [ -z "$SKELTBDFORMAT" ] ; then
    #echo "Clean $TBDIR."
    rm -Rf $TBDIR
else
    #echo "rmdir $TBDIR recursively"
    find $TBDIR -type d -depth | xargs rmdir > /dev/null 2>&1
fi
# Store the new skel as the old one.
mv $LISTF $OLDLISTF