Bug#35040: dpkg: Add symlink support to dpkg-name
Package: dpkg
Version: 1.4.0.34
Severity: whishlist
The following patch is useful to recover broken CDs (with names
truncated...) by creating a forest of symlinks. dpkg-name with the -k
switch creates a symlink instaed of moving the file.
Example usage:
cd /cdrom
mkdir /forest
find ./dists -type d | while read dir; do mkdir -p /forest/$dir; done
find ./ -name \*.deb | while read name; do
dpkg-name -k -s /forest/`dirname $name` $name
done
We still need to copy Packages by hand:-)
lupus
--- dpkg-name.old Thu Mar 25 11:18:54 1999
+++ dpkg-name Thu Mar 25 11:32:27 1999
@@ -37,6 +37,7 @@
according to the ``underscores convention''.
-a|--no-architecture No architecture part in filename
-o|--overwrite Overwrite if file exists
+ -k|--symlink Don't create a new file, but a symlink
-s|--subdir [dir] Move file into subdir (Use with care)
-c|--create-dir Create target dir if not there (Use with care)
-h|--help|-v|--version|-l|--license Show help/version/license"
@@ -137,13 +138,19 @@
fi
fi
newname=`echo $dir/$name`;
+ if [ x$symlink = x1 ];
+ then
+ command="ln -s --"
+ else
+ command="mv --"
+ fi
if [ $newname -ef "$1" ]; # same device and inode numbers
then
stderr "skipping \`"$1"'";
elif [ -f $newname -a -z "$overwrite" ];
then
stderr "can't move \`"$1"' to existing file";
- elif `mv -- "$1" $newname`;
+ elif `$command "$1" $newname`;
then
echo "moved \``basename "$1"`' to \`$newname'";
else
@@ -173,6 +180,7 @@
--create-dir|-c) createdir=1;;
--subdir|-s) subdirset=1;;
--overwrite|-o) overwrite=1 ;;
+ --symlink|-k) symlink=1 ;;
--no-architecture|-a) noarchitecture=1 ;;
--) shift;
for arg
-- System Information
Debian Release: 2.1
Kernel Version: Linux bacco 2.2.3 #1 Tue Mar 9 12:09:14 CET 1999 i686 unknown
Versions of the packages dpkg depends on:
ii libc6 2.0.7.19981211 GNU C Library: shared libraries
ii libncurses4 4.2-3 Shared libraries for terminal handling
ii libstdc++2.9 2.91.60-5 The GNU stdc++ library (egcs version)
Reply to: