MP-WP Vpatch: Add Footnotes Plugin and Text-Selection Javascript

December 31st, 2018

As my first somewhat official task, I set out to create a vpatch for mp-wp to add the footnotes1 and shareable text-selection2 features seen on most republican blogs. After some false starts I realized I would first need to set up a proper local dev environment for working with vtools. Luckily I had some time available during the holidays for completing this particular prerequisite, after which I was able to create a working vpatch for mp-wp.

Without further ado, the vpatch, signature, and my key:

http://billymg.com/downloads/mp-wp/mp-wp_add-footnotes-and-textselectionjs.vpatch
http://billymg.com/downloads/mp-wp/mp-wp_add-footnotes-and-textselectionjs.vpatch.billymg.sig
http://billymg.com/downloads/billymg.asc

Pressing

In order to press this patch you will need a keccak-powered v.pl. Diana Coman was kind and patient enough to help me with this and pointed me to her post on the subject. If you are starting out with V for the first time I highly recommend grabbing the starter pack from that post. It works out of the box and will save you a lot of headaches.

Pressing a fresh copy of mp-wp from this vpatch gets you everything included in the genesis vpatch plus:


wp-content/plugins/footnotes.php
wp-content/themes/default/selection-magic.php

As well as a small modification to wp-content/themes/default/single.php and wp-content/themes/default/page.php to wrap post and page content in a unique ID that the selection-magic javascript can reference.

Setup of the footnotes feature followed the directions from hanbot. After setting up mp-wp you'll just need to 'activate' the footnotes plugin in the Plugins section of your wordpress admin panel.

Next task

My next official task, from hanbot this time, is to put together a vpatch to fix a small image reference bug in the genesis vpatch. I've started working on this locally and after sufficient testing will write up another blog post with the new patch.

  1. This footnote was generated automatically by enclosing the footnote text in (( ... )) after the word 'footnotes' above. []
  2. Go ahead and try this link. []

The Complete Noob's Guide to Setting Up MP-WP on a Pizarro Rock Chip Server

October 22nd, 2018

This guide outlines the steps required to go from not being a person to having your very own, uncensorable, blogging platform. Some of the prerequisite steps will be glossed over, the main focus will be on installing and running mp-wp on a Pizarro Rockchip server.

I. Get in the WoT

Like everything in the republic, Pizarro is wot-powered. This isn't Amazon EC2, and you won't be able to use your credit card(s) for anything, of any value, anywhere in the republic (you are, however, free to use them for other things, so knock yourself out).

