-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bootstrap.sh
executable file
·39 lines (32 loc) · 1.06 KB
/
Bootstrap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
set -e # Exit on any error
set -x # Echo all commands
# Configuration
WikiName="OcttKB"
WikiLoading="./Wiki-${WikiName}"
# Ensure important directories
mkdir -vp ./Repo
rm -rf ./Repo.tmp ./Output.tmp || true
# Export all tiddlers from the specific path of the HTML wiki
tiddlywiki \
${WikiLoading} \
--verbose \
--output ./Output.tmp \
--save "[prefix[\$:/${WikiName}/Repo/]]"
# Move the exported folder to a better location
mv "./Output.tmp/\$_/${WikiName}/Repo" ./Repo.tmp
# 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
mv "${File}" "${File/.txt}"
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
mv ./Repo/* ./Repo.tmp/ || true
mv ./Repo.tmp/* ./Repo/
# Move everything to the working directory, ready for the next CI steps
mv ./Repo/* ./
chmod +x *.sh *.py || true