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