Package: switchconf
Version: 0.0.5.1-1
Severity: wishlist
Tags: patch

Hello,

as I've started to use switchconf in order to configure a chroot environment,
using ln to apply configurations doesn't work for me. So I created the attached
patch, adding effectively a new option to /etc/switchconf/conf:

# defines how to copy files to their configuration place. 'softlink' is the
# default value, 'copy' is an alternative possibility.
config_method=copy

I made the patch such that it doesn't make any difference for people not
changing their config file. Hope you can include it in a next version of
switchconf.

I might in the future try to find a way to decide on copy vs. link for each file
individually, but it's 2nd priority for me, so it might never come.

Cheers, Eric

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-686
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8)

-- no debconf information
--- /usr/sbin/switchconf        2005-12-19 02:26:06.000000000 +0100
+++ switchconf  2007-03-24 19:56:32.000000000 +0100
@@ -61,7 +61,14 @@
 for f in `find ${conf} ! -type d | sed "s/^${conf}\///"`; do
     dir=`dirname ${dest_dir}/${f}`
     [ -d ${dir} ] || mkdir -p ${dir}
-    ln -fs ${conf_top_dirs}/${conf}/${f} ${dest_dir}/${f}
+    if [ "${config_method}" = "copy" ]
+    then
+        mv -f ${dest_dir}/${f} ${dest_dir}/${f}.SWITCHCONF && \
+            cp -fa ${conf_top_dirs}/${conf}/${f} ${dest_dir}/${f} && \
+            rm -f ${dest_dir}/${f}.SWITCHCONF
+    else
+        ln -fs ${conf_top_dirs}/${conf}/${f} ${dest_dir}/${f}
+    fi
 done
 
 # executing each scripts after

Reply via email to