summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xarchive40
1 files changed, 40 insertions, 0 deletions
diff --git a/archive b/archive
index 4b7aef4..c2e810e 100755
--- a/archive
+++ b/archive
@@ -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