From 8572228e54a6216fd38a14c2d4847188116a6ce5 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Mon, 24 Oct 2022 11:59:33 +1100 Subject: [PATCH] updates --- Makefile | 21 ++++--- debian/changelog | 3 +- debian/rules | 6 +- libpathmap.8.adoc => libpathmap.so.8.adoc | 15 +++-- libtarmap.8.adoc => libtarmap.so.8.adoc | 17 ++++-- tarmap.8.adoc | 69 +++++++++++++++++++++++ 6 files changed, 110 insertions(+), 21 deletions(-) mode change 100644 => 100755 debian/rules rename libpathmap.8.adoc => libpathmap.so.8.adoc (92%) rename libtarmap.8.adoc => libtarmap.so.8.adoc (91%) create mode 100644 tarmap.8.adoc diff --git a/Makefile b/Makefile index a1f3982..52d522a 100644 --- a/Makefile +++ b/Makefile @@ -6,21 +6,22 @@ SBINFILES = tarmap LIBFILES = libtarmap.so libpathmap.so MAN8FILES = $(addsuffix .8,$(LIBFILES) $(SBINFILES)) HTMLDOC = $(addsuffix .html,$(MAN8FILES)) -GENFILES = $(LIBFILES) $(SBINFILES) -default: $(GENFILES) +GENFILES = $(LIBFILES) $(SBINFILES) $(MAN8FILES) -# Generic rule to compile an html file from an adoc file -%.html: %.adoc - asciidoc -bhtml $^ +default: $(GENFILES) # Generic rule to compile a man page from an adoc file %: %.adoc a2x -d manpage -f manpage $^ +# Generic rule to compile an html file from an adoc file +%.html: %.adoc + asciidoc -bhtml $^ + # Generic rule for making a dynamic library form a same named .c file %.so: %.c - gcc -Wall -fPIC -Wl,-init,so_init -shared -o $$@ $$^ -ldl + gcc -Wall -fPIC -Wl,-init,so_init -shared -o $@ $^ -ldl # Generic rule for making a binary from a same named .c file %: %.c @@ -42,6 +43,10 @@ $(LIBDIR)/% $(SBINDIR)/% $(MAN8DIR)/%: % install: $(INSTALLTARGETS) # Target for development building of the deb package -deb: - PREFIX= INCLUDE_PREFIX=/usr dpkg-buildpackage -us -uc --build=full +pool: + mkdir -p pool +deb: pool + PREFIX= INCLUDE_PREFIX=/usr XDH_OPTIONS=--destdir=pool \ + dpkg-buildpackage -us -uc --build=full + mv ../pathmap_* ../libpathmap[-_]* pool diff --git a/debian/changelog b/debian/changelog index 5a99af3..5964214 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,3 @@ pathmap (0.1) experimental; urgency=medium - - * creation + * creation -- Ralph Ronnquist Mon, 29 Mar 2021 12:51:07 +1100 diff --git a/debian/rules b/debian/rules old mode 100644 new mode 100755 index 9354bd2..942ae72 --- a/debian/rules +++ b/debian/rules @@ -3,6 +3,6 @@ %: dh $@ -# -#override_dh_usrlocal: -# true + +override_dh_usrlocal: + true diff --git a/libpathmap.8.adoc b/libpathmap.so.8.adoc similarity index 92% rename from libpathmap.8.adoc rename to libpathmap.so.8.adoc index 0430292..20fe8e5 100644 --- a/libpathmap.8.adoc +++ b/libpathmap.so.8.adoc @@ -54,9 +54,16 @@ EXAMPLES Assume there is a directory +/home/test/extra+ -> env PATHMAPNOT=/home/test:/proc:/dev:/lib:/usr:/bin \ - LD_PRELOAD=libpathmap.so \ - ls /extra - +---- +env PATHMAPNOT=/home/test:/proc:/dev:/lib:/usr:/bin \ + LD_PRELOAD=libpathmap.so \ + ls /extra +---- + SEE ALSO -------- + +libtarmap.so:: + +something + diff --git a/libtarmap.8.adoc b/libtarmap.so.8.adoc similarity index 91% rename from libtarmap.8.adoc rename to libtarmap.so.8.adoc index 31f92bb..ca477bc 100644 --- a/libtarmap.8.adoc +++ b/libtarmap.so.8.adoc @@ -54,9 +54,18 @@ EXAMPLES Assume there is a directory +/home/test/extra+ -> env PATHMAPNOT=/home/test:/proc:/dev:/lib:/usr:/bin \ - LD_PRELOAD=libtarmap.so \ - ls /extra - +---- +env PATHMAPNOT=/home/test:/proc:/dev:/lib:/usr:/bin \ + LD_PRELOAD=libtarmap.so \ + ls /extra +---- + SEE ALSO -------- + +tarmap:: + +aaa + +libpathmap.so:: +aaa diff --git a/tarmap.8.adoc b/tarmap.8.adoc new file mode 100644 index 0000000..86e7961 --- /dev/null +++ b/tarmap.8.adoc @@ -0,0 +1,69 @@ +tarmap(8) +========= +:doctype: manpage +:revdate: {sys:date "+%Y-%m-%d %H:%M:%S"} +:COLON: : +:EQUALS: = + +NAME +---- +tarmap - run command with libtarmap.so preloading + +SYNOPSYS +-------- ++tarmap+ _tarfile_ _command_ + +DESCRIPTION +----------- + +TBD + +This dynamic library, libtarmap.so, is intended to be used as a +"preload" library for programs for which pathnames are to be mapped to +a different common prefix. The effect is somewhat similar to +chroot+ +in that absolute pathnames, which normally are from the root of the +file system, get mapped to be relative to the choosen prefix point. + ++libtarmap.so+ is "configured" by setting environment variable ++PATHMAPNOT+ to be the path prefixes, given as a colon separated list, +that +libtarmap.so+ should be concerned with. The first of them is +then used as the prefix to add to the program's pathnames (when +opening files) except to those pathnames that start with any of the +prefixes in the list, including the first. + +For example, if the prefix +/elsewhere+ should be added to all +pathnames for a program +prgrm+ then the command line might be: + +---- +PATHMAPNOT=/elsewhere LD_PRELOAD=libtarmap.so prgrm +---- + +However, if +prgrm+ is a dynamically linked executable, then all +libraries + +ENVIRONMENT +----------- + +PATHMAPNOT:: + +This environment variable tells which path prefixes, given as a colon +separated list, +libtarmap.so+ should be concerned with. The first +prefix is the one to add to all pathnames except to those of any of +the prefixes in the list. + +EXAMPLES +-------- + +Assume there is a directory +/home/test/extra+ + +SEE ALSO +-------- + +libtarmap.so:: + +a + +libpathmap.so:: + +b + -- 2.47.2