github.com/apptainer/singularity@v3.1.1+incompatible/dist/debian/generate_manpages (about)

     1  #!/bin/bash
     2  #emacs: -*- mode: shell-script; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*- 
     3  #ex: set sts=4 ts=4 sw=4 noet:
     4  #
     5  #  Just a little helper script to generate manpages.  Needs a bit of
     6  #  handtwisting since paths are hardcoded in the scripts
     7  #
     8  # COPYRIGHT: Yaroslav Halchenko 2016
     9  #
    10  # LICENSE: MIT
    11  #
    12  #  Permission is hereby granted, free of charge, to any person obtaining a copy
    13  #  of this software and associated documentation files (the "Software"), to deal
    14  #  in the Software without restriction, including without limitation the rights
    15  #  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    16  #  copies of the Software, and to permit persons to whom the Software is
    17  #  furnished to do so, subject to the following conditions:
    18  #
    19  #  The above copyright notice and this permission notice shall be included in
    20  #  all copies or substantial portions of the Software.
    21  #
    22  #  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    23  #  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    24  #  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    25  #  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    26  #  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    27  #  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    28  #  THE SOFTWARE.
    29  #
    30  
    31  set -e
    32  set -u
    33  
    34  PKGDIR=$1
    35  VERSION=$2
    36  tbindir=$(mktemp -d)
    37  trap "rm -rf \"$tbindir\"" TERM INT EXIT
    38  
    39  mkdir -p ${PKGDIR}/usr/share/man/man1
    40  declare -A desc
    41  desc[singularity]="Singularity containers command line interface"
    42  desc[run-singularity]="launch a Singularity containers with a runscript"
    43  
    44  for b in singularity run-singularity; do
    45      cp -p ${PKGDIR}/usr/bin/$b "$tbindir/"
    46      sed -i -e "s,^prefix=.*,prefix=${PKGDIR}/usr,g" "$tbindir/$b"
    47      manpage=${PKGDIR}/usr/share/man/man1/$b.1
    48      PATH=$tbindir:$PATH
    49          help2man -n "${desc[$b]}" --no-info "${tbindir}/$b" --version-string "$VERSION" >| $manpage
    50      grep -q -e 'Error loading functions' $manpage && exit 1 || :
    51  done