commit 9a591ec85f4822d4c59cbeb268b18d7392659cc2 parent 3001b0deeceb1b42f3c4dde38d6e1940b6991020 Author: Matsuda Kenji <contact2655@matsudakenji.xyz> Date: Tue, 14 Dec 2021 18:42:01 +0900 modify script Diffstat:
M | bin/update | | | 16 | +++++++++------- |
M | pub/.files | | | 1 | - |
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/bin/update b/bin/update @@ -5,19 +5,21 @@ man=$(pwd)/man pub=$(pwd)/pub url="https://www.matsudakenji.xyz" +ignore=$(printf ' ! -name "." ! -path "*/_*" ! -path "*/.*" ') + list_dirs(){ - cd "$1" && eval "find . -type d ! -name '.' ! -path '*/_*'" + cd "$man" && eval "find . -type d $ignore" } list_dependent_files(){ e="\\( -name '*.html' -o -name '*.css' -o -name '*.js' \\)" - cd "$1" && eval "find . -type f ! -name '.' ! -path '*/_*' $e" + cd "$man" && eval "find . -type f $ignore $e" } list_files_to_replace(){ - fs=$(cd "$1" && eval "find . -type f ! -name '.' -newer $2") + fs=$(cd "$man" && eval "find . -type f ! -name '.' -newer $pub/.files") if echo "$fs" | grep -qE '^./_.*\.html$|^./_.*\.js$|^./_.*\.css$'; then - list_dependent_files "$1" + list_dependent_files else echo "$fs" fi @@ -37,12 +39,12 @@ render_sitemap(){ echo '</urlset>' } -list_dirs "$man" | (cd "$man" && cpio -pdu "$pub") +list_dirs | (cd "$man" && cpio -pdu "$pub") fs=$( if [ -f "$pub/.files" ]; then - list_files_to_replace "$man" "$pub"/.files + list_files_to_replace else - cd "$man" && find . -type f ! -name '.' ! -path '*/_*' + cd "$man" && eval "find . -type f $ignore" fi ) if [ -n "$fs" ]; then diff --git a/pub/.files b/pub/.files @@ -1,2 +1 @@ -./blog/posts/20211214.html ./blog/blog_index.html