diff mbox

[core] Fixed crontab, when root crontabs are empty.

Message ID 1385627172-6556-1-git-send-email-dore@madsdore.dk
State Superseded
Delegated to: Esben Haabendal
Headers show

Commit Message

Mads Doré Hansen Nov. 28, 2013, 8:26 a.m. UTC
---
 classes/image_crontab.oeclass | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Esben Haabendal Nov. 28, 2013, 1:20 p.m. UTC | #1
Mads Doré Hansen <dore@madsdore.dk> writes:

> ---
>  classes/image_crontab.oeclass | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/classes/image_crontab.oeclass b/classes/image_crontab.oeclass
> index 32899a5..a2c09a5 100644
> --- a/classes/image_crontab.oeclass
> +++ b/classes/image_crontab.oeclass
> @@ -6,8 +6,10 @@ image_preprocess_crontab () {
>  	cwd=`pwd`
>  	test -d $cwd/${crontabdir} || return 0
>  	for f in $cwd/${crontabdir}/*.* ; do
> -		user=`basename $f | cut -d. -f1`
> -		cat $f >> $cwd${crontabdir}/$user
> -		rm $f
> +	  user=`basename $f | cut -d. -f1`
> +		if [[ $user != "*" ]] ; then 

No reason to make it more complicated than needed.

Why not just

    if [ "$f" != "$cwd/${crontabdir}/*.*" ] ; then

Saving calls to both basename and cut.

> +	    cat $f >> $cwd${crontabdir}/$user
> +  		rm $f
> +		fi  
>  	done
>  }
diff mbox

Patch

diff --git a/classes/image_crontab.oeclass b/classes/image_crontab.oeclass
index 32899a5..a2c09a5 100644
--- a/classes/image_crontab.oeclass
+++ b/classes/image_crontab.oeclass
@@ -6,8 +6,10 @@  image_preprocess_crontab () {
 	cwd=`pwd`
 	test -d $cwd/${crontabdir} || return 0
 	for f in $cwd/${crontabdir}/*.* ; do
-		user=`basename $f | cut -d. -f1`
-		cat $f >> $cwd${crontabdir}/$user
-		rm $f
+	  user=`basename $f | cut -d. -f1`
+		if [[ $user != "*" ]] ; then 
+	    cat $f >> $cwd${crontabdir}/$user
+  		rm $f
+		fi  
 	done
 }