diff options
author | Raphael Hertzog <hertzog@debian.org> | 2009-03-13 15:47:52 +0100 |
---|---|---|
committer | Raphael Hertzog <hertzog@debian.org> | 2009-07-03 15:27:43 +0200 |
commit | c23407d285734d66aca07ecfbb45d7f8604ce706 (patch) | |
tree | 7f594c2d48306faf68706a63168adb0f9dfec7c5 /utils | |
parent | 645a9e329f874a470ae837d93525c769a0df4ec8 (diff) | |
download | dpkg-c23407d285734d66aca07ecfbb45d7f8604ce706.tar.gz |
Replace install-info by a simple wrapper (or no-op command)
In order to properly transition to GNU's install-info, dpkg's install-info
is modified to be a simple wrapper around /usr/bin/install-info. That
wrapper warns when the user explicitely calls /usr/sbin/install-info since
the new install-info is in /usr/bin/.
This wrapper is meant to be removed at some point when all references
to /usr/sbin/install-info have gone (most probably in squeeze+1).
Also remove the manual page since there's nothing to document any more
and add a lintian override until the wrapper is removed.
Reference: http://wiki.debian.org/Transitions/DpkgToGnuInstallInfo
Diffstat (limited to 'utils')
-rw-r--r-- | utils/.gitignore | 2 | ||||
-rw-r--r-- | utils/Makefile.am | 13 | ||||
-rw-r--r-- | utils/install-info.c | 65 |
3 files changed, 80 insertions, 0 deletions
diff --git a/utils/.gitignore b/utils/.gitignore index bf5714e41..28a2697cf 100644 --- a/utils/.gitignore +++ b/utils/.gitignore @@ -1 +1,3 @@ start-stop-daemon +install-info +install-info-stamp diff --git a/utils/Makefile.am b/utils/Makefile.am index cd1e4f1f2..0e718e35d 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -16,3 +16,16 @@ if WITH_START_STOP_DAEMON start_stop_daemon_LDADD = ../libcompat/libcompat.a $(SSD_LIBS) endif +EXTRA_DIST = install-info.c +CLEANFILES = install-info install-info-stamp + +# Automake has its own install-info rule, gah +all-local: install-info-stamp +install-info-stamp: $(srcdir)/install-info.c + $(CC) $(CFLAGS) -o install-info $(srcdir)/install-info.c + touch $@ + +install-exec-local: install-info-stamp + $(mkdir_p) $(DESTDIR)$(sbindir) + $(INSTALL_PROGRAM) install-info $(DESTDIR)$(sbindir) + diff --git a/utils/install-info.c b/utils/install-info.c new file mode 100644 index 000000000..797a3691d --- /dev/null +++ b/utils/install-info.c @@ -0,0 +1,65 @@ +/* + * install-info.c - transitional ginstall-info wrapper + * + * Copyright © 2009 Raphaël Hertzog <hertzog@debian.org> + * + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2, + * or (at your option) any later version. + * + * This is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with dpkg; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <unistd.h> +#include <errno.h> +#include <string.h> +#include <stdio.h> + +#define WARN "install-info: warning: " +#define FAIL "install-info: failure: " + +int +main(int argc, char **argv) +{ + if (strcmp(argv[0], "/usr/sbin/install-info") == 0) { + fprintf(stderr, WARN "don't call programs like install-info with " + "an absolute path\n"); + fprintf(stderr, WARN "/usr/sbin/install-info provided by " + "dpkg is deprecated and will go away soon\n"); + fprintf(stderr, WARN "its replacement lives in /usr/bin/\n"); + } + + if (access("/usr/bin/install-info", X_OK) == 0) { + execv("/usr/bin/install-info", argv); + fprintf(stderr, FAIL "can't execute /usr/bin/install-info: %s\n", + strerror(errno)); + return 1; /* exec failed */ + } else { + if (errno == ENOENT) { + if (getenv("DPKG_RUNNING_VERSION") != NULL) { + fprintf(stderr, WARN "maintainer scripts should not call " + "install-info anymore\n"); + fprintf(stderr, WARN "a dpkg trigger provided by the install-info " + "package takes care of the job\n"); + fprintf(stderr, WARN "this package should be updated\n"); + } else { + fprintf(stderr, WARN "nothing done since /usr/bin/install-info " + "doesn't exist\n"); + } + } else { + fprintf(stderr, FAIL "can't execute /usr/bin/install-info: %s\n", + strerror(errno)); + return 1; + } + } + + return 0; +} |