index : devops | |
Archlinux32 devs' convenience-scripts | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-05-14 15:55:47 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-05-14 15:55:47 +0200 |
commit | 442c44aad056639748f91ca39c681215f042fc86 (patch) | |
tree | ae623817576a3a77cceb4a0bc46f1bd07d0a346c /archive | |
parent | b4e392fc2086e685c16c388c9736e95b8e749f4b (diff) |
-rwxr-xr-x | archive | 40 |
@@ -86,6 +86,46 @@ if [ ! -d "${todays_path}" ]; then done done done + rm -f \ + "${archive_root}/repos/last" \ + "${archive_root}/repos/week" \ + "${archive_root}/repos/month" + ln -s \ + "${todays_path}" \ + "${archive_root}/repos/last" + first_of_month=$( + find "${archive_root}/repos" -mindepth 3 -maxdepth 3 \ + | sed ' + s,^.*/\([^/]\+\)/\([^/]\+\)/\([^/]\+\)$,\1/\2 \3, + t + d + ' \ + | sort -k1r,1 -k2,2 \ + | head -n1 \ + | tr ' ' '/' + ) + ln -s \ + "${archive_root}/repos/${first_of_month}" \ + "${archive_root}/repos/month" + first_of_week=$( + find "${archive_root}/repos" -mindepth 3 -maxdepth 3 \ + | sed ' + s,^.*/\([^/]\+\)/\([^/]\+\)/\([^/]\+\)$,\1-\2-\3, + t + d + ' \ + | sort \ + | tail -n7 \ + | while read -r date; do + date '+%Y/%m/%d %G %V' -d "${date}" + done \ + | sort -k2r,3 -k1,1 \ + | head -n1 \ + | cut -d' ' -f1 + ) + ln -s \ + "${archive_root}/repos/${first_of_week}" \ + "${archive_root}/repos/week" fi # release lock |