[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apt cron script changes



On Wed, 2006-04-19 at 13:06 +0200, Hiren Patel wrote:
> greetings.
> 
> i made what i think are improvements to the /etc/cron.daily/apt script.
[...]

Just a very quick comment:

>  #!/bin/sh
>  #

If the shebang line specifies /bin/sh then you're restricted by Policy
to only using POSIX-compliant features. Which means you can't do the
following:
 
[...]
> +    if [[ "$#" -ne 2 ]]; then
[...]
> +    local file="$1"
[...]
> +	if [[ "$file_mod_time" =~ '^[0-9]{4}-[0-9]{2}-[0-9]{2}$' ]]; then

since none of [[, local and =~ are part of POSIX / SUS.

[...]
> +    if ! [[ "$MaxAge" -ge 0 && "$MinAge" -ge 0 && "$MaxSize" -ge 0 ]]; then

Likewise:

  if ! ( [ "$MaxAge" -ge 0 ] && [ "$MinAge" -ge 0 ] && [ "$MaxSize" - ge
0 ] ); then

(although I'd personally remove the negation and make it:

  if [ "$MaxAge" -lt 0 ] || [ "$MinAge" - lt 0 ] || [ "$MaxSize" -lt
0 ]; then

)

Regards,

Adam



Reply to: