]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
crontab.d/update.sh: Expand $HOME when changing $PATH in crontab files.
authorSimon Ruderich <simon@ruderich.org>
Mon, 1 Apr 2013 17:26:55 +0000 (19:26 +0200)
committerSimon Ruderich <simon@ruderich.org>
Mon, 1 Apr 2013 17:26:55 +0000 (19:26 +0200)
crontab.d/update.sh

index ebffb990bfa061479bf25553efd764ed48279c2d..05519bb4a14b0b901bc58f585954673e670de73a 100755 (executable)
@@ -70,12 +70,15 @@ 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" \
         >> "$CRONTAB"
 done