sync-web/sync.sh

72 行
3.5 KiB
Bash
実行ファイル

#!/bin/sh
IPPAN=192.168.0.1
DARK=192.168.0.2
TILDE=technicalsuwako@tilde.club
# 画像など
rsync -rtvzP ass ${IPPAN}:/var/www/htdocs/technicalsuwako.moe
rsync -rtvzP ass ${DARK}:/var/www/htdocs/technicalsuwako.moe
# ウエブサイト
## 一般ネット
### HTTP
rsync -rtvzP www ${IPPAN}:/var/www/htdocs/technicalsuwako.moe
### Gemini
cp www/blog.atom gemini
cp www/twtxt.txt gemini
cd gemini
find . -type f -name "blog.atom" -exec sed -i 's/https:\/\/technicalsuwako\.moe/gemini:\/\/technicalsuwako\.moe/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/https:\/\/technicalsuwako\.moe/gemini:\/\/technicalsuwako\.moe/g' {} +
cd ..
rsync -rtvzP gemini/* ${IPPAN}:/var/gemini/technicalsuwako.moe
## ダークネット
rm -rf tor i2p public_html
cp -r www tor
cp -r www i2p
### 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' {} +
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' {} +
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 ..
### 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' {} +
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' {} +
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 ..
### 両方同期
rsync -rtvzP tor ${DARK}:/var/www/htdocs/technicalsuwako.moe
rsync -rtvzP i2p ${DARK}:/var/www/htdocs/technicalsuwako.moe
## ティルデ
cp -r www public_html
cd public_html
find . -type f -name "*.html" -exec sed -i 's/href="\//href="\/\~technicalsuwako\//g' {} +
find . -type f -name "*.html" -exec sed -i 's/src="\//src="\/\~technicalsuwako\//g' {} +
find . -type f -name "*.css" -exec sed -i 's/static/\~technicalsuwako\/static/g' {} +
cd ..
rsync -rtvzP public_html ${TILDE}:/home/technicalsuwako