Now updates gopher categories! Still no error handling.
This commit is contained in:
parent
20f046c816
commit
84e688f014
32
lentry.sh
32
lentry.sh
|
@ -2,13 +2,15 @@
|
|||
|
||||
echo -n "Enter Title: "
|
||||
read title
|
||||
echo -n "Enter Category Number(Books[1], Documents[2], Periodicals[3], Posters[4], Miscellaneous[5]): "
|
||||
read category
|
||||
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): "
|
||||
echo -n "Enter Date(format: 15 June 2005): "
|
||||
read date
|
||||
|
||||
|
||||
|
@ -128,10 +130,36 @@ echo " </body>" >> /var/lib/nethserver/vhost/libraryoferis/catalog/$cnumber/ind
|
|||
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
|
||||
|
||||
# Update category menus
|
||||
if [[ "$category" == "1" ]]; then
|
||||
catlist="books.lst"
|
||||
catgph="books.gph"
|
||||
cat_title="Discordian Books"
|
||||
elif [[ "$category" == "2" ]]; then
|
||||
catlist="documents.lst"
|
||||
catgph="documents.gph"
|
||||
cat_title="Discordian Documents"
|
||||
elif [[ "$category" == "3" ]]; then
|
||||
catlist="periodicals.lst"
|
||||
catgph="periodicals.gph"
|
||||
cat_title="Discordian Magazines and Newsletters"
|
||||
elif [[ "$category" == "4" ]]; then
|
||||
catlist="posters.lst"
|
||||
catgph="posters.gph"
|
||||
cat_title="A collection of Discordian posters\n Note: Some of these are individual posters and others are a\n collection."
|
||||
elif [[ "$category" == "5" ]]; then
|
||||
catlist="miscellaneous.lst"
|
||||
catgph="miscellaneous.gph"
|
||||
cat_title="Here's everything else"
|
||||
fi
|
||||
|
||||
echo "[1|$title|/library/catalog/$cnumber|server|port]" >> /var/gopher/library/lists/$catlist
|
||||
echo "" >> /var/gopher/library/$catgph | echo "$cat_title" > /var/gopher/library/$catgph
|
||||
cat /var/gopher/library/lists/$catlist | cut -c 4- | sed -e 's/^The \(.*\)/\1, The/' | sort | sed -e 's/\(.*\), The$/The \1/' | sed 's/^/\[1\|/' >> /var/gopher/library/$catgph
|
||||
|
|
Loading…
Reference in New Issue