2 # Encrypt dated weechatlog files older than one day to GPG target defined in
6 gpg_key=$(cat ~/.encrypt_target)
9 # Dirty hack: To avoid trouble with GPG key expiration, fake
10 # system to something reasonbly old (younger than key creation,
11 # older than expiration) by taking the mod datetime of
12 # /etc/hostname, which should have last be changed when the
14 hostname_mod_epoch=$(stat -c%Y /etc/hostname)
15 find . -regextype posix-egrep -regex '^.*/.*/.*\.[0-9]{4}-[0-9]{2}-[0-9]{2}\.weechatlog$' -type f -mtime +1 -exec gpg --recipient "${gpg_key}" --trust-model always --faked-system-time="${hostname_mod_epoch}" --encrypt {} \; -exec rm {} \;