fixed handling of * in easydialog.
authorelijah <elijah@758a04ac-41e6-0310-8a23-8373a73cc35d>
Wed, 6 Jul 2005 08:03:31 +0000 (08:03 +0000)
committerelijah <elijah@758a04ac-41e6-0310-8a23-8373a73cc35d>
Wed, 6 Jul 2005 08:03:31 +0000 (08:03 +0000)
added .disabled

git-svn-id: http://code.autistici.org/svn/backupninja/trunk@134 758a04ac-41e6-0310-8a23-8373a73cc35d

backupninja
changelog
handlers/easydialog.sh
handlers/rdiff.helper
ninjahelper

index 7f09999fb8151d9bae54da39b50d4afb9942acff..08aeafd6299204f111f13cde6813d5fc98a4ba00 100755 (executable)
@@ -476,7 +476,7 @@ for file in $files; do
        check_perms $file
        suffix="${file##*.}"
        base=`basename $file`
-       if [ "${base:0:1}" == "0" ]; then
+       if [ "${base:0:1}" == "0" -o "$suffix" == "disabled" ]; then
                info "Skipping $file"
                continue
        fi
index 06ae2d99929f9f327004a56523415de965ef91a7..e916ef05b5baf924bb4ec3186a128ece9ea7d094 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,7 +1,8 @@
 version 0.7 -- July 3 2005
     added ninjahelper: a dialog based wizard for creating backupninja configs.
     considerably improved and changed the log file output.
-        
+    you can now disable actions with .disabled (this is new preferred method).
+            
 version 0.6 -- June 16 2005
        ldap handler has new options: backup method to use (ldapsearch or
                slapcat), restart, passwordfile and binddn. Default backup method
index ce7d31eefcae6ad7fba7d0e296bbf62914fb8586..1ae3c830b2338e6c340b82cb501be6d33596def4 100644 (file)
@@ -164,19 +164,20 @@ displayForm() {
     
    local form=
    local xpos=1
-   for ((i=0; i < $_form_items ; i++)); do
-      label=${_form_labels[$i]}
-      text=${_form_text[$i]}
-      if [ "$text" == "" ]; then
-         text='_empty_'
-      fi
-      form=`echo -e "$form $label $xpos 1" $text "$xpos $max_length 30 30"`
-      let "xpos += _form_gap"
-   done
-
-   $DIALOG --form "$_form_title" 0 0 20 $form 2> $temp
+   (
+      echo -n -e "--form '$_form_title' 0 0 20"
+      for ((i=0; i < $_form_items ; i++)); do
+        label=${_form_labels[$i]}
+        text=${_form_text[$i]}
+        if [ "$text" == "" ]; then
+           text='_empty_'
+        fi
+        echo -n -e "$form $label $xpos 1 '$text' $xpos $max_length 30 30"
+        let "xpos += _form_gap"
+      done
+   ) | xargs $DIALOG 2> $temp
    local status=$?
-   [ $status = 0 ] && REPLY=$(cat $temp)
+   [ $status = 0 ] && REPLY=`cat $temp`
    rm -f $temp
    return $status
 }
index 1364367d563a4bfef901c4f8d33a5264eb6579de..83549ecaa3af9fdc6e8a088982defb84da2c154a 100644 (file)
@@ -22,22 +22,23 @@ rdiff_wizard() {
      formItem include /etc
      formItem include /root
      formItem include /home
-     formItem include /usr/local/__star__bin
-     formItem include /var/lib/dpkg/status__star__
+     formItem include '/usr/local/*bin'
+     formItem include '/var/lib/dpkg/status*'
      formItem include 
      formItem include 
      formItem include 
    displayForm
 
    [ $? = 1 ] && return;
-
    includes=   
+   set -o noglob
    for i in $REPLY; do
       [ "$i" != "_empty_" ] && includes="$includes\ninclude = $i"
    done
+   set +o noglob
    
    startForm "rdiff action wizard: excludes" 
-     formItem exclude /home/__star__/.gnupg
+     formItem exclude '/home/*/.gnupg'
      formItem exclude 
      formItem exclude 
    displayForm
@@ -45,18 +46,20 @@ rdiff_wizard() {
    [ $? = 1 ] && return;
 
    excludes=
+   set -o noglob
    for i in $REPLY; do
       [ "$i" != "_empty_" ] && excludes="$excludes\nexclude = $i"
    done
-   
+   set +o noglob
+      
    get_next_filename $configdirectory/90.rdiff
    cat > $next_filename <<EOF
 [source]
 type = local
 keep = $keep
 EOF
-   echo -e $includes >> $next_filename
-   echo -e $excludes >> $next_filename
+   echo -e "$includes" >> $next_filename
+   echo -e "$excludes" >> $next_filename
    cat >> $next_filename <<EOF
 
 [dest]
index 9631b80e9c41742b253ca07ebeaa7f401c83a48e..9568b53b8197ec2e1abad75091731565e7496ae8 100755 (executable)
@@ -90,15 +90,11 @@ do_run_test() {
 }
 
 do_disable() {
-  dir=`dirname $1`
-  base=`basename $1`
-  mv $dir/$base $dir/0-$base
+  mv $1 $1.disabled
 }
 
 do_enable() {
-  dir=`dirname $1`
-  base=`basename $1`
-  mv $dir/$base $dir/${base:2}
+  mv $1 ${1%.*}
 }
 
 do_rename() {
@@ -111,7 +107,7 @@ do_rename() {
 doaction() {
   action=$1
   base=`basename $action`
-  if [ "${base:0:2}" == "0-" ]; then
+  if [ "${base##*.}" == "disabled" ]; then
      enable="enable";
   else
      enable="disable";