about summary refs log tree commit diff stats
path: root/pub.sh
diff options
context:
space:
mode:
authorAoi Koizumi <novaburst@kalli.st>2022-03-12 21:59:19 -0300
committerAoi Koizumi <novaburst@kalli.st>2022-03-12 21:59:19 -0300
commit7b10faf7494f396be6fe4131e1b562cc384f7c12 (patch)
tree72a049bd0de68bfb329659ff307dee21167a06ed /pub.sh
downloadmirror-world-7b10faf7494f396be6fe4131e1b562cc384f7c12.tar.gz
Reinitialize:Mirror-World()
Signed-off-by: Aoi Koizumi <novaburst@kalli.st>
Diffstat (limited to 'pub.sh')
-rwxr-xr-xpub.sh75
1 files changed, 75 insertions, 0 deletions
diff --git a/pub.sh b/pub.sh
new file mode 100755
index 0000000..772f9c5
--- /dev/null
+++ b/pub.sh
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+. pub.conf
+
+fn_clean() {
+	printf "Cleaning... \n"
+	find . -name "*.gmi" -delete
+}
+
+fn_generate() {
+	txt convert --type=gmi gmi/
+}
+
+fn_index() {
+	printf "Creating index.pck... \n"
+	txt index -t $title -a "$author" -l "$locations" -p "$peers"
+}
+
+fn_link() {
+	for p in gmi gph www;
+	do
+		txt file *.txt $p 2>&-
+	done
+}
+
+fn_unlink() {
+	for p in gmi gph www;
+	do
+		rm -f $p/*.txt
+	done
+}
+
+fn_upload_gmi() {
+	rsync -acv --exclude '*.txt' --exclude '.convert.conf' --delete gmi/ $username@$gmi_srv:$gmi_dir
+}
+
+fn_upload_gph() {
+	rsync -acv gph/ $username@$gph_srv:$gph_dir
+}
+
+fn_upload_www() {
+	rsync -acv www/ $username@$www_srv:$www_dir
+}
+
+fn_usage() {
+	printf "Usage [ clean | generate | index | link | upload ] \n"
+}
+
+main() {
+	case $1 in
+		clean) 
+			fn_clean 
+			;;
+		generate) 
+			fn_generate 
+			;;
+		index) 
+			fn_index 
+			;;
+		link)
+			fn_unlink
+			fn_link 
+			;;
+		upload) 
+			fn_upload_gmi
+			fn_upload_gph
+			fn_upload_www
+			;;
+		*) 
+			fn_usage 
+			;;
+	esac
+}
+
+main "$@"