From a9e86502129b92ddb62f6034aaa1a4bc10c4214b Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 1 Apr 2013 19:26:55 +0200 Subject: [PATCH] crontab.d/update.sh: Expand $HOME when changing $PATH in crontab files. --- crontab.d/update.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crontab.d/update.sh b/crontab.d/update.sh index ebffb99..05519bb 100755 --- a/crontab.d/update.sh +++ b/crontab.d/update.sh @@ -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 -- 2.44.1