bashrc_sssd revision 0b5422c874a0d234b864a28cf18489a7e7ef17f6
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# For best results, add the following lines to ~/.bashrc:
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# if [ -f /path/to/sssd-source/contrib/fedora/bashrc_sssd ]; then
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# . /path/to/sssd-source/contrib/fedora/bashrc_sssd
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# fi
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# Determine the architecture of the platform we're running on
2e2909686735ceb62f6b64972b3f30f7005e26aaNikolai KondrashovSSS_ARCH=$(uname -m)
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# Determine the lib and libdir locations
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen GallagherSSS_LIB=$(rpm --eval %{_lib})
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen GallagherSSS_LIBDIR=$(rpm --eval %{_libdir})
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# Add the following line to your .bashrc if you want SSSD to throw errors on
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# compiler warnings (recommended)
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# SSS_WERROR=-Werror
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# Determine the number of available processors on the system for parallel make
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# invocation.
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen GallagherPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# Configure invocation for use on Fedora systems, based on the %configure RPM
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# macro from the redhat-rpm-config package. This function assumes you are
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# building in a parallel build directory beneath the source directory. All
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# other functions in this script will assume that the location is
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# /path/to/sssd-source/$SSS_ARCH
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagherfedconfig()
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher{
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher ../configure \
3c77599361395caeffe91ad5b7553f29e7859942Stephen Gallagher --build=$SSS_ARCH-unknown-linux-gnu \
3c77599361395caeffe91ad5b7553f29e7859942Stephen Gallagher --host=$SSS_ARCH-unknown-linux-gnu \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --program-prefix= \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --prefix=/usr \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --exec-prefix=/usr \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --bindir=/usr/bin \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --sbindir=/usr/sbin \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --sysconfdir=/etc \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --datadir=/usr/share \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --includedir=/usr/include \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --libdir=$SSS_LIBDIR \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --libexecdir=/usr/libexec \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --localstatedir=/var \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --sharedstatedir=/var/lib \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --mandir=/usr/share/man \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --infodir=/usr/share/info \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --enable-nsslibdir=/$SSS_LIB \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --enable-pammoddir=/$SSS_LIB/security \
b96988a35bfb5f6faf2e364ae966166398afeca3Stephen Gallagher --with-krb5-rcache-dir=/var/cache/krb5rcache \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --with-initscript=systemd \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --with-syslog=journald \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --with-test-dir=/dev/shm \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --enable-all-experimental-features \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher --cache-file=/tmp/fedconfig.cache \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher ${SSSD_NO_MANPAGES-} \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher "$@"
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher}
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# Completely purge the current working directory, then recreate
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# and reconfigure it. This is best used when you are making changes to the m4
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# macros or the configure scripts.
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagherreconfig()
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher{
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher autoreconf -if \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher && rm -Rf $SSS_ARCH/ \
2930ff3863961403d89a0b1147c14b82f91ad7ebStephen Gallagher && mkdir $SSS_ARCH/ \
2930ff3863961403d89a0b1147c14b82f91ad7ebStephen Gallagher && cd $SSS_ARCH/ \
2930ff3863961403d89a0b1147c14b82f91ad7ebStephen Gallagher && fedconfig "$@"
2930ff3863961403d89a0b1147c14b82f91ad7ebStephen Gallagher}
2930ff3863961403d89a0b1147c14b82f91ad7ebStephen Gallagher
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# Set the list of warnings that you want to detect (and in the case of remake
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# and chmake want to treat as errors)
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen GallagherSSS_WARNINGS='-Wall \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher -Wextra \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher -Wno-unused-parameter \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher -Wno-sign-compare \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher -Wformat-security'
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# Build (or finish building) all objects and then run the build-tests against
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# them. This builds with optimizations turned off and GDB debugging symbols.
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagherchmake()
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher{
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher make V=0 CFLAGS+="-ggdb3 -O0 $SSS_WARNINGS ${SSS_WERROR-}" \
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher -j$PROCESSORS check "$@"
2930ff3863961403d89a0b1147c14b82f91ad7ebStephen Gallagher}
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# Clean the build directory and rebuild all objects, then run the build-tests
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# against them. This builds with optimizations turned off and GDB debugging
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# symbols.
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagherremake()
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher{
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher make clean > /dev/null && chmake "$@"
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher}
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# Clean the build directory and rebuild all objects, hiding most of the build
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# output except for warnings and errors. This builds with default
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagher# optimization and without debugging symbols.
ccaea33f064842b16c7c9efeb50028cacdee6b2fStephen Gallagherwarn()
{
make clean >/dev/null \
&& make CFLAGS+="$SSS_WARNINGS" -j$PROCESSORS tests > /dev/null "$@"
}
# Install the built sources to the current system, cleaning up the LDB modules
# and making sure that the NSS and PAM modules have the right SELinux context.
sssinstall()
{
sudo make -j$PROCESSORS install \
&& sudo rm -f $SSS_LIBDIR/ldb/modules/ldb/memberof.la \
&& sudo restorecon -v /$SSS_LIB/libnss_sss.so.2 \
/$SSS_LIB/security/pam_sss.so
}
# Alias to generate a patch or series of patches that meet SSSD submission
# guidelines.
# Usage:
# genpatch -N (where N is the number of patches to submit)
genpatch()
{
git format-patch -M -C --patience --full-index "$@"
}