Pārlūkot izejas kodu

Performed major renovations to make the script work on OpenBSD.

dtrg 17 gadi atpakaļ
vecāks
revīzija
9170d09462
1 mainītis faili ar 34 papildinājumiem un 22 dzēšanām
  1. 34 22
      distr/mkdist

+ 34 - 22
distr/mkdist

@@ -8,7 +8,7 @@ destdir=
 srcdir=`pwd`
 arch=/usr/local/bin/arch
 delete=no
-copy=ln
+copy="ln"
 
 # --- Options parsing -------------------------------------------------------
 
@@ -29,7 +29,11 @@ while [ "$1" != "" ]; do
 			;;
 			
 		-c|--copy)
-			copy="cp -dp"
+			copy="cp -Rp"
+			;;
+			
+		-S|--symlink)
+			copy="ln -s"
 			;;
 			
 		-a|--arch)
@@ -44,6 +48,7 @@ while [ "$1" != "" ]; do
 			echo "  -d --destdir <path>  The directory to create the distribution in."
 			echo "  -x --delete          Erase the destination directory first."
 			echo "  -c --copy            Make physical copies of the files. (default: hardlink)"
+			echo "  -S --symlink         Make symbolic links instead of copying or hardlinking."
 			echo "  -a --arch <path>     Where the ACK 'arch' tool is."
 			echo "  -h --help            Display this message."
 			exit 0
@@ -89,26 +94,30 @@ process_dir() {
 	fi
 
 	for i in `cat $path/.distr`; do
-		if [ "${i:0:1}" = "#" ]; then
-			# Comment. Do nothing.
-			true
-		elif [ -d $i ]; then
-			# This is a directory. Recurse into it.
-			
-			( process_dir $path/$i )
-		elif [ -f $i ]; then
-			# This is a file.
+		case "$i" in
+			\#*)	# Comment. Do nothing.
+					;;
+					
+			*)
+					if [ -d $i ]; then
+						# This is a directory. Recurse into it.
+						
+						( process_dir $path/$i )
+					elif [ -f $i ]; then
+						# This is a file.
+						
+						addfile $path/$i
+					elif [ "$i" = "$archivename" ]; then
+						# Build the named archive.
 			
-			addfile $path/$i
-		elif [ "$i" = "$archivename" ]; then
-			# Build the named archive.
-
-			$arch cDr `cat LIST`
-			addfile $path/$archivename
-		else
-			echo "Don't know what to do with $i, listed in $PWD/.distr."
-			exit 1
-		fi
+						$arch cDr `cat LIST`
+						addfile $path/$archivename
+					else
+						echo "Don't know what to do with $i, listed in $PWD/.distr."
+						exit 1
+					fi
+					;;
+		esac
 	done
 }
 
@@ -150,7 +159,10 @@ echo "Done."
 
 # Revision history
 # $Log$
-# Revision 1.3  2007-02-24 02:05:56  dtrg
+# Revision 1.4  2007-02-25 20:56:41  dtrg
+# Performed major renovations to make the script work on OpenBSD.
+#
+# Revision 1.3  2007/02/24 02:05:56  dtrg
 # Removed some bashish; added comment support; removed the make
 # distr functionality, as nothing was using it any more and it was
 # causing problems.