summaryrefslogtreecommitdiffstats
path: root/source/a/shadow/shadow.SlackBuild
blob: 2f0e11786869ae659931ec17163e2c3fc25a9185 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/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