Don't overwrite gophermap if it already exists

This commit is contained in:
~nytpu 2020-05-26 13:27:33 -04:00
parent 07303cf5e3
commit fa6d90a59c
1 changed files with 12 additions and 10 deletions

22
bb.sh
View File

@ -860,16 +860,18 @@ make_gophermap() {
ln -s "${HOME}/public_html/blog/" "${HOME}/public_gopher/blog" ln -s "${HOME}/public_html/blog/" "${HOME}/public_gopher/blog"
fi fi
cat <<- 'EOF' > $HOME/public_html/blog/gophermap if [ ! -f "${HOME}/public_gopher/blog/gophermap" ]; then
#!/bin/bash cat <<- 'EOF' > $HOME/public_html/blog/gophermap
echo -e "my bashblog posts\n" #!/bin/bash
user=$(stat -c '%U' .) echo -e "my bashblog posts\n"
for post in $(ls -t *.md); do user=$(stat -c '%U' .)
post=$(basename $post) for post in $(ls -t *.md); do
echo -e "0$post\t/~$user/blog/$post\ttilde.team\t70" post=$(basename $post)
done echo -e "0$post\t/~$user/blog/$post\ttilde.team\t70"
EOF done
chmod +x $HOME/public_html/blog/gophermap EOF
chmod +x $HOME/public_html/blog/gophermap
fi
chmod 644 *.md chmod 644 *.md
} }