site

My personal website.

Date: Fri, 16 Jul 2021 00:06:26 +0200

Preserve symbolic links in generate

Diffstat:

M generate                            |      11 ++++++++++-

1 file changed, 10 insertions(+), 1 deletion(-)

@@ -210,7 +210,7 @@ escape() {
 rm -rf "$dir"
 mkdir "$dir"
 cp -rf ./* "$dir"
-files="$(find "$dir" -name '*.gmi')"
+files="$(find "$dir" -name '*.gmi' -type f)"
 
 while read -r file <&4; do
     awk "$program" "$file" > "$(printf "%s" "$file" | sed "s/\.gmi$/.$extension/")"
@@ -218,4 +218,13 @@ done 4<< EOF
 $files
 EOF
 
+links="$(find "$dir" -name '*.gmi' -type l)"
+while read -r link <&4; do
+    path="$(readlink "$link")"
+    unlink "$link"
+    ln -s "$(printf "%s" "$path" | sed "s/\.gmi$/.$extension/")" "$(printf "%s" "$link" | sed "s/\.gmi$/.$extension/")"
+done 4<< EOF
+$links
+EOF
+
 rm -f $files