Performed major renovations to make the script work on OpenBSD.
authordtrg <none@none>
Sun, 25 Feb 2007 20:56:41 +0000 (20:56 +0000)
committerdtrg <none@none>
Sun, 25 Feb 2007 20:56:41 +0000 (20:56 +0000)
distr/mkdist

index c6fe24d..7b11e15 100755 (executable)
@@ -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.