diff --git a/append_file.sh b/append_file.sh index e41bfc2..584fcec 100755 --- a/append_file.sh +++ b/append_file.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +set -Eeuo pipefail +trap cleanup SIGINT SIGTERM ERR EXIT # append_file.sh # This script is part of the website-to-other project, which converts my @@ -21,7 +23,11 @@ WebTextDir="/www/nz/s/scm/text" +echo "Append file..." + # Append the previous index.html text file to the new index.html text file + cat $WebTextDir/index.html-04 >> $WebTextDir/index.html-05 exit 0 + diff --git a/backup_file.sh b/backup_file.sh index b344b9f..408b4d2 100755 --- a/backup_file.sh +++ b/backup_file.sh @@ -21,7 +21,11 @@ WebTextDir="/www/nz/s/scm/text" -# Make a backup of the index.html file +echo "Backup file..." + +# Make a backup of the index.html file + cp $WebTextDir/index.html $WebTextDir/index.html.old exit 0 + diff --git a/clean_up.sh b/clean_up.sh index 0735492..8d8f44f 100755 --- a/clean_up.sh +++ b/clean_up.sh @@ -1,6 +1,6 @@ #!/usr/pkg/bin/bash -# cleanup.sh +# clean_up.sh # This script is part of the website-to-other project, which converts my # website to other formats. Unless the debug option is invoked, it removes # files created during the conversion process. @@ -23,11 +23,15 @@ WebDir="/sdf/arpa/ns/s/scm/html" TextWebDir="/sdf/arpa/ns/s/scm/html/text" +echo "Clean up..." + # Remove the backed up index.html of the modern website + rm $WebDir/index.html~ # Remove the backed up index.html of the text-based website and # the converted text files + rm $TextWebDir/index.html~ rm $TextWebDir/index.html.old rm $TextWebDir/index.html-01 @@ -38,3 +42,4 @@ rm $TextWebDir/index.html-05 rm $TextWebDir/index.html-06 exit 0 + diff --git a/cluster_plan.sh b/cluster_plan.sh index 5f6b00e..6458250 100755 --- a/cluster_plan.sh +++ b/cluster_plan.sh @@ -21,7 +21,11 @@ GopherDir="/ftp/pub/users/scm" +echo "Cluster plan..." + # Write a cluster .plan file from the Gopher index text file + cat $GopherDir/posts > $HOME/.plan exit 0 + diff --git a/convert_file.sh b/convert_file.sh index 8eb7ae2..144149a 100755 --- a/convert_file.sh +++ b/convert_file.sh @@ -21,7 +21,11 @@ WebTextDir="/www/nz/s/scm/text" +echo "Convert file" + # Convert the modified index.html file to an index.html text file + html2text -width 65 -o $WebTextDir/index.html-02 $WebTextDir/index.html-01 exit 0 + diff --git a/convert_website.sh b/convert_website.sh index 46a9b80..557b477 100755 --- a/convert_website.sh +++ b/convert_website.sh @@ -32,7 +32,7 @@ convert_file () { } remove_control () { - sh $HOME/website-to-other/remote_control.sh + sh $HOME/website-to-other/remove_control.sh } remove_blank () { @@ -59,8 +59,8 @@ gopher_map () { sh $HOME/website-to-other/gopher_map.sh } -gemini_posts () { - sh $HOME/website-to-other/gemini_posts.sh +gemini_post () { + sh $HOME/website-to-other/gemini_post.sh } cluster_plan () { @@ -84,7 +84,7 @@ gopher_repo () { } clean_up () { - sh $HOME/website-to-other/cleanup.sh + sh $HOME/website-to-other/clean_up.sh } backup_file @@ -103,4 +103,5 @@ gopher_perms gopher_repo clean_up -exit 0 +exit 0 + diff --git a/gemini_posts.sh b/gemini_post.sh similarity index 95% rename from gemini_posts.sh rename to gemini_post.sh index 35c7aec..c33c4ad 100755 --- a/gemini_posts.sh +++ b/gemini_post.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# gemini_posts.sh +# gemini_post.sh # This script is part of the website-to-other project, which converts my # website to other formats. @@ -21,7 +21,11 @@ GopherDir="/ftp/pub/users/scm" +echo "Gemini post..." + # Write a Gemini index.gmi from the Gopher posts file + cat $GopherDir/posts > $GopherDir/index.gmi exit 0 + diff --git a/gopher_map.sh b/gopher_map.sh index 1fabd7b..38af7fe 100755 --- a/gopher_map.sh +++ b/gopher_map.sh @@ -21,7 +21,11 @@ GopherDir="/ftp/pub/users/scm" +echo "Gopher map..." + # Write gophermap file + cp $HOME/gopher/gophermap $GopherDir/gophermap exit 0 + diff --git a/gopher_perms.sh b/gopher_permision.sh similarity index 89% rename from gopher_perms.sh rename to gopher_permision.sh index 8a8ba63..b3ddccd 100755 --- a/gopher_perms.sh +++ b/gopher_permision.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash +set -Eeuo pipefail +trap cleanup SIGINT SIGTERM ERR EXIT -# gopher_perms.sh +# gopher_permisson.sh # This script is part of the website-to-other project, which converts my # website to other formats. @@ -21,7 +23,11 @@ GopherDir="/ftp/pub/users/scm" +echo "Gopher permissions..." + # Set the correct Gopher and Gemini permissions + chmod -R 754 $GopherDir exit 0 + diff --git a/gopher_posts.sh b/gopher_posts.sh index 9046b5b..fd9fe57 100755 --- a/gopher_posts.sh +++ b/gopher_posts.sh @@ -22,7 +22,11 @@ GopherDir="/ftp/pub/users/scm" WebTextDir="/www/nz/s/scm/text" +echo "Gopher posts..." + # Write the Gopher posts file from the index.html text file + cat $WebTextDir/index.html-06 > $GopherDir/posts exit 0 + diff --git a/gopher_repo.sh b/gopher_repo.sh index 06ed412..4870d97 100755 --- a/gopher_repo.sh +++ b/gopher_repo.sh @@ -21,7 +21,11 @@ GopherDir="/ftp/pub/users/scm" +echo "Gopher site..." + # Copy the Gopher posts to the Gopher respository + cp $GopherDir/posts $HOME/gophersite exit 0 + diff --git a/insert_break.sh b/insert_break.sh index e00a3f9..2869188 100755 --- a/insert_break.sh +++ b/insert_break.sh @@ -21,7 +21,11 @@ WebTextDir="/www/nz/s/scm/text" -# Where there are blank lines in index.html file insert the
HTML tag +echo "Insert break..." + +# Where there are blank lines in the index.html file insert the
HTML tag + sed 's/^$/
/' $WebTextDir/index.html > $WebTextDir/index.html-01 exit 0 + diff --git a/meta_plan.sh b/meta_plan.sh index 5b728ad..77f3bd6 100755 --- a/meta_plan.sh +++ b/meta_plan.sh @@ -20,6 +20,8 @@ # along with this program. If not, see . # Write the MetaArray .plan file from the cluster .plan file + scp $HOME/.plan scm@ma.sdf.org:/meta/s/scm/.plan exit 0 + diff --git a/remove_blank.sh b/remove_blank.sh index 6f73075..f5ff3b2 100755 --- a/remove_blank.sh +++ b/remove_blank.sh @@ -22,6 +22,8 @@ WebTextDir="/www/nz/s/scm/text" # Remove the blank lines from the top of the index.html text file + sed '1,13d' $WebTextDir/index.html-03 > $WebTextDir/index.html-04 exit 0 + diff --git a/remove_control.sh b/remove_control.sh index 1d56d84..56daa54 100755 --- a/remove_control.sh +++ b/remove_control.sh @@ -21,7 +21,10 @@ WebTextDir="/www/nz/s/scm/text" +echo "Remove control..." + # Remove the control characters from the index.html text file + cat $WebTextDir/index.html-02 | col -b -x > $WebTextDir/index.html-03 exit 0