use mktemp(1) for temporary files

typo
Alessandro Mauri 3 years ago
parent 2d7d0e7f22
commit a5e0be8a3f
  1. 14
      rivet.sh

@ -54,7 +54,7 @@ convert() {
infile="$1" infile="$1"
extension="${infile##*.}" extension="${infile##*.}"
if [ "$extension" = 'md' ]; then if [ "$extension" = 'md' ]; then
tmpfile="tmpconvfile.tmp" tmpfile="$(mktemp)"
outfile="${infile%md}html" outfile="${infile%md}html"
cp "$infile" "$tmpfile" cp "$infile" "$tmpfile"
lowdown --html-no-skiphtml --html-no-escapehtml -s -Thtml \ lowdown --html-no-skiphtml --html-no-escapehtml -s -Thtml \
@ -108,8 +108,8 @@ unset src
headerfile=$srcdir/_header.html headerfile=$srcdir/_header.html
footerfile=$srcdir/_footer.html footerfile=$srcdir/_footer.html
metafile=$srcdir/_metadata.html metafile=$srcdir/_metadata.html
objlist=objlist.tmp objlist="$(mktemp)"
objdate=objdate.tmp objdate="$(mktemp)"
# Check if index.md is present # Check if index.md is present
if ! [ -e "$srcdir"/index.md ]; then if ! [ -e "$srcdir"/index.md ]; then
@ -181,7 +181,7 @@ done < "$objlist"
sed -i -e 's/\.md$/\.html/' "$objlist" sed -i -e 's/\.md$/\.html/' "$objlist"
# Create a list that contains the links to all html files # Create a list that contains the links to all html files
linklist=linklist.tmp linklist="$(mktemp)"
cp -f "$objlist" "$linklist" cp -f "$objlist" "$linklist"
sed -i -e "s/^$destdir//" -e "s/^/$prefix:\/\/$domain/" "$linklist" sed -i -e "s/^$destdir//" -e "s/^/$prefix:\/\/$domain/" "$linklist"
@ -195,7 +195,7 @@ fi
# Prepare index file list # Prepare index file list
if ! [ "$SKIP_LIST" ]; then if ! [ "$SKIP_LIST" ]; then
tmpfile="linkindex.tmp" tmpfile="$(mktemp)"
rm -f "$tmpfile" rm -f "$tmpfile"
cat << EOF >> "$tmpfile" cat << EOF >> "$tmpfile"
<div id="map"> <div id="map">
@ -230,7 +230,7 @@ done
# Prepate the header # Prepate the header
if ! [ "$SKIP_HEADER" ]; then if ! [ "$SKIP_HEADER" ]; then
tmphead="tmpheadfile.tmp" tmphead="$(mktemp)"
cp "$headerfile" "$tmphead" cp "$headerfile" "$tmphead"
sed -i '1s/^/<header>/' "$tmphead" sed -i '1s/^/<header>/' "$tmphead"
echo '</header>' >> "$tmphead" echo '</header>' >> "$tmphead"
@ -243,7 +243,7 @@ fi
# Prepare the footer # Prepare the footer
if ! [ "$SKIP_FOOTER" ]; then if ! [ "$SKIP_FOOTER" ]; then
tmpfoot="tmpfootfile.tmp" tmpfoot="$(mktemp)"
cp "$footerfile" "$tmpfoot" cp "$footerfile" "$tmpfoot"
sed -i '1s/^/<footer>/' "$tmpfoot" sed -i '1s/^/<footer>/' "$tmpfoot"
echo '</footer>' >> "$tmpfoot" echo '</footer>' >> "$tmpfoot"

Loading…
Cancel
Save