Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Github Wiki to MediaWiki migration notes
Raw notes of the steps I took to conver the wiki.
install git-mediawiki pandoc
git clone https://github.com/postmarketOS/pmbootstrap.wiki.git
cd pmbootstrap.wiki
#!/bin/sh
for f in *.md; do
o="${f/.md/.mw}"
echo "$f -> $o"
pandoc -f markdown_github -t mediawiki "$f" -o "$o"
done
# manually deleted the duplicate .mw files, which were already present in the new wiki
cd ..
git init wiki.postmarketos.org
cd wiki.postmarketos.org
chmod 600 .git/config
git remote add origin mediawiki::https://wiki.postmarketos.org
git config remote.origin.mwLogin "changeme"
git config remote.origin.mwPassword "changeme"
git pull
cp ../pmbootstrap.wiki/*.mw .
git add -A
git commit
git push
cd ..
cd pmbootstrap.wiki
for f in *.md; do
echo "Processing $f"
rm "$f"
noext="${f/.md/}"
{
echo "This wiki page has been moved to:"
echo ""
echo "https://wiki.postmarketos.org/wiki/$noext"
echo "---"
echo ""
echo "*Sorry for the additional click, we're trying to update the links everywhere.*"
echo "*See also: [#452](https://github.com/postmarketOS/pmbootstrap/issues/452).*"
} > "$f"
done
git add -A
git commit
git push
# Now fix all dead links etc!
# https://wiki.postmarketos.org/index.php?title=Special:WantedPages&limit=500&offset=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment