Przeglądaj źródła

Add -k|--symlink option.

Adam Heath 25 lat temu
rodzic
commit
089211013d
4 zmienionych plików z 18 dodań i 2 usunięć
  1. 4 0
      ChangeLog
  2. 1 0
      debian/changelog
  3. 4 1
      scripts/dpkg-name.1
  4. 9 1
      scripts/dpkg-name.sh

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+Sun Dec 24 06:31:55 CST 2000 Adam Heath <doogie@debian.org>
+
+  * scripts/dpkg-name.sh: Add -k|--symlink option.
+
 Sun Dec 24 05:58:48 CST 2000 Adam Heath <doogie@debian.org>
 
   * dselect/main.cc: Made the accelerator keys in dselect's main

+ 1 - 0
debian/changelog

@@ -1,5 +1,6 @@
 dpkg (1.8.0) unstable; urgency=low
 
+  * Add -k|--symlink option to dpkg-name.  Closes: #35040
   * Made the accelerator keys in dselect's main menu separate options, so
     that they can be translated separately.  Closes: #50955.
   * Added depends on sysvinit (>= 2.72), so that we can make sure that

+ 4 - 1
scripts/dpkg-name.1

@@ -11,7 +11,7 @@ dpkg\-name \- rename Debian packages to full package names
 .B dpkg\-name 
 [\-a|\-\-no\-architecture] [\-o|\-\-overwrite] [\-s|\-\-subdir [dir]]
 [\-c|\-\-create\-dir] [\-h|\-\-help] [\-v|\-\-version]
-[\-l|\-\-license] [\-[--] [files]
+[\-l|\-\-license] [\-k|\-\-symlink] [\-[--] [files]
 .SH DESCRIPTION
 .PP
 This manual page documents the
@@ -47,6 +47,9 @@ This can be used when building new packages.
 .TP
 .B "\-a, \-\-no\-architecture"
 The destination filename will not have the architecture information. 
+.TP
+.B "\-k, \-\-symlink"
+Create a symlink, instead of moving.
 .TP 
 .B "\-o, \-\-overwrite"
 Existing files will be overwritten if they have the same name as the

+ 9 - 1
scripts/dpkg-name.sh

@@ -37,6 +37,7 @@ usage () {
   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 @@ move () {
 			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 @@ do
 		--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