#!/bin/bash # shadow.SlackBuild # by Stuart Winter for ARMedslack. # Heavily based on the original Slackware build script. # 30-May-2004 # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/$PKGSERIES/$PKGNAM export PORTCWD=$PWD # Temporary build locations: export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # Determine the CFLAGS for the known architectures: case $PORTARCH in arm) export SLKCFLAGS="-O2 -march=armv3 -mtune=xscale" ;; powerpc) export SLKCFLAGS="-O2" ;; sparc) export SLKCFLAGS="-O2" ;; hppa) export SLKCFLAGS="-O2" ;; *) export SLKCFLAGS="-O2" ;; esac # Extract source: tar xvvf $CWD/$PKGNAM-$VERSION.tar.bz2 cd $PKGNAM-$VERSION slackhousekeeping # Apply patches: zcat $CWD/shadow.shadowconfig.diff.gz | patch -p1 --verbose --backup || failpatch zcat $CWD/shadow.newgrp.nopam.gz | patch -p0 --verbose --backup || failpatch zcat $CWD/shadow.login.defs.diff.gz | patch -p0 --verbose --backup || failpatch zcat $CWD/shadow.newgrp.getlogin.gz | patch -p1 --verbose --backup || failpatch zcat $CWD/shadow.gcc34.diff.gz | patch -p1 --verbose --backup || failpatch zcat $CWD/shadow.remove.obsolete.options.diff.gz | patch -p1 --verbose --backup || failpatch # Configure: CFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ --disable-shared \ --disable-desrpc \ --build=$ARCH-slackware-linux || failconfig # Build: make $NUMJOBS || failmake # Start fakeroot server: start_fakeroot # Explode package contents: ( cd $PKG explodepkg $CWD/_shadow.tar.gz ) # Install package contents: 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 # Locales: 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 # Binaries: 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 .. # Docs: mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION cp -fa ABOUT-NLS ChangeLog NEWS README TODO doc/* \ $PKG/usr/doc/$PKGNAM-$VERSION # Man page install functions: 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 .. # Apply generic Slackware packaging policies: cd $PKG slackstripall # strip all .a archives and all ELFs slackgzpages -i # compress man & info pages and delete usr/info/dir slack644docs # set doc file permissions to 644 #slackslack # chown -R root:root, chmod -R og-w, slackchown, slack644docs slackdesc # install slack-desc and doinst.sh slackmp # run makepkg -l y -c n # Perform any final checks on the package: cd $PKG slackhlinks # search for any hard links