diff --git a/cluster-web-to-other.sh b/cluster-web-to-other.sh index 057e78c..b75e072 100755 --- a/cluster-web-to-other.sh +++ b/cluster-web-to-other.sh @@ -1,91 +1,117 @@ -#/bin/sh +#/bin/bash month=$(date '+%m') year=$(date '+%Y') # -# Cluster +# Finger # -# Download the websites index HTML file - -wget -O /sdf/arpa/ns/s/scm/index.html https://scm.sdf.org - -# Download the websites posts HTML file - -wget -O /sdf/arpa/ns/s/scm/$month.html https://scm.sdf.org/posts/$year/$month.html - -# Convert the index HTML file to an index text file - -html2text -o /sdf/arpa/ns/s/scm/index -ascii -style pretty /sdf/arpa/ns/s/scm/index.html - -# Convert the posts HTML file to a text file - -html2text -o /sdf/arpa/ns/s/scm/$month -ascii -style pretty /sdf/arpa/ns/s/scm/$month.html - -# Write the footer text file from the index text file - -tail -n 15 /sdf/arpa/ns/s/scm/index > footer - -# Remove the posts header line from the index HTML file - -sed -i 's/

Posts<\/h3>//' /sdf/arpa/ns/s/scm/index.html - -# Remove the posts lines from the index HTML file - -sed -i "s/

{$year}<\/a><\/h4>//" /sdf/arpa/ns/s/scm/index.html - -# Remove the blank lines from the beginning of the index file - -sed -i '1d;2d;3d' /sdf/arpa/ns/s/scm/index - -# Remove the blank lines from the beginning of the posts file - -sed -i '1d;2d;3d' /sdf/arpa/ns/s/scm/$month - -# Remove the control characters from the index file - -cat /sdf/arpa/ns/s/scm/index | col -b -x > /sdf/arpa/ns/s/scm/index.sdf - -# Remove the control characters from the posts file - -cat /sdf/arpa/ns/s/scm/$month | col -b -x > /sdf/arpa/ns/s/scm/$month.sdf - -# Remove the control characters from the footer file - -cat /sdf/arpa/ns/s/scm/footer | col -b -x > /sdf/arpa/ns/s/scm/footer.sdf - -# Write the posts text file to the .plan cluster text file -# Change the head number as needed when the index.html file is changed - -head -n 5 index.sdf > /sdf/arpa/ns/s/scm/header -cat /sdf/arpa/ns/s/scm/$month.sdf > body -cat /sdf/arpa/ns/s/scm/header > /sdf/arpa/ns/s/scm/.plan -cat /sdf/arpa/ns/s/scm/body >> /sdf/arpa/ns/s/scm/.plan -cat /sdf/arpa/ns/s/scm/footer.sdf >> /sdf/arpa/ns/s/scm/.plan - -# Write the index text file to the root directory of Gopher - -cp /sdf/arpa/ns/s/scm/index.sdf /ftp/pub/users/scm/index - -# Write the posts text file to the posts directory of Gopher - -cp /sdf/arpa/ns/s/scm/$month.sdf /ftp/pub/users/scm/posts/$year/$month - -# Set the proper Gopher directory permissions - -chmod -R 754 /ftp/pub/users/scm - # -# Meta Array +# Gopher # -scp /sdf/arpa/ns/s/scm/.plan scm@ma.sdf.org:/meta/s/scm +gemini() +{ + # Download the index.html and month.html files + sftp scm@ma.sdf.org:/meta/s/scm/html/index.html /sdf/arpa/ns/s/scm/gemini + sftp scm@ma.sdf.org:/meta/s/scm/html/posts/$year/$month.html /sdf/arpa/ns/s/scm/gemini -scp /sdf/arpa/ns/s/scm/header scm@ma.sdf.org:/meta/gemini/scm/index.gmi + # Convert the index.html file to an index-e01 text file + html2text -o /sdf/arpa/ns/s/scm/gemini/index-e01 -ascii -style pretty /sdf/arpa/ns/s/scm/gemini/index.html -cat /sdf/arpa/ns/s/scm/body | ssh scm@ma.sdf.org "cat >> /meta/gemini/scm/index.gmi" + # Convert the month.html file to a month-e01 text file + html2text -o /sdf/arpa/ns/s/scm/gemini/$month-e01 -ascii -style pretty /sdf/arpa/ns/s/scm/gemini/$month.html -scp /sdf/arpa/ns/s/scm/$month.sdf scm@ma.sdf.org:/meta/gemini/scm/posts/$year/$month.gmi + # Remove the blank lines from the beginning of the index-e01 file + sed -i "1d;2d;3d" /sdf/arpa/ns/s/scm/gemini/index-e01 + + # Remove the blank lines from the beginning of the month-e01 file + sed -i "1d;2d;3d" /sdf/arpa/ns/s/scm/gemini/$month-e01 + + # Remove the control characters from the index-e01 file and write it as index-e02 + cat /sdf/arpa/ns/s/scm/gemini/index-e01 | col -b -x > /sdf/arpa/ns/s/scm/gemini/index-e02 + + # Remove the control characters from the month-e01 file and write it as month-e02 + cat /sdf/arpa/ns/s/scm/gemini/$month-e01 | col -b -x > /sdf/arpa/ns/s/scm/gemini/$month-e02 +} + +gemini + +# Write the head.gmi text file from the index.gmi text file +# The number determines which lines are written +#head -n 5 /sdf/arpa/ns/s/scm/gemini/index-gmi > /sdf/arpa/ns/s/scm/gemini/header.gmi + +# Write the footer.gmi text file from the index.gmi text file +#tail -n 15 /sdf/arpa/ns/s/scm/gemini/index-gmi > /sdf/arpa/ns/s/scm/gemini/footer.gmi + +# Write the index.gmi text file from the header.gmi and footer.gmi text files +#cat /sdf/arpa/ns/s/scm/gemini/header.gmi > /sdf/arpa/ns/s/scm/gemini/index.gmi +#cat /sdf/arpa/ns/s/scm/gemini/footer.gmi >> /sdf/arpa/ns/s/scm/gemini/index.gmi + +# # Remove the posts header line from the index.html file +# sed -i 's/

