From: Wichert Akkerman Date: Sat, 25 Dec 1999 01:52:20 +0000 (+0000) Subject: Oops, forgot to add scripts/dpkg-safefilelist.{1,pl} X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4af84cdc4ffe9911d179775075a9cd12e7304039;p=dpkg Oops, forgot to add scripts/dpkg-safefilelist.{1,pl} debian/control: remove double empty line --- diff --git a/ChangeLog b/ChangeLog index d4cdffbe..956dd7c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Dec 25 02:50:31 CET 1999 Wichert Akkerman + + * Oops, forgot to add scripts/dpkg-safefilelist.{1,pl} + * debian/control: remove double empty line + Fri Dec 24 17:34:30 CET 1999 Wichert Akkerman * version-nr: update to 1.6.5 diff --git a/debian/control b/debian/control index 1eac54b7..4688375b 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,6 @@ Maintainer: Wichert Akkerman Standards-Version: 3.1.0 Build-Depends: debiandoc-sgml, ncurses-dev - Package: dpkg Architecture: any Essential: yes diff --git a/scripts/dpkg-safefilelist.1 b/scripts/dpkg-safefilelist.1 new file mode 100644 index 00000000..7a5b8bbf --- /dev/null +++ b/scripts/dpkg-safefilelist.1 @@ -0,0 +1,37 @@ +.\" This is an -*- nroff -*- source file. +.\" dpkg-safefilelist and this manpage are Copyright 1999 by Adam Heath. +.\" +.\" This is free software; see the GNU General Public Licence version 2 +.\" or later for copying conditions. There is NO warranty. +.\" Time-stamp: +.TH dpkg-safefilelist 1 "December 1999" "Debian Project" "Debian GNU/Linux" +.SH NAME +dpkg\-safefilelist \- List files with symlinks after their targets +.SH SYNOPSIS +.B dpkg\-safefilelist +.SH DESCRIPTION +.PP +This manual page documents the +.B dpkg\-safefilelist +.sh script which provides an easy way to list files with the targets +coming before the symlinks that point to them. + +.SH EXAMPLES +.TP +.B dpkg-safefilelist +This will find all files in the current directory, and sort them, +printing symlinks after their targets. +.SH BUGS? +Successfully tested on +.B Debian Linux +systems only. +.SH SEE ALSO +.BR dpkg-deb (8), +.BR find (1), +.SH COPYRIGHT +Copyright 1999 Adam Heath. +.B dpkg-safefilelist +is free software; see the GNU General Public Licence version 2 or +later for copying conditions. There is +.B no +warranty. diff --git a/scripts/dpkg-safefilelist.pl b/scripts/dpkg-safefilelist.pl new file mode 100644 index 00000000..65210150 --- /dev/null +++ b/scripts/dpkg-safefilelist.pl @@ -0,0 +1,35 @@ +#!/usr/bin/perl +open(FILES, "find -mindepth 1|"); +sub myprint { + print "@_\n"; +} +while () { + chomp; + $file = $_; + if( ! -l $file ) { + print "$file\n" if(!$targets{$file}); + } + $newfile = $file; + $oldfile = $newfile; + + while (-l $newfile) { + push @symlinks, $newfile; + $oldfile = $newfile; + $link = readlink($newfile); + $newfile = $_; + $newfile =~ s,.*/,,; + $path = $_; + $path =~ s,[^/]*$,,; + $newfile = $path . $link; + break if("$oldfile" == "$newfile"); + } + if(-e $newfile) { + push @symlinks, $newfile; + while($file = pop @symlinks) { + if(!$targets{$file}) { + $targets{$file} = 1; + print "$file\n"; + } + } + } +}