bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] [PATCH v2 3/3] boostrap: support --copy correctly


From: KO Myung-Hun
Subject: [Bug-tar] [PATCH v2 3/3] boostrap: support --copy correctly
Date: Thu, 14 Jan 2016 13:02:29 +0900

bootstrap.conf is invoked before --copy is parsed. And ln is called
regardless of --copy in bootstrap.conf.

bootstrap (bootstrap.conf): Invoke bootstrap.conf after parsing options.
bootstrap.conf (copy_files): Use cp if --copy is specified.
---
 bootstrap      | 16 ++++++++--------
 bootstrap.conf |  6 +++++-
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/bootstrap b/bootstrap
index 5e318e4..2b5ab88 100755
--- a/bootstrap
+++ b/bootstrap
@@ -325,14 +325,6 @@ symlink_to_dir()
   }
 }
 
-# Override the default configuration, if necessary.
-# Make sure that bootstrap.conf is sourced from the current directory
-# if we were invoked as "sh bootstrap".
-case "$0" in
-  */*) test -r "$0.conf" && . "$0.conf" ;;
-  *) test -r "$0.conf" && . ./"$0.conf" ;;
-esac
-
 # Extra files from gnulib, which override files from other sources.
 test -z "${gnulib_extra_files}" && \
   gnulib_extra_files="
@@ -387,6 +379,14 @@ if test -n "$checkout_only_file" && test ! -r 
"$checkout_only_file"; then
   die "Bootstrapping from a non-checked-out distribution is risky."
 fi
 
+# Override the default configuration, if necessary.
+# Make sure that bootstrap.conf is sourced from the current directory
+# if we were invoked as "sh bootstrap".
+case "$0" in
+  */*) test -r "$0.conf" && . "$0.conf" ;;
+  *) test -r "$0.conf" && . ./"$0.conf" ;;
+esac
+
 # Strip blank and comment lines to leave significant entries.
 gitignore_entries() {
   sed '/^#/d; /^$/d' "$@"
diff --git a/bootstrap.conf b/bootstrap.conf
index 001174b..38e6594 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -92,7 +92,11 @@ copy_files() {
       esac
     fi
     if [ "$2" = '.' ]; then
-      ln -sf $1/$file $2
+      if $copy; then
+        cp -fp $1/$file $2
+      else
+        ln -sf $1/$file $2
+      fi
     else
       symlink_to_dir "$1" "$file" "$2/$dst" || exit
     fi
-- 
2.7.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]