Notes on Linux

back


Table of Contents





Compiling PGP 2.6.2 under RedHat 5.1

Please note that I assume no responsibility for any damages you incurr from following these instructions, or for any damage you incurr from using PGP. These instructions may not even produce a correct version of PGP.

I recently had to get PGP running under RedHat 5.1 for a proof of concept for a project I was working on.

The specific problems I had when compiling were that several symbols came back as being undefined. After taking a short look at the makefile, platform.h, 80386.S, and zmatch.S files, it looked like defining SYSV would solve the problem.

I was able to do this with minor changes to the makefile.

Change this:

linux:
        $(MAKE) all CC=gcc LD=gcc OBJS_EXT="_80386.o _zmatch.o" \
        CFLAGS="$(RSAINCDIR) -O6 -g3 -DUNIX -DIDEA32 -DASM"

To this:

linux:
        $(MAKE) all CC=gcc LD=gcc OBJS_EXT="_80386.o _zmatch.o" \
        CFLAGS="$(RSAINCDIR) -O6 -g3 -DUNIX -DIDEA32 -DASM -DSYSV"  \
        ASMDEF="-DSYSV"

Execute make, and it should compile properly.

Good luck, and good privacy!





Automating PGP - Eliminating Interactivity

Please note that I assume no responsibility for any damages you incurr from following these instructions, or for any damage you incurr from using PGP. These instructions may not even produce a correct version of PGP.

PGP understands a few command line switches that can really help with automation. These are:

  • +batchmode -- this surpresses alot of the interactive prompts that PGP will normall issue. This is not really necessary (at least not on Linux), but the PGP manuall recommends it anyway.
  • +force -- this causes PGP to answer yes to yes/no questions. Questions like "Overwrite file? (Y/N)" will be answered as 'Y'.

In addition to these command line switches, you can also set an environment variable from wich PGP will take the passphrase.

Please note that doing this reduces the security of your system and is not recommended by the PGP documentation.

Set PGPPASS to your PGP pass phrase, and PGP should automatcily pick it up.





One Liners -- system tasks

Copy the contents of a remote directory to the current directory. cp doens't do this right -- it won't get hidden files, nor will it preserver permissions properly.

Solution: use tar.

[kburton@warhammer backup]$ tar cOC /home/mortis . | tar x

The command line explained:

  • tar -- execute the tar command
  • c -- this says to create a tar archive
  • O -- dump it to standard out
  • C -- change to directory /home/morits before creating the archive.
  • . -- get all files in the current directory, and all subdirectories. before creating the archive.
  • | -- send the standard output of the first tar command to another program (i.e. what follows the '|').
  • tar -- another invocation of the tar command.
  • x -- extract a tar archive. Since there is no file specified to extract, tar will assume that it is getting a tar archive on stdin (and we fed it one via the pipe '|').




Or alternativly, as Shaitan pointed out, you can do the following:

[kburton@warhammer mortis]$ tar vf - /home/mortis | (cd /opt/backup && tar xf - )

The command line explained:

  • tar -- execute the tar command
  • v -- be verbose
  • f -- f - output to stdout
  • /home/mortis tar the directory /home/mortis
  • | -- pipe the output of the first tar command to the command that follows.
  • (cd /opt/backup && tar xf - ) -- This command can be broken down as follows:
    • cd /opt/backup - change directory into /opt/backup.
    • && - perform the command on the right in conjunction with the one on the left, but only if the command on the left succeeds. && means 'and' - so the line reads "change directory into /opt/backup and untar from standard input if the change directory was successful".
    • tar xf - - untar x from stdin f -