Skip to content

Commit

Permalink
Cleanup readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcooper committed Dec 18, 2017
1 parent 995ec2b commit 2eb53f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ test: example $(LIB_FILE) $(CMD_FILE)
strip: all
strip -s $(LIB_FILE) $(CMD_FILE)

ifeq ($(PLATFORM),Linux)
deb: all
mkdir -p debian-pkg/usr/bin
cp -v $(CMD_FILE) debian-pkg/usr/bin
Expand All @@ -72,5 +73,6 @@ deb: all
sed "s/<<VERSION>>/$$DEB_VER/" debian.control | sed "s/<<ARCH>>/$$DEB_ARCH/" \
> debian-pkg/DEBIAN/control; \
fakeroot dpkg-deb -b debian-pkg "$$DEB_NAME"
endif

.PHONY: all clean install uninstall test strip deb
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _Wow!_ Now you can run a command and fake your hostname!

Usage is relatively simple: `fakehostname <new-hostname> <cmd> [<args> ...]`

For example,
For example on Linux,

```
$ fakehostname joan hostname
Expand All @@ -18,6 +18,17 @@ $ fakehostname rivers uname -n
rivers
```

Or you can use the library directly, ie with `libfakehostname.so` in the current
directory,

```
$ LD_PRELOAD=./libfakehostname.so FAKE_HOSTNAME=joan-rivers hostname
joan-rivers
```

Note you _can_ use `fakehostname` on macOS, but it's a little tricky and you
should read the [note below](#important-note-for-apples-macos-darwin).

### Installation

Fetch the source from Github and install!
Expand All @@ -40,10 +51,10 @@ $ sudo apt-get install -y build-essential

The command (`fakehostname`), and its associated library (`libfakehostname`),
are a hack that slip between your program and the C standard library to monkey
patch the `uname` and `gethostname` routines provided therein. This is
accomplished via `LD_PRELOAD` environment variables on Linux, and the
`DYLD_INSERT_LIBRARIES` + `DYLD_FORCE_FLAT_NAMESPACE` ones on macOS (see
[note below](#important-note-for-apples-macos-darwin)).
patch the `uname` and `gethostname` functions provided therein. This is
accomplished via the `LD_PRELOAD` environment variables on Linux, and the
`DYLD_INSERT_LIBRARIES` + `DYLD_FORCE_FLAT_NAMESPACE` evironment variables on
macOS (see [important note below](#important-note-for-apples-macos-darwin)).
The library reads environment variable `FAKE_HOSTNAME` -- prepped by the command
-- and uses that instead of your system's hostname.

Expand Down

0 comments on commit 2eb53f7

Please sign in to comment.