diff options
Diffstat (limited to 'handlers')
-rw-r--r-- | handlers/Makefile.am | 5 | ||||
-rw-r--r-- | handlers/dup | 8 | ||||
-rw-r--r-- | handlers/ldap | 2 | ||||
-rw-r--r-- | handlers/ldap.helper | 2 | ||||
-rw-r--r-- | handlers/maildir | 4 | ||||
-rw-r--r-- | handlers/mysql | 8 | ||||
-rw-r--r-- | handlers/pgsql | 4 | ||||
-rwxr-xr-x | handlers/sys | 4 |
8 files changed, 21 insertions, 16 deletions
diff --git a/handlers/Makefile.am b/handlers/Makefile.am index 7d802c1..b627f79 100644 --- a/handlers/Makefile.am +++ b/handlers/Makefile.am @@ -5,4 +5,9 @@ HANDLERS = dup dup.helper maildir mysql.helper rdiff sys makecd makecd.helper \ EXTRA_DIST = Makefile.am $(HANDLERS) +edit = sed \ + -e "s,@BASH\@,$(BASH),g" \ + -e "s,@AWK\@,$(AWK),g" \ + -e "s,@SED\@,$(SED),g" + dist_pkgdata_DATA = $(HANDLERS) diff --git a/handlers/dup b/handlers/dup index 15d1a02..8e0367d 100644 --- a/handlers/dup +++ b/handlers/dup @@ -71,10 +71,10 @@ fi ### COMMAND-LINE MANGLING ### # duplicity >= 0.4.2 needs --sftp-command (NB: sftp does not support the -l option) -duplicity_version="`duplicity --version | awk '{print $2}'`" -duplicity_major="`echo $duplicity_version | awk -F '.' '{print $1}'`" -duplicity_minor="`echo $duplicity_version | awk -F '.' '{print $2}'`" -duplicity_sub="`echo $duplicity_version | awk -F '.' '{print $3}'`" +duplicity_version="`duplicity --version | @AWK@ '{print $2}'`" +duplicity_major="`echo $duplicity_version | @AWK@ -F '.' '{print $1}'`" +duplicity_minor="`echo $duplicity_version | @AWK@ -F '.' '{print $2}'`" +duplicity_sub="`echo $duplicity_version | @AWK@ -F '.' '{print $3}'`" if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 4 -a "$duplicity_sub" -ge 2 ]; then sftpoptions="$sshoptions" fi diff --git a/handlers/ldap b/handlers/ldap index 242755e..5f9040a 100644 --- a/handlers/ldap +++ b/handlers/ldap @@ -27,7 +27,7 @@ status="ok" [ -d $backupdir ] || mkdir -p $backupdir [ -d $backupdir ] || fatal "Backup directory '$backupdir'" -dbsuffixes=(`awk 'BEGIN {OFS=":"} /[:space:]*^database[:space:]*\w*/ {db=$2}; /^[:space:]*suffix[:space:]*\w*/ {if (db=="bdb"||db=="ldbm") print db,$2}' $conf|sed -e 's/[" ]//g'`) +dbsuffixes=(`@AWK@ 'BEGIN {OFS=":"} /[:space:]*^database[:space:]*\w*/ {db=$2}; /^[:space:]*suffix[:space:]*\w*/ {if (db=="bdb"||db=="ldbm") print db,$2}' $conf|@SED@ -e 's/[" ]//g'`) ## LDIF DUMP diff --git a/handlers/ldap.helper b/handlers/ldap.helper index 9aecec8..697c720 100644 --- a/handlers/ldap.helper +++ b/handlers/ldap.helper @@ -54,7 +54,7 @@ done ldap_wizard() { bdb=no ldbm=no - for backend in `grep -e "^backend" /etc/ldap/slapd.conf | awk '{print $2}'`; do + for backend in `grep -e "^backend" /etc/ldap/slapd.conf | @AWK@ '{print $2}'`; do if [ "$backend" == "bdb" -a "$bdb" == "no" ]; then bdb=yes elif [ "$backend" == "ldbm" -a "$ldbm" == "no" ]; then diff --git a/handlers/maildir b/handlers/maildir index 49b2542..ab89f70 100644 --- a/handlers/maildir +++ b/handlers/maildir @@ -157,7 +157,7 @@ function do_rotate() { fi # Rotate the current list of backups, if we can. - oldest=\`find $backuproot -type d -maxdepth 1 -name \$rottype'.*' | sed 's/^.*\.//' | sort -n | tail -1\` + oldest=\`find $backuproot -type d -maxdepth 1 -name \$rottype'.*' | @SED@ 's/^.*\.//' | sort -n | tail -1\` #echo "Debug: oldest \$oldest" [ "\$oldest" == "" ] && oldest=0 for (( i=\$oldest; i > 0; i-- )); do @@ -201,7 +201,7 @@ function do_rotate() { for rottype in daily weekly monthly; do max=\$((keep\${rottype}+1)) dir="$backuproot/\$rottype" - oldest=\`find $backuproot -type d -maxdepth 1 -name \$rottype'.*' | sed 's/^.*\.//' | sort -n | tail -1\` + oldest=\`find $backuproot -type d -maxdepth 1 -name \$rottype'.*' | @SED@ 's/^.*\.//' | sort -n | tail -1\` [ "\$oldest" == "" ] && oldest=0 # if we've rotated the last backup off the stack, remove it. for (( i=\$oldest; i >= \$max; i-- )); do diff --git a/handlers/mysql b/handlers/mysql index b3d0a73..de4e4c3 100644 --- a/handlers/mysql +++ b/handlers/mysql @@ -90,10 +90,10 @@ if [ "$dbusername" != "" -a "$dbpassword" != "" ] then if [ $usevserver = yes ] then - vhome=`$VSERVER $vsname exec getent passwd "root" | awk -F: '{print $6}'` + vhome=`$VSERVER $vsname exec getent passwd "root" | @AWK@ -F: '{print $6}'` home="$vroot$vhome" else - home=`getent passwd "root" | awk -F: '{print $6}'` + home=`getent passwd "root" | @AWK@ -F: '{print $6}'` fi [ -d $home ] || fatal "Can't find root's home directory ($home)." @@ -144,14 +144,14 @@ else userset=true; if [ $usevserver = yes ] then - vuserhome=`$VSERVER $vsname exec getent passwd "$user" | awk -F: '{print $6}'` + vuserhome=`$VSERVER $vsname exec getent passwd "$user" | @AWK@ -F: '{print $6}'` if [ $? -eq 2 ] then fatal "User $user not found in /etc/passwd" fi userhome="$vroot$vuserhome" else - userhome=`getent passwd "$user" | awk -F: '{print $6}'` + userhome=`getent passwd "$user" | @AWK@ -F: '{print $6}'` if [ $? -eq 2 ] then fatal "User $user not found in /etc/passwd" diff --git a/handlers/pgsql b/handlers/pgsql index fb8fa4f..23e2c2b 100644 --- a/handlers/pgsql +++ b/handlers/pgsql @@ -62,9 +62,9 @@ fi # give backup dir the good uid and permissions # (in respect to the vserver, if $usevserver = yes) if [ $usevserver = yes ]; then - pguid=`$VSERVER $vsname exec getent passwd $PGSQLUSER | awk -F: '{print $3}'` + pguid=`$VSERVER $vsname exec getent passwd $PGSQLUSER | @AWK@ -F: '{print $3}'` else - pguid=`getent passwd $PGSQLUSER | awk -F: '{print $3}'` + pguid=`getent passwd $PGSQLUSER | @AWK@ -F: '{print $3}'` fi [ -n "$pguid" ] || \ fatal "No user called $PGSQLUSER`[ $usevserver = no ] || echo \" on vserver $vsname\"`." diff --git a/handlers/sys b/handlers/sys index 57d9d60..ce9c5b0 100755 --- a/handlers/sys +++ b/handlers/sys @@ -188,7 +188,7 @@ elif [ $os = "debian" ]; then echo "Level: $level" >> $sysreportfile for f in /etc/rc${level}.d/*; do # Remove /etc/Knn or Snn from beginning - ff=$(echo $f | sed 's_/etc/rc..d/[KS][0-9][0-9]__') + ff=$(echo $f | @SED@ 's_/etc/rc..d/[KS][0-9][0-9]__') if [ $f != $ff ]; then echo $ff >> $sysreportfile fi @@ -443,7 +443,7 @@ fi # these files can be used to directly partition a disk of the same size. if [ "$partitions" == "yes" ]; then - devices=`$SFDISK -l 2>/dev/null | grep "^Disk /dev" | awk '{print $2}' | cut -d: -f1` + devices=`$SFDISK -l 2>/dev/null | grep "^Disk /dev" | @AWK@ '{print $2}' | cut -d: -f1` if [ "$devices" == "" ]; then warning "No harddisks found" fi |