diff --git a/sync.sh b/sync.sh index 1a90d05..5f30546 100755 --- a/sync.sh +++ b/sync.sh @@ -1,17 +1,20 @@ #!/bin/sh -IPPAN=192.168.0.1 -DARK=192.168.0.2 +SRV=192.168.10.103 TILDE=technicalsuwako@tilde.club +# 創作 +./gostatic -v config +./gostatic -v tuifig + # 画像など -rsync -rtvzP ass ${IPPAN}:/var/www/htdocs/technicalsuwako.moe -rsync -rtvzP ass ${DARK}:/var/www/htdocs/technicalsuwako.moe +rsync -rtvzP ass ${SRV}:/var/www/htdocs/technicalsuwako.moe # ウエブサイト ## 一般ネット ### HTTP -rsync -rtvzP www ${IPPAN}:/var/www/htdocs/technicalsuwako.moe +rsync -rtvzP www ${SRV}:/var/www/htdocs/technicalsuwako.moe +rsync -rtvzP txt ${SRV}:/var/www/htdocs/technicalsuwako.moe ### Gemini cp www/blog.atom gemini @@ -23,45 +26,64 @@ find . -type f -name "blog.atom" -exec sed -i 's/\/" rel="alt/\.gmi" rel="alt/g' find . -type f -name "twtxt.txt" -exec sed -i 's/\/*$//' {} + find . -type f -name "twtxt.txt" -exec sed -i 's/blog\/.*/blog\/\0\.gmi/g' {} + find . -type f -name "twtxt.txt" -exec sed -i 's/https:\/\/technicalsuwako\.moe/gemini:\/\/technicalsuwako\.moe/g' {} + +find . -type f -name "twtxt.txt" -exec sed -i 's/https:\/\/076\.moe/gemini:\/\/076\.moe/g' {} + cd .. rsync -rtvzP gemini/* ${IPPAN}:/var/gemini/technicalsuwako.moe ## ダークネット -rm -rf tor i2p public_html +rm -rf tor i2p public_html ttor ti2p cp -r www tor cp -r www i2p +cp -r txt ttor +cp -r txt ti2p -### Tor -cd tor -find . -type f -name "*.html" -exec sed -i 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd\.onion/g' {} + -find . -type f -name "*.html" -exec sed -i 's/https:\/\/076\.moe/http:\/\/7dt6irsmfvbrtgn4nuah56kky6mvr472fbwwaltuxpf26qdqkdhfvnqd\.onion/g' {} + -find . -type f -name "*.html" -exec sed -i 's/https:\/\/stopsdgs\.076\.moe/http:\/\/stopsdgs\.7dt6irsmfvbrtgn4nuah56kky6mvr472fbwwaltuxpf26qdqkdhfvnqd\.onion/g' {} + +henko() { + local f=$1 + local o=$2 + local n=$3 -find . -type f -name "blog.atom" -exec sed -i 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd\.onion/g' {} + -find . -type f -name "blog.atom" -exec sed -i 's/https:\/\/076\.moe/http:\/\/7dt6irsmfvbrtgn4nuah56kky6mvr472fbwwaltuxpf26qdqkdhfvnqd\.onion/g' {} + + for ex in "html" "atom" "txt"; do + case $ex in + "html") fn="*.html" ;; + "atom") fn="blog.atom" ;; + "txt") fn="twtxt.txt" ;; + esac -find . -type f -name "twtxt.txt" -exec sed -i 's/https:\/\/technicalsuwako\.moe/http:\/\/7dt6irsmfvbrtgn4nuah56kky6mvr472fbwwaltuxpf26qdqkdhfvnqd\.onion/g' {} + -find . -type f -name "twtxt.txt" -exec sed -i 's/https:\/\/076\.moe/http:\/\/7dt6irsmfvbrtgn4nuah56kky6mvr472fbwwaltuxpf26qdqkdhfvnqd\.onion/g' {} + -cd .. + find "$f" -type f -name "$fn" -exec sed -i "s|$o|$n|g" {} + + done +} -### I2P -cd i2p -find . -type f -name "*.html" -exec sed -i 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.technicalsuwako\.i2p/g' {} + -find . -type f -name "*.html" -exec sed -i 's/https:\/\/076\.moe/http:\/\/076\.i2p/g' {} + -find . -type f -name "*.html" -exec sed -i 's/https:\/\/stopsdgs\.076\.moe/http:\/\/stopsdgs\.076\.i2p/g' {} + +kosin() { + local f=$1 + local m=$2 -find . -type f -name "blog.atom" -exec sed -i 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.technicalsuwako\.i2p/g' {} + -find . -type f -name "blog.atom" -exec sed -i 's/https:\/\/076\.moe/http:\/\/076\.i2p/g' {} + + cd "$f" || exit + while IFS= read -r line; do + henko "$f" "${line%%,*}" "${line##*,}" + done <<< "$m" + cd .. +} -find . -type f -name "twtxt.txt" -exec sed -i 's/https:\/\/technicalsuwako\.moe/http:\/\/technicalsuwako\.i2p/g' {} + -find . -type f -name "twtxt.txt" -exec sed -i 's/https:\/\/076\.moe/http:\/\/076\.i2p/g' {} + -cd .. +tormap="https://ass.technicalsuwako.moe,http://ass.6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion +https://076.moe,http://7dt6irsmfvbrtgn4nuah56kky6mvr472fbwwaltuxpf26qdqkdhfvnqd.onion" +i2pmap="https://ass.technicalsuwako.moe,http://ass.technicalsuwako.i2p +https://076.moe,http://076.i2p" +dir=("tor" "ttor" "i2p" "ti2p") + +for d in "${dir[@]}"; do + if [[ $d == "tor" || $d == "ttor" ]]; then + kosin "$d" "$tormap" + else + kosin "$d" "$i2pmap" + fi +done ### 両方同期 -rsync -rtvzP tor ${DARK}:/var/www/htdocs/technicalsuwako.moe -rsync -rtvzP i2p ${DARK}:/var/www/htdocs/technicalsuwako.moe +for d in "${dir[@]}"; do + rsync -rtvzP ${d} ${SRV}:/var/www/htdocs/technicalsuwako.moe +done -## ティルデ +## ティルデHTTP cp -r www public_html cd public_html find . -type f -name "*.html" -exec sed -i 's/href="\//href="\/\~technicalsuwako\//g' {} + @@ -69,3 +91,18 @@ find . -type f -name "*.html" -exec sed -i 's/src="\//src="\/\~technicalsuwako\/ find . -type f -name "*.css" -exec sed -i 's/static/\~technicalsuwako\/static/g' {} + cd .. rsync -rtvzP public_html ${TILDE}:/home/technicalsuwako + +## ティルデGMI +rm -rf public_gemini +cp -r gemini public_gemini +rm -rf public_gemini/static +cd public_gemini +find . -type f -name "blog.atom" -exec sed -i 's/gemini:\/\/technicalsuwako\.moe/gemini:\/\/tilde\.club\/\~technicalsuwako/g' {} + +find . -type f -name "blog.atom" -exec sed -i 's/\/<\/id>/\.gmi<\/id>/g' {} + +find . -type f -name "blog.atom" -exec sed -i 's/\/" rel="alt/\.gmi" rel="alt/g' {} + +find . -type f -name "twtxt.txt" -exec sed -i 's/\/*$//' {} + +find . -type f -name "twtxt.txt" -exec sed -i 's/blog\/.*/blog\/\0\.gmi/g' {} + +find . -type f -name "twtxt.txt" -exec sed -i 's/gemini:\/\/technicalsuwako\.moe/gemini:\/\/tilde\.club\/\~technicalsuwako/g' {} + +find . -type f -name "*.gmi" -exec sed -i 's/=> \//=> \/\~technicalsuwako\//g' {} + +cd .. +rsync -rtvzP public_gemini ${TILDE}:/home/technicalsuwako