X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=crontab.d%2Fupdate.sh;h=173142ec214db7ddb29eed6ec690704ced1a97ed;hb=44b2d1be3a927212884c91d2bfe199bcea4f1c92;hp=ebffb990bfa061479bf25553efd764ed48279c2d;hpb=749d4711a8d98f6102668dc3e186c639f7f50db2;p=config%2Fdotfiles.git diff --git a/crontab.d/update.sh b/crontab.d/update.sh index ebffb99..173142e 100755 --- a/crontab.d/update.sh +++ b/crontab.d/update.sh @@ -52,9 +52,8 @@ echo "###################################" >> "$CRONTAB" echo >> "$CRONTAB" echo "# It was generated from '$DIRECTORY/*' on `date -R`." >> "$CRONTAB" -# Enforce C sort order ($LANGUAGE is a GNU extension). +# Enforce C sort order. LC_ALL=C -LANGUAGE=C NO_MATCHES= for file in "$DIRECTORY"/crontab.*; do @@ -70,12 +69,16 @@ for file in "$DIRECTORY"/crontab.*; do echo >> "$CRONTAB" echo "## $file:" >> "$CRONTAB" + # Strip licenses, multiple empty lines and fix $HOME variables in PATH + # (cron doesn't expand variables). START_REGEX='^# This [a-zA-Z]* is free software: you can redistribute it' END_REGEX='^# along with this [a-zA-Z]*. If not, see <[^>]*>\.' < "$file" sed -e "/$START_REGEX/,/$END_REGEX/ d" \ -e "/^#[ ]*$/ d" \ -e "/^# Copyright (C) [0-9][0-9]* / d" \ | cat --squeeze-blank \ + | sed "/^PATH/ s:\$HOME:$HOME:g" \ + | sed 's/RAND_SLEEP \([0-9]*\)/sleep `perl -e "srand; print int rand \1;"`/' \ >> "$CRONTAB" done