From 7d2e33a416388f9fed5f357e55dcd41394651edc Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Sat, 30 May 2015 02:05:33 +0200 Subject: man: replace hard-coded /usr/lib Replace some /usr/lib occurences in man/ with &rootprefix;/lib. --- man/hwdb.xml | 4 ++-- man/systemd.link.xml | 4 ++-- man/systemd.netdev.xml | 4 ++-- man/systemd.network.xml | 4 ++-- man/udev.xml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/man/hwdb.xml b/man/hwdb.xml index b3602ac5da..e6215df738 100644 --- a/man/hwdb.xml +++ b/man/hwdb.xml @@ -50,10 +50,10 @@ regardless of the directories in which they live. However, files with identical filenames replace each other. Files in /etc have the highest priority, files in /run take precedence - over files with the same name in /usr/lib. This can be + over files with the same name in &rootprefix;/lib. This can be used to override a system-supplied hwdb file with a local file if needed; a symlink in /etc with the same name as a hwdb file in - /usr/lib, pointing to /dev/null, + &rootprefix;/lib, pointing to /dev/null, disables the hwdb file entirely. hwdb files must have the extension .hwdb; other extensions are ignored. diff --git a/man/systemd.link.xml b/man/systemd.link.xml index 75cf6e1953..5db06842bd 100644 --- a/man/systemd.link.xml +++ b/man/systemd.link.xml @@ -70,10 +70,10 @@ However, files with identical filenames replace each other. Files in /etc have the highest priority, files in /run take precedence over files with the same - name in /usr/lib. This can be used to + name in &rootprefix;/lib. This can be used to override a system-supplied link file with a local file if needed; a symlink in /etc with the same name as a - link file in /usr/lib, pointing to + link file in &rootprefix;/lib, pointing to /dev/null, disables the link file entirely. diff --git a/man/systemd.netdev.xml b/man/systemd.netdev.xml index 6cd77abd04..786c7d478a 100644 --- a/man/systemd.netdev.xml +++ b/man/systemd.netdev.xml @@ -81,10 +81,10 @@ identical filenames replace each other. Files in /etc have the highest priority, files in /run take precedence over files with the same - name in /usr/lib. This can be used to + name in &rootprefix;/lib. This can be used to override a system-supplied configuration file with a local file if needed; a symlink in /etc with the same name - as a configuration file in /usr/lib, pointing + as a configuration file in &rootprefix;/lib, pointing to /dev/null, disables the configuration file entirely. diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 0b9781fb8b..bd061c270a 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -77,10 +77,10 @@ identical filenames replace each other. Files in /etc have the highest priority, files in /run take precedence over files with the same - name in /usr/lib. This can be used to + name in &rootprefix;/lib. This can be used to override a system-supplied configuration file with a local file if needed; a symlink in /etc with the same name - as a configuration file in /usr/lib, pointing + as a configuration file in &rootprefix;/lib, pointing to /dev/null, disables the configuration file entirely. diff --git a/man/udev.xml b/man/udev.xml index f7ebaad4bc..d5d8a17cdb 100644 --- a/man/udev.xml +++ b/man/udev.xml @@ -65,10 +65,10 @@ regardless of the directories in which they live. However, files with identical filenames replace each other. Files in /etc have the highest priority, files in /run take precedence - over files with the same name in /usr/lib. This can be + over files with the same name in &rootprefix;/lib. This can be used to override a system-supplied rules file with a local file if needed; a symlink in /etc with the same name as a rules file in - /usr/lib, pointing to /dev/null, + &rootprefix;/lib, pointing to /dev/null, disables the rules file entirely. Rule files must have the extension .rules; other extensions are ignored. -- cgit v1.2.3-54-g00ecf From dd334850259e6bc25fdd003790467f428d40fbcd Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sat, 30 May 2015 03:04:55 +0200 Subject: build-sys: Normalize paths of configure options Strip trailing slashes from options such as --with-rootprefix, so that building with rootprefix="/" results in paths like "/lib" instead of "//lib". Also handle paths such as "/usr/" gracefully. Use m4/ax_normalize_path.m4 from the autoconf-archive project, which is now included in our tree as per usual practices in using autoconf-archive macros. Tested with the following configure options: ./configure \ --with-rootprefix=/ \ --with-rootlibdir=/lib64/ \ --prefix=/usr/ \ --libdir=/lib/ \ --with-bashcompletiondir=/bash-completion/completions/ (The "prefix" and "libdir" are already automatically normalized by Autoconf, this command is testing the others.) Compared the config.log and resulting trees (in particular man pages) to confirm double slashes were not present in the latter. Also tested that a configuration using default options is not affected and that `make distcheck` still works as expected. --- configure.ac | 9 ++++ m4/ax_normalize_path.m4 | 115 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 m4/ax_normalize_path.m4 diff --git a/configure.ac b/configure.ac index 92654a644a..78d52e401c 100644 --- a/configure.ac +++ b/configure.ac @@ -1370,16 +1370,19 @@ AC_ARG_WITH([dbuspolicydir], AS_HELP_STRING([--with-dbuspolicydir=DIR], [D-Bus policy directory]), [], [with_dbuspolicydir=${sysconfdir}/dbus-1/system.d]) +AX_NORMALIZE_PATH([with_dbuspolicydir]) AC_ARG_WITH([dbussessionservicedir], AS_HELP_STRING([--with-dbussessionservicedir=DIR], [D-Bus session service directory]), [], [with_dbussessionservicedir=${datadir}/dbus-1/services]) +AX_NORMALIZE_PATH([with_dbussessionservicedir]) AC_ARG_WITH([dbussystemservicedir], AS_HELP_STRING([--with-dbussystemservicedir=DIR], [D-Bus system service directory]), [], [with_dbussystemservicedir=${datadir}/dbus-1/system-services]) +AX_NORMALIZE_PATH([with_dbussystemservicedir]) AC_ARG_WITH([bashcompletiondir], AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]), @@ -1389,29 +1392,35 @@ AC_ARG_WITH([bashcompletiondir], ] , [ with_bashcompletiondir=${datadir}/bash-completion/completions ])]) +AX_NORMALIZE_PATH([with_bashcompletiondir]) AC_ARG_WITH([zshcompletiondir], AS_HELP_STRING([--with-zshcompletiondir=DIR], [Zsh completions directory]), [], [with_zshcompletiondir=${datadir}/zsh/site-functions]) +AX_NORMALIZE_PATH([with_zshcompletiondir]) AC_ARG_WITH([rootprefix], AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), [], [with_rootprefix=${ac_default_prefix}]) +AX_NORMALIZE_PATH([with_rootprefix]) AC_ARG_WITH([rootlibdir], AS_HELP_STRING([--with-rootlibdir=DIR], [Root directory for libraries necessary for boot]), [], [with_rootlibdir=${libdir}]) +AX_NORMALIZE_PATH([with_rootlibdir]) AC_ARG_WITH([pamlibdir], AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), [], [with_pamlibdir=${with_rootlibdir}/security]) +AX_NORMALIZE_PATH([with_pamlibdir]) AC_ARG_WITH([pamconfdir], AS_HELP_STRING([--with-pamconfdir=DIR], [Directory for PAM configuration]), [], [with_pamconfdir=${sysconfdir}/pam.d]) +AX_NORMALIZE_PATH([with_pamconfdir]) AC_ARG_ENABLE([split-usr], AS_HELP_STRING([--enable-split-usr], [Assume that /bin, /sbin aren\'t symlinks into /usr]), diff --git a/m4/ax_normalize_path.m4 b/m4/ax_normalize_path.m4 new file mode 100644 index 0000000000..e8f9973e35 --- /dev/null +++ b/m4/ax_normalize_path.m4 @@ -0,0 +1,115 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_normalize_path.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_NORMALIZE_PATH(VARNAME, [REFERENCE_STRING]) +# +# DESCRIPTION +# +# Perform some cleanups on the value of $VARNAME (interpreted as a path): +# +# - empty paths are changed to '.' +# - trailing slashes are removed +# - repeated slashes are squeezed except a leading doubled slash '//' +# (which might indicate a networked disk on some OS). +# +# REFERENCE_STRING is used to turn '/' into '\' and vice-versa: if +# REFERENCE_STRING contains some backslashes, all slashes and backslashes +# are turned into backslashes, otherwise they are all turned into slashes. +# +# This makes processing of DOS filenames quite easier, because you can +# turn a filename to the Unix notation, make your processing, and turn it +# back to original notation. +# +# filename='A:\FOO\\BAR\' +# old_filename="$filename" +# # Switch to the unix notation +# AX_NORMALIZE_PATH([filename], ["/"]) +# # now we have $filename = 'A:/FOO/BAR' and we can process it as if +# # it was a Unix path. For instance let's say that you want +# # to append '/subpath': +# filename="$filename/subpath" +# # finally switch back to the original notation +# AX_NORMALIZE_PATH([filename], ["$old_filename"]) +# # now $filename equals to 'A:\FOO\BAR\subpath' +# +# One good reason to make all path processing with the unix convention is +# that backslashes have a special meaning in many cases. For instance +# +# expr 'A:\FOO' : 'A:\Foo' +# +# will return 0 because the second argument is a regex in which +# backslashes have to be backslashed. In other words, to have the two +# strings to match you should write this instead: +# +# expr 'A:\Foo' : 'A:\\Foo' +# +# Such behavior makes DOS filenames extremely unpleasant to work with. So +# temporary turn your paths to the Unix notation, and revert them to the +# original notation after the processing. See the macro +# AX_COMPUTE_RELATIVE_PATHS for a concrete example of this. +# +# REFERENCE_STRING defaults to $VARIABLE, this means that slashes will be +# converted to backslashes if $VARIABLE already contains some backslashes +# (see $thirddir below). +# +# firstdir='/usr/local//share' +# seconddir='C:\Program Files\\' +# thirddir='C:\home/usr/' +# AX_NORMALIZE_PATH([firstdir]) +# AX_NORMALIZE_PATH([seconddir]) +# AX_NORMALIZE_PATH([thirddir]) +# # $firstdir = '/usr/local/share' +# # $seconddir = 'C:\Program Files' +# # $thirddir = 'C:\home\usr' +# +# LICENSE +# +# Copyright (c) 2008 Alexandre Duret-Lutz +# +# This program 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 of the License, or (at your +# option) any later version. +# +# This program 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 this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AU_ALIAS([ADL_NORMALIZE_PATH], [AX_NORMALIZE_PATH]) +AC_DEFUN([AX_NORMALIZE_PATH], +[case ":[$]$1:" in +# change empty paths to '.' + ::) $1='.' ;; +# strip trailing slashes + :*[[\\/]]:) $1=`echo "[$]$1" | sed 's,[[\\/]]*[$],,'` ;; + :*:) ;; +esac +# squeze repeated slashes +case ifelse($2,,"[$]$1",$2) in +# if the path contains any backslashes, turn slashes into backslashes + *\\*) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1\\\\,g'` ;; +# if the path contains slashes, also turn backslashes into slashes + *) $1=`echo "[$]$1" | sed 's,\(.\)[[\\/]][[\\/]]*,\1/,g'` ;; +esac]) -- cgit v1.2.3-54-g00ecf