website-mirror/haikumirror.sh

48 lines
1.6 KiB
Bash
Raw Normal View History

#/bin/bash
# Change the following values to configure your mirror
# Path to the Hugo binary
HUGO_PATH="/path/to/hugo"
# The mirror website title
MIRROR_TITLE="Haiku Project (Yann64's Mirror)"
# The mirror base URL (must end with a slash '/')
MIRROR_BASEURL="https://barbel.synology.me/haiku/"
# Server base directory
MIRROR_ROOTPATH="/opt/http"
# Full path for Haiku site mirror
MIRROR_LOCALPATH="/opt/http/haiku"
# Update main site to latest version
echo "==> Clone website from the official repository :"
git clone https://github.com/haiku/website.git
cd website
sed -i "s/title = \"Haiku Project\"/title = \"$MIRROR_TITLE\"/" ./config.toml
sed -i "s@baseURL = \"https://www.haiku-os.org/\"@baseURL = \"$MIRROR_BASEURL\"@" ./config.toml
# Uncomment following lines if you want to change tickets source information
#sed -i "s@'https://cgit.haiku-os.org/haiku/commit/?id='@'https://git.barbel.synology.me/Haiku/haiku/commit/'@" ./static/js/activity.js
#sed -i "s@https://cgit.haiku-os.org/haiku/log/@https://git.barbel.synology.me/Haiku/haiku/commits/branch/master@ " ./themes/shijin4/layouts/partials/home.html
echo "==> Site generation using Hugo :"
$HUGO_PATH
echo "==> Copy files to destination forlder: "$MIRROR_LOCALPATH
cd public
cp -r * $MIRROR_LOCALPATH
cp -r ./images $MIRROR_ROOTPATH
echo "==> Cleaning"
cd ../..
rm -rf ./website
# Update userguide to latest version
echo "==> Clone userguide from the official repository :"
git clone "https://review.haiku-os.org/userguide"
cd userguide
echo "==> Copy files to destination forlder: $MIRROR_LOCALPATH/docs"
cp -r * "$MIRROR_LOCALPATH/docs"
echo "==> Cleaning"
cd ..
rm -rf ./userguide
echo "Done !"