Getting in the WoT is simple, any motivated noob can do it. 1) Create a PGP key for yourself (if you don't already have one), 2) register it with @deedbot in #trilema1, 3) get someone to give you your first rating.

II. Acquire PizarroISP hosting in #pizarro

Now that you're a person you will be able to conduct commerce with other civilized people (as opposed to heathens and other assorted subhumans). First, head on over to http://pizarroisp.net and peruse their offerings. I opted for a Rockchip mini-server at the quarterly rate (a steal if you ask me), but you'll have to decide on your own.

All Pizarro servers run a sanitary build of Gentoo, of which my favorite feature has to be the included asciilifeform crapolade™® mask file2. As someone new to Gentoo, having a pre-configured ban list that I could read and work with myself was a godsend.

Once you've read through the basics you can introduce yourself in #pizarro to ask any further questions or to complete your purchase. And once that's done, you can login to your shiny new box and start installing goodies.

III. Install the prerequisites for mp-wp (apache, php, mysql)

I was able to follow esthlos' guide almost verbatim so, please, start there. Steps 2.2 and 2.3 were the only ones that didn't "just work" in my environment. After completing 2.1, here is what worked for me:


emerge -av apache
emerge -av mysql

Easy enough, but notice the php omission? Apparently the shitgnomes in charge of the upstream Gentoo repos thought it would be cute to deprecate all php-5.6 versions with the exception of php-5.6.38. I updated the line in my mask file to:


>dev-lang/php-5.6.38

Now let's try emerging again:


emerge -av =dev-lang/php-5.6.38

This resulted in some spew about dependencies that couldn't be merged because of mask configuration. Feeling stuck and afraid I may have to install php from source, outside of Portage, I described my situation in #trilema and learned about the --nodeps option.


emerge -av --nodeps =dev-lang/php-5.6.38

Almost. The install at least proceeded enough for me to discover which dependencies are actually required—in that, the actual compile step would fail in their absence. Turns out there were only two, which were uncovered one-by-one via compile failures. Let's install them:


emerge -av --nodeps dev-libs/oniguruma
emerge -av --nodeps dev-libs/libmcrypt

The first went fine, the second whined about being "masked by EAPI 7" and asked "would you like some new Portage?". Well, no, I wouldn't, but I guess so long as is doesn't violate any of my current USE or mask settings... And this where it started to become obvious why versions of anything are "deprecated" in the first place.

You see, php-5.6.38 requires libmcrypt, the only version of libmcrypt available upstream "requires" NewPortage with EAPI 7, which, in turn, requires gpg2. Standard wrecker playbook I suppose, let's see if we can get around it.

Once the concept of custom ebuilds was brought to my attention I started reading to see if this could solve my problem. The process seemed simple enough so I grabbed the current libmcrypt-2.5.8-r4.ebuild from upstream and modified the one known-to-be-offending line:


- EAPI=7
+ EAPI=6

To use a custom ebuild, copy the necessary files to /usr/local/portage/CATEGORY/PACKAGE_NAME So in this case:


/usr/local/portage/dev-libs/libmcrypt/
    files/
        libmcrypt-2.5.8-rotate-mask.patch
    libmcrypt-2.5.8-r4.ebuild

And run the ebuild command:


ebuild /usr/local/portage/dev-libs/libmcrypt/libmcrypt-2.5.8-r4.ebuild manifest clean merge

Finally! Turns out that in this case "requires EAPI 7" means "requires the version string 7".

Now to install php with mysql support, first unmask mysql in /etc/portage/profile/use.mask:


# Unmask mysql
-mysql

And then emerge php:


emerge -av =dev-lang/php-5.6.38

It took me a while but hopefully my stumblings outlined here make it easier for you.

IV. Obtain a working implementation of V and the mp-wp genesis, press and configure

V is tricky and I still haven't wrapped my head around all of it, but these steps worked for getting a working copy of mp-wp up and running (if they didn't, you wouldn't be reading this).

First, grab a working implementation of V. For this I turned to the build instructions for the Bitcoin reference client and downloaded the version mentioned there:


curl -O http://thebitcoin.foundation/v/V-20180222.tar.gz
curl -O http://thebitcoin.foundation/v/V-20180222.tar.gz.mod6.sig

Verify and extract the tarball and you'll see v.pl (the V implementation we'll be using) along with some readme files and signatures. V also depends on a certain directory structure so let's set that up:


mkdir patches .wot .seals

Now you can grab the mp-wp genesis vpatch from hanbot's site. Download both the vpatch and the signature. Move the vpatch to the patches directory you just created and move the signature file to .seals. Since V is built around the concept of verifying the authorship of any and all code in a given tree, you will also need to gather the public keys of any authors involved. In this case, hanbot. Ask @deedbot in #trilema for a copy of her key:


!!key hanbot

Import this key into your gpg keyring and add the pubkey file to the .wot directory with the user's name as the filename. In this case hanbot.asc. Your working directory should now have at least:


patches/
    mp-wp_genesis.vpatch
.seals/
    mp-wp_genesis.vpatch.hanbot.sig
v.pl
.wot/
    hanbot.asc

If this looks right, you can now press mp-wp:


./v.pl p v mp-wp mp-wp_genesis.vpatch

That's it! Now move the generated files to your server's site directory (/www/blog/ if you were following esthlos' guide), fill in the config, and load in your browser. I won't get into those details here but you can again reference esthlos' guide or Wordpress documentation.

  1. On IRC. If you are a noob here as well (as I was), you will have to do some further reading on proper IRC etiquette. At a bare minimum I suggest configuring a bouncer, such as ZNC, to avoid polluting the channel with join/part spam. This type of spam is frowned upon in civilized IRC channels.

    Furthermore, if you are just now discovering #trilema for the first time, it is advised that you read at least 6 months worth of logs before attempting to participate in any meaningful way.

    []

  2. If you're new to Gentoo you'll want to read up on the basics of Portage, the native package management system. Unlike package managers in other Linux distributions, Portage deals with source rather than binaries. When you install something with Portage you are grabbing the source code, configuring build options, and compiling right there on your own machine. This of course provides for much better system hygiene but also requires knowing a lot more about what the hell it is you're doing. []