PathPilot Modifications
Tormach PathPilot Modifications
R&D by Steve Richardson (steve.richardson@makeitlabs.com)
Update File Format (.tgp) and Versioning
Tormach distributes update files in .tgp format .. This is just a simple GPG passphrase encrypted tar.gz archive file.
Tormach uses a static passphrase: moravianvalley
This passphrase was discovered merely by reading some script files that are part of the Tormach PathPilot image, and no 'cracking' or reverse engineering techniques were necessary.
To decrypt a tgp file to a standard .tgz (gzipped TAR), assuming v1.9.7 as an example update file version:
gpg --yes --no-use-agent --decrypt --passphrase=moravianvalley --output=v1.9.7.tgz ~/updates/v1.9.7.tgp
The resulting .tgz file contains the full set of files used to run that release, contained within a directory that is named the same as the version number. e.g.:
drwxr-xr-x rogge/rogge 0 2016-09-20 10:28 ./v1.9.7/
drwxr-xr-x rogge/rogge 0 2016-09-20 10:28 ./v1.9.7/mesa/
-rw-r--r-- rogge/rogge 340983 2016-09-20 10:28 ./v1.9.7/mesa/tormach_440_mill.bit
-rw-r--r-- rogge/rogge 340983 2016-09-20 10:28 ./v1.9.7/mesa/tormach_mill3.bit
-rw-r--r-- rogge/rogge 340703 2016-09-20 10:28 ./v1.9.7/mesa/tormach_lathe.bit
drwxr-xr-x rogge/rogge 0 2016-05-26 13:35 ./v1.9.7/truetype/
-rw-r--r-- rogge/rogge 145840 2016-05-26 13:35 ./v1.9.7/truetype/FreeMonoBoldOblique.ttf
... etc. (As a side note, the user "rogge" refers to Tormach employee Daniel Rogge, who is seen in several YouTube videos).
Each .tgz contains a text file with version description information which is displayed in PathPilot when you run it:
-rw-r--r-- rogge/rogge 7 2016-09-20 10:28 ./v1.9.7/version.txt
operator@tormachpcnc:~/pendant$ more ~/v1.9.7/version.txt
v1.9.7
It is wise to modify this version identifier for modified versions of PathPilot so they are identified as non-release versions.
To create a .tgp update file that will install just like official Tormach releases, first make sure the version is named distinctly from official releases. If making modifications based on an official Tormach version, it is best to keep a reference to the base version in the name.
e.g. v1.9.7 is an official Tormach release, we use v1.9.7-hack for a modified version based on v1.9.7 official.
Because PathPilot is updated fairly often, home-grown patches/fixes will need to be manually merged with later versions. This can be a laborious process, and details are highly likely to be lost to the sands of time without some diligence.
Once the modified version is stable, create a .tgz archive of the directory containing the entire release, including the containing directory:
cd ~/
tar cvzf v1.9.7-hack.tgz v1.9.7-hack/
Then, encrypt the .tgz file and create the .tgp:
gpg -c --passphrase=moravianvalley --output=v1.9.7-hack.tgp v1.9.7-hack.tgz
To test updating to this version, copy it to the /media directory:
sudo cp updates/v1.9.7-hack.tgp /media
Updates are executed in PathPilot from the Status tab.
Pre-Install & Post-Install Hooks
Inside of a release, there are scripts which will get run before and after an update process:
~/v1.9.7-hack/scripts/preinstall.sh
~/v1.9.7-hack/scripts/postinstall.sh
These scripts are good places to hook in for system-wide updates that must be done when installing the modified version (e.g. installing drivers or udev rules for new USB devices, etc.). It is probably wise to contain these updates in a new script contained in the same directory, for easier portability when merging into a later version. Simply call out to the new script in one of the pre/post install scripts. This single script call will be much easier to port in the future.
Execution of the Current Version
The currently installed software version is pointed to with a symlink in the operator user home directory:
lrwxrwxrwx 1 operator operator 12 2016-12-01 13:58 tmc -> v1.9.7-hack/
The operator_login script is run at boot time using the Gnome autostart system
System->Preferences->Startup Applications
To disable auto-starting of PathPilot on bootup of system, simply disable the "Tormach Pathpilot" entry in the Startup Programs tab.
That entry simply runs the operator_login script as follows:
bash -c "~/operator_login"
The ~/operator_login script is overwritten each time a new version of the software is installed, allowing a new version of the software to perform different tasks at startup. The file that is copied comes from the release package, e.g.
operator@tormachpcnc:~$ ls -al v1.9.7-hack/operator_login
-rwxr-xr-x 1 operator operator 29433 2017-11-14 16:47 v1.9.7-hack/operator_login
Note that this file is copied as part of the postinstall.sh script mentioned above.