Note: There is neither illegal content here nor anything targeted at circumventing copyright. Hacking is not about that. Hacking is about fun and Linux is about fun too.
After learning how to install Complete National Geographic (CNG) on Linux, we can now move on.
Getting rid of the nasty DVDs
I’m not going to discuss whether copying the DVDs to the hard disk of your PC violates any copyright; as I only do it for my own convenience and do not share the files outside the usual family circle (whom I can also give the physical discs should need arise), I consider my actions to be legitimate. If you disagree, stop reading now.
First things first: copy the DVDs to your had drive. You’ll need about 50 GB of space (disks are dual-layer). On each disk you’ll find a directory named “disc1”, “disc2” etc. – these are the ones we need. On the first disc there are also Windows and MacOS installers as well as some other stuff you can safely skip.
When finished copying, merge all files and sub-directories under the “disc1” directory:
for i in {2..6}; do mv disc$i/* disc1; rm -rf disc$i; done
Fix file permissions:
cd disc1 chown -R root.root * chmod -R 755 *
Second, we need to figure out how to tweak CNG into using HDD instead of DVDs. We’ll exploit a weakness in the AIR’s design: it has no built-in detection for optical disk drives; instead, an application should probe known locations for known files. Indeed, running “strace” on the application reveals that is simply probes for “disc1”, “disc2” etc. in all first-level directories inside two popular mount points: /mnt and /media. If it finds one, it uses its number to figure out which disc is inserted. Therefore, all we need is set up a symlink under “/mnt” to the “disc1” directory:
ln -s "path to your disc1 directory" /mnt/cdrom/disc1
The final task is to fix CNG application to seek all files under the same “disc1” directory (i.e. make ot “forget” it was originally constructed for a set of 6 discs). Looking around the CGN directory as well as user’s home directory shows that CNG creates a user directory in ~/.appdata naming it rather unfriendly with a long name plus some random characters in the end:
com.nationalgeographic.products.cng120.68B1CC4249876152EBE333BD4B7514ADB4D94062.1
If it is not there, run the CNG once and it will create it.
Inside it you’ll find another directory named “Local Store”; go for it. Inside there lies a hidden treasure, a file which holds everything we need: a SQLite database. Make a backup copy in case something goes wrong:
cp cnguser.sqlite3 cnguser.sqlite3.orig
The, run the sqlite browser against it (you might need to apt-get or yum it, but you should know how to do it).
sqlite3 cnguser.sqlite3
Looking around the database shows we need to update two tables:
a) the “discs” table which lists the discs and serves as a key for lookup of each issue’s location; it also lists the size of each DVD (although the rationale behind this remains a mystery). We’ll play their game: update the first record with the summary size of all 6 discs and then delete the rest 5 records:
update discs set size_mb=46157 where id=1; delete from discs where id>1;
b) the “issue_links” table that says which isse on which disc resides; obviously, we want all isues to point to the first disc:
update issue_links set disc_id=1; .exit
Well, that’s it 🙂 Wasn’t that hard, yep? As I sad, Linux is about hacking and hacking is fun. Enjoy your Complete National Geographic, now on Linux and completely liberated from DVD swapping!