From 4ecaae94054c4eb919ddbd45904d834383a09558 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Fri, 22 May 2009 14:50:52 +0200 Subject: Make all indentation consistent. Previously, there were many indentation styles in use: Real tabs, 2, 3 or 4 spaces, mixing these within the same file, function or even within a single line. This commit changes all bash scripts in the handlers, src and lib dirs to use consistent indentation: three spaces are now used everywhere. Other files (e.g. Makefiles) are left untouched. Additionally, this commit removes all trailing whitespace. --- lib/easydialog.in | 152 +++++++++++++++++++++++++++--------------------------- 1 file changed, 76 insertions(+), 76 deletions(-) (limited to 'lib/easydialog.in') diff --git a/lib/easydialog.in b/lib/easydialog.in index 056c76c..a0495a7 100644 --- a/lib/easydialog.in +++ b/lib/easydialog.in @@ -20,43 +20,43 @@ DIALOG=dialog HELP= setApplicationTitle() { - BACKTITLE=$* + BACKTITLE=$* } setHelp() { - HELP="$@" + HELP="$@" } setDimension() { - WIDTH=$1 - HEIGHT=$2 + WIDTH=$1 + HEIGHT=$2 } booleanBox() { - $DIALOG --backtitle "$BACKTITLE" --title "$1" \ - `[ "$3" == no ] && echo '--defaultno'` --yesno "$2" $HEIGHT $WIDTH + $DIALOG --backtitle "$BACKTITLE" --title "$1" \ + `[ "$3" == no ] && echo '--defaultno'` --yesno "$2" $HEIGHT $WIDTH } msgBox() { - $DIALOG --backtitle "$BACKTITLE" --title "$1" \ - --msgbox "$2" $HEIGHT $WIDTH + $DIALOG --backtitle "$BACKTITLE" --title "$1" \ + --msgbox "$2" $HEIGHT $WIDTH } gaugeBox() { - $DIALOG --backtitle "$BACKTITLE" --title "$1" \ - --gauge "$2" $HEIGHT $WIDTH 0 + $DIALOG --backtitle "$BACKTITLE" --title "$1" \ + --gauge "$2" $HEIGHT $WIDTH 0 } inputBox() { - local temp=$(@MKTEMP@ -t backupninja.XXXXXX) || exit 1 - trap "rm -f $temp" 0 - REPLY= - $DIALOG --backtitle "$BACKTITLE" --title "$1" \ - --inputbox "$2" $HEIGHT $WIDTH "$3" 2> $temp - local status=$? - [ $status = 0 ] && REPLY=$(cat $temp) - rm -f $temp - return $status + local temp=$(@MKTEMP@ -t backupninja.XXXXXX) || exit 1 + trap "rm -f $temp" 0 + REPLY= + $DIALOG --backtitle "$BACKTITLE" --title "$1" \ + --inputbox "$2" $HEIGHT $WIDTH "$3" 2> $temp + local status=$? + [ $status = 0 ] && REPLY=$(cat $temp) + rm -f $temp + return $status } # Xdialog and {dialog,whiptail} use different mechanism to "qoute" the @@ -67,7 +67,7 @@ inputBox() { # mechanism to the standard double-quoting one. it receives two # arguements, the file that has the data and the box type. _listReplyHook() { - cat $1 + cat $1 } # this is the base implementation of all the list based boxes, it works @@ -75,79 +75,79 @@ _listReplyHook() { # this function with an extra argument specifying the actual box that # needs to be rendered. _genericListBox() { - local box=$1 - shift 1 - local title=$1 - local text=$2 - shift 2 - local temp=$(@MKTEMP@ -t backupninja.XXXXXX) || exit 1 - trap "rm -f $temp" 0 - REPLY= - $DIALOG $HELP $_DEFAULT --backtitle "$BACKTITLE" --title "$title" \ - $box "$text" $HEIGHT $WIDTH 10 \ - "$@" 2> $temp - local status=$? - [ $status = 0 ] && REPLY=$(_listReplyHook $temp $box) - rm -f $temp - _DEFAULT= - return $status + local box=$1 + shift 1 + local title=$1 + local text=$2 + shift 2 + local temp=$(@MKTEMP@ -t backupninja.XXXXXX) || exit 1 + trap "rm -f $temp" 0 + REPLY= + $DIALOG $HELP $_DEFAULT --backtitle "$BACKTITLE" --title "$title" \ + $box "$text" $HEIGHT $WIDTH 10 \ + "$@" 2> $temp + local status=$? + [ $status = 0 ] && REPLY=$(_listReplyHook $temp $box) + rm -f $temp + _DEFAULT= + return $status } setDefault() { - _DEFAULT="--default-item $1" + _DEFAULT="--default-item $1" } menuBox() { - _genericListBox --menu "$@" + _genericListBox --menu "$@" } ## a menu box with additional help info displayed ## at the bottom of the window when an item is selected menuBoxHelp() { - HELP="--item-help" - _genericListBox --menu "$@" - status=$? - HELP= - return $status + HELP="--item-help" + _genericListBox --menu "$@" + status=$? + HELP= + return $status } ## a menu box with an addition button 'help' menuBoxHelpFile() { - HELP="--help-button" - _genericListBox --menu "$@" - status=$? - HELP= - return $status + HELP="--help-button" + _genericListBox --menu "$@" + status=$? + HELP= + return $status } checkBox() { - _genericListBox --checklist "$@" + _genericListBox --checklist "$@" } radioBox() { - _genericListBox --radiolist "$@" + _genericListBox --radiolist "$@" } textBox() { - $DIALOG --backtitle "$BACKTITLE" --title "$1" --textbox "$2" $HEIGHT $WIDTH + $DIALOG --backtitle "$BACKTITLE" --title "$1" --textbox "$2" $HEIGHT $WIDTH } passwordBox() { - local temp=$(@MKTEMP@ -t backupninja.XXXXXX) || exit 1 - trap "rm -f $temp" 0 - REPLY= - $DIALOG --backtitle "$BACKTITLE" --title "$1" \ - --passwordbox "$2" $HEIGHT $WIDTH 2> $temp - local status=$? - [ $status = 0 ] && REPLY=$(cat $temp) - rm -f $temp - return $status + local temp=$(@MKTEMP@ -t backupninja.XXXXXX) || exit 1 + trap "rm -f $temp" 0 + REPLY= + $DIALOG --backtitle "$BACKTITLE" --title "$1" \ + --passwordbox "$2" $HEIGHT $WIDTH 2> $temp + local status=$? + [ $status = 0 ] && REPLY=$(cat $temp) + rm -f $temp + return $status } ######################################################### ## begin-item-display style lists -## +## ## these lists are built by calling fuctions multiple times. ## this can make it easier to build your list in a loop ## @@ -177,7 +177,7 @@ listDisplay() { boxtype=$1 local temp=$(@MKTEMP@ -t backupninja.XXXXXX) || exit 1 trap "rm -f $temp" 0 - + local label local text local status @@ -188,13 +188,13 @@ listDisplay() { echo -ne " --$boxtype '$_menu_msg' " echo -ne " $HEIGHT $WIDTH 10 " for ((i=0; i < $_menu_items ; i++)); do - label=${_menu_labels[$i]} - text=${_menu_text[$i]} - status=${_menu_status[$i]} - echo -ne " $label '$text' $status " + label=${_menu_labels[$i]} + text=${_menu_text[$i]} + status=${_menu_status[$i]} + echo -ne " $label '$text' $status " done ) | xargs $DIALOG 2> $temp - + local status=$? REPLY="" [ $status = 0 ] && REPLY=`cat $temp` @@ -219,10 +219,10 @@ formItem() { _form_text[$_form_items]=$2 let "_form_items += 1" } - + formDisplay() { local temp=$(@MKTEMP@ -t backupninja.XXXXXX) || exit 1 - + max_length=0 for ((i=0; i < ${#_form_labels[@]} ; i++)); do label=${_form_labels[$i]} @@ -232,19 +232,19 @@ formDisplay() { fi done let "max_length += 2" - + local xpos=1 ( 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]} - echo -n -e " $label $xpos 1 '$text' $xpos $max_length 30 30" - let "xpos += _form_gap" + label=${_form_labels[$i]} + text=${_form_text[$i]} + echo -n -e " $label $xpos 1 '$text' $xpos $max_length 30 30" + let "xpos += _form_gap" done ) | xargs $DIALOG 2> $temp local status=$? - + ## ## the exit status is meaningless, it is always 0. ## i can't figure out how to get the exit status of dialog @@ -254,7 +254,7 @@ formDisplay() { ## swallowed by xargs. xargs should return different exit status ## depending on the exit status of the command run, but i have ## never been able to get that to work. - ## + ## REPLY= if [ $status = 0 ]; then -- cgit v1.2.3 From 78884142e7cdaaf3e1f5571b1f28d2ea5a520b30 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Fri, 22 May 2009 15:27:09 +0200 Subject: Add a vim modeline with indentation settings. The modelines added match the emacs lines already present and also set the filetype to sh (just like the emacs lines). --- handlers/dup.helper.in | 1 + handlers/dup.in | 1 + handlers/ldap.helper.in | 1 + handlers/ldap.in | 1 + handlers/maildir.in | 1 + handlers/makecd.helper.in | 1 + handlers/makecd.in | 1 + handlers/mysql.helper.in | 1 + handlers/mysql.in | 1 + handlers/pgsql.helper.in | 1 + handlers/pgsql.in | 1 + handlers/rdiff.helper.in | 1 + handlers/rdiff.in | 1 + handlers/rsync.in | 2 ++ handlers/sh.in | 1 + handlers/svn.in | 1 + handlers/sys.helper.in | 1 + handlers/sys.in | 1 + handlers/tar.helper.in | 1 + handlers/tar.in | 1 + handlers/trac.in | 1 + handlers/wget | 2 ++ lib/easydialog.in | 1 + lib/tools.in | 1 + lib/vserver.in | 1 + src/backupninja.in | 1 + src/ninjahelper.in | 1 + src/ninjareport.in | 1 + 28 files changed, 30 insertions(+) (limited to 'lib/easydialog.in') diff --git a/handlers/dup.helper.in b/handlers/dup.helper.in index 86745c8..3c08a2f 100644 --- a/handlers/dup.helper.in +++ b/handlers/dup.helper.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: HELPERS="$HELPERS dup:incremental_encrypted_remote_filesystem_backup" diff --git a/handlers/dup.in b/handlers/dup.in index 60a4ce9..aed6030 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # duplicity script for backupninja # requires duplicity diff --git a/handlers/ldap.helper.in b/handlers/ldap.helper.in index 4870ae4..4154cc6 100644 --- a/handlers/ldap.helper.in +++ b/handlers/ldap.helper.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: HELPERS="$HELPERS ldap:ldap_database_backup" diff --git a/handlers/ldap.in b/handlers/ldap.in index 0b0166e..5f402c7 100644 --- a/handlers/ldap.in +++ b/handlers/ldap.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # openldap backup handler script for backupninja # diff --git a/handlers/maildir.in b/handlers/maildir.in index e88619d..ab72ce1 100644 --- a/handlers/maildir.in +++ b/handlers/maildir.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: ############################################################### # diff --git a/handlers/makecd.helper.in b/handlers/makecd.helper.in index c8a6762..ad0c4aa 100644 --- a/handlers/makecd.helper.in +++ b/handlers/makecd.helper.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: HELPERS="$HELPERS makecd:makecd_backup" wizardname="makecd action wizard" diff --git a/handlers/makecd.in b/handlers/makecd.in index 78e5454..d44bba3 100644 --- a/handlers/makecd.in +++ b/handlers/makecd.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # burncd handler script for backupninja # diff --git a/handlers/mysql.helper.in b/handlers/mysql.helper.in index fb9f11d..997f73c 100644 --- a/handlers/mysql.helper.in +++ b/handlers/mysql.helper.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: HELPERS="$HELPERS mysql:mysql_database_backup" diff --git a/handlers/mysql.in b/handlers/mysql.in index a4a3667..88ffb1a 100644 --- a/handlers/mysql.in +++ b/handlers/mysql.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # mysql handler script for backupninja # diff --git a/handlers/pgsql.helper.in b/handlers/pgsql.helper.in index 48bf047..ff1cfd4 100644 --- a/handlers/pgsql.helper.in +++ b/handlers/pgsql.helper.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: HELPERS="$HELPERS pgsql:postgresql_database_backup" diff --git a/handlers/pgsql.in b/handlers/pgsql.in index b7e4262..ff5f7ba 100644 --- a/handlers/pgsql.in +++ b/handlers/pgsql.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # PostgreSQL handler script for backupninja # diff --git a/handlers/rdiff.helper.in b/handlers/rdiff.helper.in index c673723..83f2fb5 100644 --- a/handlers/rdiff.helper.in +++ b/handlers/rdiff.helper.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: HELPERS="$HELPERS rdiff:incremental_remote_filesystem_backup" diff --git a/handlers/rdiff.in b/handlers/rdiff.in index 51da1cc..f59d56a 100644 --- a/handlers/rdiff.in +++ b/handlers/rdiff.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # rdiff-backup handler script for backupninja # requires rdiff-backup diff --git a/handlers/rsync.in b/handlers/rsync.in index 9e5e4f9..072f2a6 100644 --- a/handlers/rsync.in +++ b/handlers/rsync.in @@ -1,3 +1,5 @@ +# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # backupninja handler to do incremental backups using # rsync and hardlinks, based on diff --git a/handlers/sh.in b/handlers/sh.in index 4edfd9a..b070f3b 100644 --- a/handlers/sh.in +++ b/handlers/sh.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # shell script handler for backupninja # runs the file /etc/backup.d/scriptname.sh diff --git a/handlers/svn.in b/handlers/svn.in index 97d1701..5e5531a 100644 --- a/handlers/svn.in +++ b/handlers/svn.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # this handler will backup subversion repostitories. # diff --git a/handlers/sys.helper.in b/handlers/sys.helper.in index c823712..8a2fb07 100644 --- a/handlers/sys.helper.in +++ b/handlers/sys.helper.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: HELPERS="$HELPERS sys:general_hardware_and_system_info" diff --git a/handlers/sys.in b/handlers/sys.in index 2ab5871..69751ed 100755 --- a/handlers/sys.in +++ b/handlers/sys.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # this handler will save various reports of vital system information. # by default, all the reports are saved in /var/backups. diff --git a/handlers/tar.helper.in b/handlers/tar.helper.in index 2665382..cdbe03a 100644 --- a/handlers/tar.helper.in +++ b/handlers/tar.helper.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: HELPERS="$HELPERS tar:tar_backup" diff --git a/handlers/tar.in b/handlers/tar.in index 0a762ce..b4f8c58 100644 --- a/handlers/tar.in +++ b/handlers/tar.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # tar handler script for backupninja diff --git a/handlers/trac.in b/handlers/trac.in index f387d42..018bffd 100644 --- a/handlers/trac.in +++ b/handlers/trac.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # this handler will backup trac environments (based on the svn handler) # diff --git a/handlers/wget b/handlers/wget index 0c363eb..ebb391e 100644 --- a/handlers/wget +++ b/handlers/wget @@ -1,3 +1,5 @@ +# -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # backupninja handler to do incremental backups using # wget and hardlinks, based on rsync handler diff --git a/lib/easydialog.in b/lib/easydialog.in index a0495a7..c41e6f7 100644 --- a/lib/easydialog.in +++ b/lib/easydialog.in @@ -1,5 +1,6 @@ #!@BASH@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # copyright 2002 lmoore@tump.com under the terms of the GNU LGPL. # additions 2005 collective@riseup.net diff --git a/lib/tools.in b/lib/tools.in index 0d368b8..929826b 100644 --- a/lib/tools.in +++ b/lib/tools.in @@ -1,5 +1,6 @@ #!@BASH@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # This file contains functions shared between ninjahelper and backupninja. diff --git a/lib/vserver.in b/lib/vserver.in index cc96a71..b356b2b 100644 --- a/lib/vserver.in +++ b/lib/vserver.in @@ -1,4 +1,5 @@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: ##################################################### ## VSERVERS RELATED FUNCTIONS FOR NINJAHELPER diff --git a/src/backupninja.in b/src/backupninja.in index ca5074c..a158715 100755 --- a/src/backupninja.in +++ b/src/backupninja.in @@ -1,5 +1,6 @@ #!@BASH@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # |\_ # B A C K U P N I N J A /()/ diff --git a/src/ninjahelper.in b/src/ninjahelper.in index 7bbef1f..2a7faa9 100755 --- a/src/ninjahelper.in +++ b/src/ninjahelper.in @@ -1,5 +1,6 @@ #!@BASH@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: #################################################### ## Functions diff --git a/src/ninjareport.in b/src/ninjareport.in index 56a7209..4bc244e 100755 --- a/src/ninjareport.in +++ b/src/ninjareport.in @@ -1,5 +1,6 @@ #!@BASH@ # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- +# vim: set filetype=sh sw=3 sts=3 expandtab autoindent: # # # Ninjareport - generate a single simple report for a lot of hosts -- cgit v1.2.3 From 6606cce4454fc040c60889db82c274704d840ec8 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Thu, 24 Dec 2009 16:57:31 +0100 Subject: easydialog: allow form fields input to grow up to 100 chars (Closes: #562249) --- ChangeLog | 3 +++ lib/easydialog.in | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/easydialog.in') diff --git a/ChangeLog b/ChangeLog index 4a4a3b1..9a6ccaa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ version 0.9.7 -- UNRELEASED . add 'when = manual' option, that can be used in the global config file or in a given backup action file. Thanks Tuomas Jormola for the preliminary patch (Closes: #511299) + lib changes + easydialog: + . Allow form fields input to grow up to 100 chars (Closes: #562249) handler changes ldap: . Use gzip's --rsyncable option. diff --git a/lib/easydialog.in b/lib/easydialog.in index c41e6f7..6b41e1b 100644 --- a/lib/easydialog.in +++ b/lib/easydialog.in @@ -240,7 +240,7 @@ formDisplay() { for ((i=0; i < $_form_items ; i++)); do label=${_form_labels[$i]} text=${_form_text[$i]} - echo -n -e " $label $xpos 1 '$text' $xpos $max_length 30 30" + echo -n -e " $label $xpos 1 '$text' $xpos $max_length 30 100" let "xpos += _form_gap" done ) | xargs $DIALOG 2> $temp -- cgit v1.2.3