don't write directly to $index, use proxy $indexfile first
This commit is contained in:
parent
e2a86b3b6b
commit
8598ef396b
14
gemlog.sh
14
gemlog.sh
|
@ -42,7 +42,7 @@ get_post_title() {
|
|||
}
|
||||
|
||||
make_atom() {
|
||||
echo "Making Atom"
|
||||
echo "Bulding atom feed..."
|
||||
|
||||
atomfile="$gemlog_feed.$RANDOM"
|
||||
while [[ -f $atomfile ]]; do atomfile="$gemlog_feed.$RANDOM"; done
|
||||
|
@ -88,7 +88,11 @@ EOF
|
|||
}
|
||||
|
||||
build_entries() {
|
||||
echo "Building entries"
|
||||
echo "Building index..."
|
||||
|
||||
indexfile="$index.$RANDOM"
|
||||
while [[ -f $indexfile ]]; do indexfile="$index.$RANDOM"; done
|
||||
|
||||
{
|
||||
# header of the page (above the posts list)
|
||||
sed 's/$/\r/g' << 'EOF'
|
||||
|
@ -124,7 +128,10 @@ EOF
|
|||
|
||||
=> https://tildegit.org/nytpu/gemlog.sh generated with gemlog.sh
|
||||
EOF
|
||||
} 3>&1 >"$index"
|
||||
} 3>&1 >"$indexfile"
|
||||
|
||||
mv "$indexfile" "$index"
|
||||
chmod 644 "$index"
|
||||
}
|
||||
|
||||
toot() {
|
||||
|
@ -133,6 +140,7 @@ toot() {
|
|||
read -r -p "do you want to toot the newest post? [y/N] " response
|
||||
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]
|
||||
then
|
||||
echo "tooting..."
|
||||
# change this if you want the toot to have different content
|
||||
printf "new gemlog post: ${title}\n\ngemini://nytpu.com/gemlog/${filename}" | toot post
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue