2023-03-24 12:21:56 +01:00
|
|
|
#!/bin/bash
|
2023-06-09 00:16:37 +02:00
|
|
|
set -e # Exit on any error
|
2023-07-23 12:21:08 +02:00
|
|
|
set -x # Echo all commands
|
|
|
|
|
|
|
|
# Configuration
|
|
|
|
WikiName="OcttKB"
|
|
|
|
WikiLoading="./Wiki-${WikiName}"
|
2023-03-24 15:45:03 +01:00
|
|
|
|
2023-03-24 16:34:36 +01:00
|
|
|
# Ensure important directories
|
2023-03-24 16:25:08 +01:00
|
|
|
mkdir -vp ./Repo
|
|
|
|
rm -rf ./Repo.tmp ./Output.tmp || true
|
2023-03-24 16:16:00 +01:00
|
|
|
|
2023-03-24 15:45:03 +01:00
|
|
|
# Export all tiddlers from the specific path of the HTML wiki
|
|
|
|
tiddlywiki \
|
2023-07-23 12:21:08 +02:00
|
|
|
${WikiLoading} \
|
2023-03-24 15:45:03 +01:00
|
|
|
--verbose \
|
|
|
|
--output ./Output.tmp \
|
2023-07-23 12:21:08 +02:00
|
|
|
--save "[prefix[\$:/${WikiName}/Repo/]]"
|
2023-03-24 15:45:03 +01:00
|
|
|
|
|
|
|
# Move the exported folder to a better location
|
2023-07-23 12:21:08 +02:00
|
|
|
mv "./Output.tmp/\$_/${WikiName}/Repo" ./Repo.tmp
|
2023-03-24 15:45:03 +01:00
|
|
|
|
|
|
|
# Rename all extracted file to have a correct extension (remove forced .txt suffix)
|
|
|
|
# Don't filter for just .sh files anymore as we have other kinds of files
|
|
|
|
cd ./Repo.tmp
|
|
|
|
for File in *.txt
|
|
|
|
do
|
2023-07-23 12:21:08 +02:00
|
|
|
mv "${File}" "${File/.txt}"
|
2023-03-24 15:45:03 +01:00
|
|
|
done
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Move the files of this repo to overwrite the extracted ones, then move everything back
|
|
|
|
# This is so, if present, files from the repo are preferred, if needed in case of emergency
|
2023-06-09 00:16:37 +02:00
|
|
|
mv ./Repo/* ./Repo.tmp/ || true
|
2023-03-24 15:45:03 +01:00
|
|
|
mv ./Repo.tmp/* ./Repo/
|
|
|
|
|
|
|
|
# Move everything to the working directory, ready for the next CI steps
|
|
|
|
mv ./Repo/* ./
|
|
|
|
chmod +x *.sh *.py || true
|