mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Gaetan Boismal
10.41.2015 647458098381de3d9cf67b6f3c8356367858ffc8
OPENDJ-2177 Set man path in native packages

Set man path in DEB and RPM package.
Check if the man path directive is already present in the man config
file. If so, we do nothing, otherwise we add our opendj man pages path
(/opt/opendj/share/man).
Note that for this step is done at the end of the postinstall phase.
For the DEB script, we needed to remove the 'set -e'to allow grep to
return a non zero code.
Thats why we have enforced upgrade return code checks.
2 files modified
34 ■■■■ changed files
opendj-packages/opendj-deb/resources/control/postinst 26 ●●●● patch | view | raw | blame | history
opendj-packages/opendj-rpm/resources/specs/postinstall.sh 8 ●●●●● patch | view | raw | blame | history
opendj-packages/opendj-deb/resources/control/postinst
@@ -24,7 +24,6 @@
#      Copyright 2013-2015 ForgeRock AS.
#
set -e
# Post install script
# Install is launched with an empty second arg.
# If the package is already installed, the second arg. is not empty.
@@ -42,11 +41,6 @@
        echo *Starting upgrade...
        ${deb.prefix}/./upgrade -n --acceptLicense
        echo
        if [ "$?" -eq 2 ] ; then
            # Upgrade fails - Requires mandatory user interaction.
            # Nevertheless, exits successfully of the pkg process.
            exit 0
        fi
        if [ "$?" -eq 0 ] ; then
            # Restarts the service if needed.
@@ -57,13 +51,31 @@
                echo
                echo "*Restarting server..."
                ${deb.prefix}/./bin/start-ds
                rm -f ${deb.prefix}/logs/status
                if [ "$?" -eq 0 ] ; then
                    rm -f ${deb.prefix}/logs/status
                else
                    echo "start-ds failed with return code $?. Please read ${deb.prefix}/logs/status for more details."
                fi
            fi
        else
            # Upgrade fails - Requires mandatory user interaction.
            # Nevertheless, exits successfully of the pkg process.
            echo "upgrade failed with return code $?. Please read the installation guide for more information on the upgrade process."
            exit 0
        fi
    else
        echo "Invalid installation, could not find the build info file."
        exit -1
    fi
fi
# Add OpenDJ man pages to MANPATH
MAN_CONFIG_FILE=/etc/manpath.config
MANPATH_DIRECTIVE=MANDATORY_MANPATH
grep -q "$MANPATH_DIRECTIVE.*opendj" $MAN_CONFIG_FILE 2> /dev/null
if [ $? -ne 0 ]; then
    echo "$MANPATH_DIRECTIVE ${deb.prefix}/share/man" >> $MAN_CONFIG_FILE
fi
# End post install script
echo
opendj-packages/opendj-rpm/resources/specs/postinstall.sh
@@ -63,3 +63,11 @@
    fi
    fi
fi
# Add OpenDJ man pages to MANPATH
MAN_CONFIG_FILE=/etc/man.config
MANPATH_DIRECTIVE=MANPATH
grep -q "$MANPATH_DIRECTIVE.*opendj" $MAN_CONFIG_FILE 2> /dev/null
if [ $? -ne 0 ]; then
    echo "$MANPATH_DIRECTIVE %{_prefix}/share/man" >> $MAN_CONFIG_FILE
fi