slackware-current/source/a/shadow/shadow.SlackBuild

157 lines
4.9 KiB
Text
Raw Normal View History

#!/bin/sh
# Copyright 2005-2009 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
VERSION=4.0.3
ARCH=${ARCH:-x86_64}
BUILD=${BUILD:-18}
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-shadow
rm -rf $PKG
mkdir -p $TMP $PKG
# Explode the package framework:
cd $PKG
explodepkg $CWD/_shadow.tar.gz
cd $TMP
rm -rf shadow-$VERSION
tar xjvf $CWD/shadow-$VERSION.tar.bz2
cd shadow-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
zcat $CWD/shadow.shadowconfig.diff.gz | patch -p1 --verbose --backup || exit 1
zcat $CWD/shadow.newgrp.nopam.gz | patch -p0 --verbose --backup || exit 1
zcat $CWD/shadow.login.defs.diff.gz | patch -p0 --verbose --backup || exit 1
zcat $CWD/shadow.newgrp.getlogin.gz | patch -p1 --verbose --backup || exit 1
zcat $CWD/shadow.gcc34.diff.gz | patch -p1 --verbose --backup || exit 1
zcat $CWD/shadow.remove.obsolete.options.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
if [ "$ARCH" = "x86_64" ]; then
zcat $CWD/shadow-4.0.3.x86_64.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit 1
fi
./configure \
--prefix=/usr \
--disable-shared \
--disable-desrpc \
--build=$ARCH-slackware-linux
make -j6 || exit 1
cat etc/login.defs.linux > $PKG/etc/login.defs.new
cat etc/login.access > $PKG/etc/login.access.new
cat $CWD/adduser > $PKG/usr/sbin/adduser
# These things aren't needed when using glibc, as it
# supplies its own shadow functions:
#cat lib/libshadow.a > $PKG/usr/lib/libshadow.a
#cp -a lib/pwauth.h $PKG/usr/include/shadow/pwauth.h
#cp -a lib/shadow_.h $PKG/usr/include/shadow/shadow.h
#chmod 644 $PKG/usr/include/shadow/*
#chown root.root $PKG/usr/include/shadow/*
cd po
for file in *.gmo ; do
mkdir -p $PKG/usr/share/locale/$(basename $file .gmo)/LC_MESSAGES
cat $file > $PKG/usr/share/locale/$(basename $file .gmo)/LC_MESSAGES/shadow.mo
done
cd ../src
cat login > $PKG/bin/login
cat su > $PKG/bin/su
cat sulogin > $PKG/sbin/sulogin
cat ../debian/shadowconfig.sh > $PKG/usr/sbin/shadowconfig
for file in chpasswd dpasswd faillog groupadd groupdel groupmod grpck \
lastlog logoutd mkpasswd newusers pwck useradd userdel usermod \
pwconv pwunconv grpconv grpunconv vipw ; do
cat $file > $PKG/usr/sbin/$file
done
for file in chage chfn chsh expiry gpasswd newgrp passwd ; do
cat $file > $PKG/usr/bin/$file
done
cd ..
cp contrib/adduser.sh /sbin/adduser
mkdir -p $PKG/usr/doc/shadow-$VERSION
cp -a \
ABOUT-NLS ChangeLog NEWS README TODO doc/* \
$PKG/usr/doc/shadow-$VERSION
chmod 644 $PKG/usr/doc/shadow-$VERSION/*
install_man_pages() {
for file in chage.1 chfn.1 chsh.1 gpasswd.1 groups.1 login.1 newgrp.1 \
passwd.1 su.1 ; do
if [ -r $file ]; then
mkdir -p $1/man1
gzip -9c $file > $1/man1/$file.gz
fi
done
for file in pw_auth.3 shadow.3 ; do
if [ -r $file ]; then
mkdir -p $1/man3
gzip -9c $file > $1/man3/$file.gz
fi
done
for file in faillog.5 limits.5 login.access.5 login.defs.5 passwd.5 \
porttime.5 shadow.5 suauth.5 ; do
if [ -r $file ]; then
mkdir -p $1/man5
gzip -9c $file > $1/man5/$file.gz
fi
done
for file in chpasswd.8 dpasswd.8 faillog.8 groupadd.8 groupdel.8 groupmod.8 \
grpck.8 lastlog.8 logoutd.8 mkpasswd.8 newusers.8 pwauth.8 pwck.8 pwconv.8 \
shadowconfig.8 sulogin.8 useradd.8 userdel.8 usermod.8 vipw.8 ; do
if [ -r $file ]; then
mkdir -p $1/man8
gzip -9c $file > $1/man8/$file.gz
fi
done
}
cd man
install_man_pages $PKG/usr/man
for dir in * ; do
if [ -d $dir ] ; then
( cd $dir ; install_man_pages $PKG/usr/man/$dir )
fi
done
cd ..
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
# Build the package:
cd $PKG
makepkg -l y -c n $TMP/shadow-$VERSION-$ARCH-$BUILD.txz
# Clean up the extra stuff:
if [ "$1" = "--cleanup" ]; then
rm -rf $TMP/shadow-$VERSION
rm -rf $PKG
fi