Initialization of repository

This commit is contained in:
Cloud User 2019-05-17 08:00:14 -05:00
commit 9003f72a6c
2 changed files with 137 additions and 0 deletions

0
README.md Normal file
View File

137
lentry.sh Executable file
View File

@ -0,0 +1,137 @@
#!/bin/bash
echo -n "Enter Title: "
read title
echo -n "Enter Author Name: "
read author
echo -n "Enter Catalog Number: "
read cnumber
echo -n "Enter Description: "
read descrip
echo -n "Enter Date(format: 25 06 2005): "
read date
mkdir /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber
mv $1 /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber
touch /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
touch /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
# html header
echo "<!DOCTYPE html>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo "<html>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <head>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <title>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " Library of Eris" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " </title>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <link rel="stylesheet" href="https://www.libraryoferis.org/stylesheet.css">" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <link rel="apple-touch-icon" sizes="180x180" href="https://www.libraryoferis.org/apple-touch-icon.png">" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <link rel="icon" type="image/png" sizes="32x32" href="https://www.libraryoferis.org/favicon-32x32.png">" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <link rel="icon" type="image/png" sizes="16x16" href="https://www.libraryoferis.org/favicon-16x16.png">" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <link rel="manifest" href="https://www.libraryoferis.org/site.webmanifest">" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " </head>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <body>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <div id="header">" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <img src="https://www.libraryoferis.org/LOE.png">" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " </div>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <div id="menu">" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <a href="https://www.libraryoferis.org/">Home</a> ⋄ " >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <a href="https://www.libraryoferis.org/about.html">About</a> ⋄ " >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <a href="https://www.libraryoferis.org/links.html">Links</a> ⋄ " >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <a href="https://www.libraryoferis.org/contact.html">Contact</a>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " </div>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <div id="catalog">" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " </div>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <div id="catalog-menu" class="fisrstDiv"> " >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <a href="https://www.libraryoferis.org/catalog.html">Main Catalog</a>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <br>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " ⋄" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <br>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <a href="https://www.libraryoferis.org/books.html">Books</a>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <br>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " ⋄" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <br>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <a href="https://www.libraryoferis.org/documents.html">Documents</a>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <br>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " ⋄" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <br>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <a href="https://www.libraryoferis.org/periodicals.html">Periodicals</a>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <br>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " ⋄" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <br>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <a href="https://www.libraryoferis.org/posters.html">Posters</a>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <br>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " ⋄" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <br>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <a href="https://www.libraryoferis.org/miscellaneous.html">Miscellaneous</a>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " </div>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <div id="catalog-list" class="secondDiv">" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
# Generate Html Content
echo " <b>Title:</b> $title</p>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <b>Author:</b> $author</p>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <b>Catalog Number:</b> $cnumber</p>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <b>Description:</b> $descrip</p>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <b>Date Published:</b> $date</p>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
# Generate Gopher Content
echo "Title: $title" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo "" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo "Author: $author" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo "" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo "Catalog Number: $cnumber" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo "" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
# This section ensures that the description is kept to 67 lines and adds an extra t due to escape character
whole_title="Description: $descrip"
touch fold.tmp
echo "$whole_title" >> fold.tmp
fold_title="$(fold -w 67 -s fold.tmp)"
rm fold.tmp
echo "$fold_title" >> sed.tmp
final_title="$(sed 's/^t/tt/g' sed.tmp)"
rm sed.tmp
echo "$final_title" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo "" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo "Date Published: $date" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo "" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
# Determine link type
lastchars=${1: -3}
if [[ "$lastchars" == "txt" ]]; then
echo "[0|TXT|/library/catalog/$cnumber/$1|server|port]" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo " <b>Formats:</b> <a href="$1">TXT</a>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
elif [[ "$lastchars" == "pdf" ]]; then
echo "[9|PDF|/library/catalog/$cnumber/$1|server|port]" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo " <b>Formats:</b> <a href="$1">PDF</a>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
elif [[ "$lastchars" == "jpg" ]]; then
echo "[I|JPG|/library/catalog/$cnumber/$1|server|port]" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo " <b>Formats:</b> <a href="$1">JPG</a>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
elif [[ "$lastchars" == "gif" ]]; then
echo "[g|GIF|/library/catalog/$cnumber/$1|server|port]" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo " <b>Formats:</b> <a href="$1">GIF</a>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
else
echo "[0|TXT|/library/catalog/$cnumber/$1|server|port]" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.gph
echo " <b>Formats:</b> <a href="$1">TXT</a>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
fi
# Html footer
echo " </div>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <div class="clear"></div>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <div id="footer">" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <object type="text/html" width="900" height="32" data="https://www.libraryoferis.org/cgi-bin/ddate.cgi"/></object>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <br>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " <img src="https://www.libraryoferis.org/kopyleft.png"> All Rights Reversed" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " </div>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo " </body>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
echo "</html>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/index.html
# Update catalog for gopher and html
echo "[1|$cnumber $title|/library/catalog/$cnumber|server|port]" >> /var/lib/nethserver/vhost/libraryoferis/catalog/index.gph
count=$(cat /var/lib/nethserver/vhost/libraryoferis/.counter)
sed -i "${count}i <a href=\"https://www.libraryoferis.org/catalog/${cnumber}/index.html\">${cnumber} - ${title}</a>" /var/lib/nethserver/vhost/libraryoferis/catalog.html
sed -i "${count}i <br>" /var/lib/nethserver/vhost/libraryoferis/catalog.html
ad_num=$((count + 2))
echo "$ad_num" > /var/lib/nethserver/vhost/libraryoferis/.counter