diff options
| -rw-r--r-- | ChangeLog | 1 | ||||
| -rw-r--r-- | configure.in | 22 | ||||
| -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 | ||||
| -rw-r--r-- | lib/Makefile.am | 8 | ||||
| -rw-r--r-- | lib/tools.in | 4 | ||||
| -rw-r--r-- | lib/vserver.in | 2 | ||||
| -rw-r--r-- | src/Makefile.am | 4 | ||||
| -rwxr-xr-x | src/backupninja.in | 12 | ||||
| -rwxr-xr-x | src/ninjahelper.in | 2 | 
16 files changed, 55 insertions, 37 deletions
@@ -3,6 +3,7 @@ version 0.9.5 -- unreleased  	 . Fixed checks on configuration files permissions, since the patch  	   applied to fix #370396 broke this, especially for configuration files  	   created with permissions 000 by an older ninjahelper version. +	 . Enhanced portability for other platforms       handler changes  	sys:  	 . Fixed typo breaking things for VServers. diff --git a/configure.in b/configure.in index 2b8c269..716c175 100644 --- a/configure.in +++ b/configure.in @@ -12,20 +12,30 @@ AM_INIT_AUTOMAKE  # BASH may already be set in the shell, if the admin then changes the  # the /bin/sh symlink to a non-bash shell, all hell will break lose.  unset BASH -AC_PATH_PROGS([BASH], [bash], [/bin/bash], [$PATH:/bin:/usr/bin:/usr/sbin]) -if test x$BASH = "x"; then +AC_PATH_PROGS(BASH, bash, "no", [$PATH:/bin:/usr/bin:/usr/sbin]) +if test x$BASH = "xno"; then      AC_MSG_ERROR([bash is required])  fi -AC_CHECK_PROGS(SED, sed) -if test x$SED = "x"; then +AC_PATH_PROGS(SED, sed, "no") +if test x$SED = "xno"; then      AC_MSG_ERROR([sed is required]) +else +   export SED  fi -AC_CHECK_PROGS(AWK, awk) -if test x$AWK = "x"; then +AC_PATH_PROGS(AWK, awk, "no") +if test x$AWK = "xno"; then      AC_MSG_ERROR([awk is required]) +else +   export AWK  fi + +AC_PATH_PROGS(MD5SUM, md5sum, "no") +if test x$MD5SUM = "xno"; then +    AC_MSG_ERROR([md5sum is required]) +fi +  AC_CHECK_PROG(ac_cv_have_rpm, rpm, "yes", "no")  if test "x$ac_cv_have_rpm" = "xyes"; then          rpm --define '_topdir /tmp' > /dev/null 2>&1 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 diff --git a/lib/Makefile.am b/lib/Makefile.am index fc2e052..9f3a029 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -7,10 +7,10 @@ EXTRA_DIST = easydialog.in parseini.in tools.in vserver.in  edit = sed \      -e "s,@CFGDIR\@,$(CFGDIR),g" \      -e "s,@BASH\@,$(BASH),g" \ -    -e 's,@datadir\@,$(pkgdatadir),g' \ -    -e "s,@libdir\@,$(pkglibdir),g" \ -    -e 's,@localstatedir\@,$(localstatedir),g' \ -        -e 's,@prefix\@,$(prefix),g' +    -e "s,@AWK\@,$(AWK),g" \ +    -e "s,@SED\@,$(SED),g" \ +    -e "s,@MD5SUM\@,$(MD5SUM),g" \ +    -e "s,@libdir\@,$(pkglibdir),g"   easydialog: $(srcdir)/easydialog.in  	rm -f easydialog diff --git a/lib/tools.in b/lib/tools.in index 2ec4da0..37fa212 100644 --- a/lib/tools.in +++ b/lib/tools.in @@ -15,7 +15,7 @@ function maketemp() {  		local tempfile=`mktemp /tmp/$1.XXXXXXXX`  	else  		DATE=`date` -		sectmp=`echo $DATE | /usr/bin/md5sum | cut -d- -f1` +		sectmp=`echo $DATE | @MD5SUM@ | cut -d- -f1`  		local tempfile=/tmp/$1.$sectmp  	fi  	echo $tempfile @@ -39,7 +39,7 @@ function setsection() {  #   function getconf() {  	CURRENT_PARAM=$1 -	ret=`awk -f $libdirectory/parseini S=$CURRENT_SECTION P=$CURRENT_PARAM $CURRENT_CONF_FILE` +	ret=`@AWK@ -f $libdirectory/parseini S=$CURRENT_SECTION P=$CURRENT_PARAM $CURRENT_CONF_FILE`  	# if nothing is returned, set the default  	if [ "$ret" == "" -a "$2" != "" ]; then  		ret="$2" diff --git a/lib/vserver.in b/lib/vserver.in index 8ac7b7e..f65bd4c 100644 --- a/lib/vserver.in +++ b/lib/vserver.in @@ -33,7 +33,7 @@ init_vservers() {     getconf vservers no     getconf VSERVERINFO /usr/sbin/vserver-info     getconf VSERVER /usr/sbin/vserver -   getconf VROOTDIR `if [ -x "$VSERVERINFO" ]; then $VSERVERINFO info SYSINFO | grep '^ *vserver-Rootdir' | awk '{print $2}'; fi` +   getconf VROOTDIR `if [ -x "$VSERVERINFO" ]; then $VSERVERINFO info SYSINFO | grep '^ *vserver-Rootdir' | @AWK@ '{print $2}'; fi`     # canonicalize VROOTDIR     [ -z "$VROOTDIR" ] || VROOTDIR=`readlink --canonicalize $VROOTDIR`     # init this library's global variables diff --git a/src/Makefile.am b/src/Makefile.am index 44b3148..f0cb69c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,10 +9,12 @@ EXTRA_DIST = backupninja.in ninjahelper.in  edit = sed \      -e "s,@CFGDIR\@,$(CFGDIR),g" \      -e "s,@BASH\@,$(BASH),g" \ +    -e "s,@AWK\@,$(AWK),g" \ +    -e "s,@SED\@,$(SED),g" \      -e 's,@datadir\@,$(pkgdatadir),g' \      -e "s,@libdir\@,$(pkglibdir),g" \      -e 's,@localstatedir\@,$(localstatedir),g' \ -	-e 's,@prefix\@,$(prefix),g' +    -e 's,@prefix\@,$(prefix),g'  #install-exec-hook: diff --git a/src/backupninja.in b/src/backupninja.in index 6295198..02ffa25 100755 --- a/src/backupninja.in +++ b/src/backupninja.in @@ -34,7 +34,7 @@ function setupcolors () {  function colorize () {  	if [ "$usecolors" == "yes" ]; then -		local typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'` +		local typestr=`echo "$@" | @SED@ 's/\(^[^:]*\).*$/\1/'`  		[ "$typestr" == "Debug" ] && type=0  		[ "$typestr" == "Info" ] && type=1  		[ "$typestr" == "Warning" ] && type=2 @@ -68,7 +68,7 @@ function printmsg() {  	type=$1  	shift  	if [ $type == 100 ]; then -		typestr=`echo "$@" | sed 's/\(^[^:]*\).*$/\1/'` +		typestr=`echo "$@" | @SED@ 's/\(^[^:]*\).*$/\1/'`  		[ "$typestr" == "Debug" ] && type=0  		[ "$typestr" == "Info" ] && type=1  		[ "$typestr" == "Warning" ] && type=2 @@ -204,7 +204,7 @@ function isnow() {  	whendayofweek=$1; at=$2; whentime=$3;  	whenday=`toint "$whendayofweek"`  	whendayofweek=`tolower "$whendayofweek"` -	whentime=`echo "$whentime" | sed 's/:[0-9][0-9]$//' | sed -r 's/^([0-9])$/0\1/'` +	whentime=`echo "$whentime" | @SED@ 's/:[0-9][0-9]$//' | @SED@ -r 's/^([0-9])$/0\1/'`  	if [ "$whendayofweek" == "everyday" -o "$whendayofweek" == "daily" ]; then  		whendayofweek=$nowdayofweek @@ -409,7 +409,7 @@ if [ ! -r "$conffile" ]; then  fi  # find $libdirectory -libdirectory=`grep '^libdirectory' $conffile | awk '{print $3}'` +libdirectory=`grep '^libdirectory' $conffile | @AWK@ '{print $3}'`  if [ -z "$libdirectory" ]; then          if [ -d "@libdir@" ]; then  	   libdirectory="@libdir@" @@ -541,9 +541,9 @@ if [ $doit == 1 ]; then  		if [ "$reportspace" == "yes" ]; then  			previous=""  			for i in $(ls "$configdirectory"); do -			backuploc=$(grep ^directory "$configdirectory"/"$i" | awk '{print $3}') +			backuploc=$(grep ^directory "$configdirectory"/"$i" | @AWK@ '{print $3}')  			if [ "$backuploc" != "$previous" ]; then -				mountdev=$(mount | grep "$backuploc" | awk '{print $1}') +				mountdev=$(mount | grep "$backuploc" | @AWK@ '{print $1}')  				df -h "$mountdev"  				previous="$backuploc"  				fi diff --git a/src/ninjahelper.in b/src/ninjahelper.in index 26d2856..040727b 100755 --- a/src/ninjahelper.in +++ b/src/ninjahelper.in @@ -183,7 +183,7 @@ if [ ! -r "$conffile" ]; then  fi  # find $libdirectory -libdirectory=`grep '^libdirectory' $conffile | awk '{print $3}'` +libdirectory=`grep '^libdirectory' $conffile | @AWK@ '{print $3}'`  if [ -z "$libdirectory" ]; then     if [ -d "@libdir@" ]; then        libdirectory="@libdir@"  | 
