index : devops | |
Archlinux32 devs' convenience-scripts | gitolite user |
summaryrefslogtreecommitdiff |
-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 |