Posts<\/h3>//' /sdf/arpa/ns/s/scm/index.html + +# Remove the posts year line from the index HTML file +#sed -i "s/

{$year}<\/a><\/h4>//" /sdf/arpa/ns/s/scm/index.html + +# # Remove the blank lines from the beginning of the index file +# sed -i '1d;2d;3d' /sdf/arpa/ns/s/scm/index + +# # Remove the blank lines from the beginning of the posts file +# sed -i '1d;2d;3d' /sdf/arpa/ns/s/scm/$month + +# # Remove the control characters from the index file +# cat /sdf/arpa/ns/s/scm/index | col -b -x > /sdf/arpa/ns/s/scm/index.sdf + +# # Remove the control characters from the month (posts) text file and write +# # to the month.sdf text file +# cat /sdf/arpa/ns/s/scm/$month | col -b -x > /sdf/arpa/ns/s/scm/$month.sdf + +# # Remove the control characters from the footer file +# cat /sdf/arpa/ns/s/scm/footer | col -b -x > /sdf/arpa/ns/s/scm/footer.sdf + +# # Change the head number as needed when the top of the index.html file is +# # changed +# head -n 5 index.sdf > /sdf/arpa/ns/s/scm/header.sdf + +# # Create the body for the clusters .plan text file from the month.sdf text +# # file +# cat /sdf/arpa/ns/s/scm/$month.sdf > body.sdf + +# # Write the the dot plan Cluster text file +# cat /sdf/arpa/ns/s/scm/header.sdf > /sdf/arpa/ns/s/scm/.plan +# cat /sdf/arpa/ns/s/scm/body.sdf >> /sdf/arpa/ns/s/scm/.plan +# cat /sdf/arpa/ns/s/scm/footer.sdf >> /sdf/arpa/ns/s/scm/.plan + +# # Write the index text file to the root directory of Gopher from the +# # index.sdf text file +# cp /sdf/arpa/ns/s/scm/index.sdf /ftp/pub/users/scm/index + +# # Write the posts text file to the posts directory of Gopher from the +# # month.sdf text file +# cp /sdf/arpa/ns/s/scm/$month.sdf /ftp/pub/users/scm/posts/$year/$month + +# # Set the proper Gopher permissions +# chmod -R 754 /ftp/pub/users/scm + +# # +# # Meta Array +# # + +# # Write the MA dot plan text file from the clusters' dot plan text file +# scp /sdf/arpa/ns/s/scm/.plan scm@ma.sdf.org:/meta/s/scm + +# #sed -i "s/Gopher e.g. gopher gopher\:\/\/sdf.org:70\/1\/users\/scm\/gopher\//=> gopher\:\/\/sdf.org:70\/1\/users\/scm\/ Gopher" /sdf/arpa/ns/s/scm/footer.sdf + +# #scp /sdf/arpa/ns/s/scm/index.sdf scm@ma.sdf.org:/meta/gemini/scm/index.gmi + +# # Write the MA posts text file from the clusters' posts text file + +# cat /sdf/arpa/ns/s/scm/header > /sdf/arpa/ns/s/scm/index.gmi +# cat /sdf/arpa/ns/s/scm/body >> /sdf/arpa/ns/s/scm/index.gmi +# cat /sdf/arpa/ns/s/scm/footer.sdf >> /sdf/arpa/ns/s/scm/.plan + +# scp /sdf/arpa/ns/s/scm/$month.sdf scm@ma.sdf.org:/meta/gemini/scm/posts/$year/$month.gmi exit 0