aboutsummaryrefslogtreecommitdiff
path: root/patches/sudo/sudo.SlackBuild
blob: e3f58913c880e04941bcc89ff18fb1a94c271775 (plain)
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
#!/bin/bash
#
# Got it from http://slamd64.he.net/slamd64-10.2b/source/ap/sudo/sudo.SlackBuild
# Small changes by rhatto
#

# Set initial variables:
CWD=`pwd`

if [ -f ~/.slackbuildrc ]; then
  source ~/.slackbuildrc
elif [ -f /etc/slackbuildrc ]; then
  source /etc/slackbuildrc
fi

PACKAGE="sudo"
VERSION=${VERSION:=1.6.8p12}
ARCH=${ARCH:=i486}
BUILD=${BUILD:=1rha}
SRC_DIR=${SRC:=$CWD}
TMP=${TMP:=/tmp}
REPOS=${REPOS:=$TMP}

RTOOL="wget"
PACKAGE_EXT="gz"
SRC="$PACKAGE-$VERSION.tar.$PACKAGE_EXT"
URL="http://www.sudo.ws/sudo/dist/$SRC"

if [ "$PACKAGE_EXT" == "bz2" ]; then
  tarflag="j"
else
  tarflag="z"
fi

SRC_DIR="$SRC_DIR/$PACKAGE"
mkdir -p $SRC_DIR

if [ "$RTOOL" == "wget" ] && [ ! -f "$SRC_DIR/$SRC" ]; then
  rm -f $SRC_DIR/$SRC.sig
  wget "$URL" -O "$SRC_DIR/$SRC"
  wget "$URL.sig" -O "$SRC_DIR/$SRC.sig"
fi

gpg --import << EOGPG
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.0.7 (OpenBSD)

mQGiBD2bdiURBACyoSsYq9t8jiLnhABRZcgDP2vaoJoGJD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2bdicACgkQWonfon7kcMTOeACgmCPD1Is5
KhRmc+7kY4ILfdUX5OUAn2mdSBk/pObAfpdPzasJT7QxIQFL
=3GDW
-----END PGP PUBLIC KEY BLOCK-----
EOGPG

gpg --verify $SRC.sig $SRC || echo WARNING: Could not check signature or WRONG signature found.

TMP="$TMP/$PACKAGE"
PKG=$TMP/package-sudo
rm -rf $TMP
mkdir -p $PKG

if [ "$ARCH" = "i386" ]; then
  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
elif [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2"
fi

cd $TMP
rm -rf sudo-$VERSION
tar xvf$tarflag $SRC_DIR/$SRC
cd sudo-$VERSION
chown -R root.root .
CFLAGS="$SLKCFLAGS" \
./configure --prefix=/usr --sbindir=/usr/sbin --with-getpass --with-C2
make || exit 32
make install DESTDIR=$PKG
chown -R root:bin $PKG/usr/bin $PKG/usr/sbin
( cd $PKG/usr/bin
  chmod 4711 sudo
  ln -sf sudo sudoedit
)
chmod 755 $PKG/usr/sbin/visudo
rm -f $PKG/usr/man/man8/sudoedit.8
gzip -9 $PKG/usr/man/man?/*.?
( cd $PKG/usr/man/man8 ; ln -sf sudo.8.gz sudoedit.8.gz )
( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)
mv $PKG/etc/sudoers $PKG/etc/sudoers.new
mkdir -p $PKG/usr/doc/sudo-$VERSION
cp -a \
  BUGS HISTORY INSTALL LICENSE PORTING README README.LDAP RUNSON TODO TROUBLESHOOTING UPGRADE \
  $PKG/usr/doc/sudo-$VERSION
chmod 644 $PKG/usr/doc/sudo-$VERSION/*
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh

# Build the package:
cd $PKG
makepkg -l y -c n $REPOS/sudo-$VERSION-$ARCH-$BUILD.tgz

if [ "$CLEANUP" == "yes" ]; then
  rm -rf $TMP
fi