technicalsuwako.moe/sync.sh

130 行
9.1 KiB
Bash
実行ファイル

#!/bin/sh
UNAME=$(uname)
SRV=192.168.0.103
RSYNCOPT="-rtvzP"
HTTPHOME=/var/www/htdocs/technicalsuwako.moe
GMIHOME=/var/gemini/technicalsuwako.moe
# 創作
./gostatic config
./gostatic tuifig
mv www/index.html www/index.xhtml
mv txt/index.html txt/index.xhtml
# 画像など
rsync ${RSYNCOPT} ass ${SRV}:${HTTPHOME}
# ウエブサイト
## 一般ネット
### HTTP
rsync ${RSYNCOPT} www ${SRV}:${HTTPHOME}
rsync ${RSYNCOPT} txt ${SRV}:${HTTPHOME}
### Gemini
cp www/blog.atom gemini
cp www/twtxt.txt gemini
cd gemini
if [ "${UNAME}" = 'FreeBSD' ]; then
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/technicalsuwako\.moe/gemini:\/\/technicalsuwako\.moe/g' {} +
find . -type f -name "blog.atom" -exec sed -i '' -e 's/\.xhtml<\/id>/\.gmi<\/id>/g' {} +
find . -type f -name "blog.atom" -exec sed -i '' -e 's/\.xhtml" rel="alt/\.gmi" rel="alt/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/\/*$//' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/\.xhtml/\.gmi/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e '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' {} +
else
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/\.xhtml<\/id>/\.gmi<\/id>/g' {} +
find . -type f -name "blog.atom" -exec sed -i 's/\.xhtml" 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/\.xhtml/\.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' {} +
fi
cd ..
rsync ${RSYNCOPT} gemini/* ${SRV}:${GMIHOME}
## ダークネット
### Tor
cp -r www tor
cp -r txt ttor
cd tor
if [ "${UNAME}" = 'FreeBSD' ]; then
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/technicalsuwako\.moe/http:\/\/6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion/g' {} +
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion/g' {} +
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/076\.moe/http:\/\/7dt6irsmfvbrtgn4nuah56kky6mvr472fbwwaltuxpf26qdqkdhfvnqd\.onion/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/https:\/\/technicalsuwako\.moe/http:\/\/6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/https:\/\/076\.moe/http:\/\/7dt6irsmfvbrtgn4nuah56kky6mvr472fbwwaltuxpf26qdqkdhfvnqd\.onion/g' {} +
else
find . -type f -name "blog.atom" -exec sed -i 's/https:\/\/technicalsuwako\.moe/http:\/\/6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.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:\/\/6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i 's/https:\/\/076\.moe/http:\/\/7dt6irsmfvbrtgn4nuah56kky6mvr472fbwwaltuxpf26qdqkdhfvnqd\.onion/g' {} +
fi
cd ../ttor
if [ "${UNAME}" = 'FreeBSD' ]; then
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/technicalsuwako\.moe/http:\/\/6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion/g' {} +
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion/g' {} +
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/076\.moe/http:\/\/7dt6irsmfvbrtgn4nuah56kky6mvr472fbwwaltuxpf26qdqkdhfvnqd\.onion/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/https:\/\/technicalsuwako\.moe/http:\/\/6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/https:\/\/076\.moe/http:\/\/7dt6irsmfvbrtgn4nuah56kky6mvr472fbwwaltuxpf26qdqkdhfvnqd\.onion/g' {} +
else
find . -type f -name "blog.atom" -exec sed -i 's/https:\/\/technicalsuwako\.moe/http:\/\/6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.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:\/\/6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.6qiatzlijtqo6giwvuhex5zgg3czzwrq5g6yick3stnn4xekw26zf7qd.onion/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i 's/https:\/\/076\.moe/http:\/\/7dt6irsmfvbrtgn4nuah56kky6mvr472fbwwaltuxpf26qdqkdhfvnqd\.onion/g' {} +
fi
cd ..
rsync ${RSYNCOPT} tor "${SRV}:${HTTPHOME}"
rsync ${RSYNCOPT} ttor "${SRV}:${HTTPHOME}"
### I2P
cp -r www i2p
cp -r txt ti2p
cd i2p
if [ "${UNAME}" = 'FreeBSD' ]; then
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/technicalsuwako\.moe/http:\/\/technicalsuwako\.i2p/g' {} +
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.technicalsuwako\.i2p/g' {} +
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/076\.moe/http:\/\/076\.i2p/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/https:\/\/technicalsuwako\.moe/http:\/\/technicalsuwako\.i2p/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.technicalsuwako\.i2p/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/https:\/\/076\.moe/http:\/\/076\.i2p/g' {} +
else
find . -type f -name "blog.atom" -exec sed -i 's/https:\/\/technicalsuwako\.moe/http:\/\/technicalsuwako\.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:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.technicalsuwako\.i2p/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i 's/https:\/\/076\.moe/http:\/\/076\.i2p/g' {} +
fi
cd ../ti2p
if [ "${UNAME}" = 'FreeBSD' ]; then
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/technicalsuwako\.moe/http:\/\/technicalsuwako\.i2p/g' {} +
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.technicalsuwako\.i2p/g' {} +
find . -type f -name "blog.atom" -exec sed -i '' -e 's/https:\/\/076\.moe/http:\/\/076\.i2p/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/https:\/\/technicalsuwako\.moe/http:\/\/technicalsuwako\.i2p/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/https:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.technicalsuwako\.i2p/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i '' -e 's/https:\/\/076\.moe/http:\/\/076\.i2p/g' {} +
else
find . -type f -name "blog.atom" -exec sed -i 's/https:\/\/technicalsuwako\.moe/http:\/\/technicalsuwako\.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:\/\/ass\.technicalsuwako\.moe/http:\/\/ass\.technicalsuwako\.i2p/g' {} +
find . -type f -name "twtxt.txt" -exec sed -i 's/https:\/\/076\.moe/http:\/\/076\.i2p/g' {} +
fi
cd ..
rsync ${RSYNCOPT} i2p "${SRV}:${HTTPHOME}"
rsync ${RSYNCOPT} ti2p "${SRV}:${HTTPHOME}"
## 掃除
rm -rf www tor i2p txt ttor ti2p