security/sudo/sudo.sh

Fri, 15 Nov 2019 20:11:00 +0100

author
David Demelier <markand@malikania.fr>
date
Fri, 15 Nov 2019 20:11:00 +0100
changeset 1210
422313c3fcbd
parent 1019
ddab65a5b3f5
child 1216
6710613b88b9
permissions
-rw-r--r--

text/rarian: initial import, closes #2311

1019
ddab65a5b3f5 vanilla: use /bin/busybox sh as default shell
David Demelier <markand@malikania.fr>
parents: 943
diff changeset
1 #!/bin/busybox sh
943
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
2 #
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
3 # Copyright (c) 2019 David Demelier <markand@malikania.fr>
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
4 #
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
5 # Permission to use, copy, modify, and/or distribute this software for any
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
6 # purpose with or without fee is hereby granted, provided that the above
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
7 # copyright notice and this permission notice appear in all copies.
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
8 #
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
16 #
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
17
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
18 # TODO: add SELINUX support
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
19
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
20 PKGNAME=sudo
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
21 PKGVERSION=1.8.27
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
22 PKGREVISION=1
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
23 PKGLICENSE="ISC"
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
24 PKGSUMMARY="program to give limited root privileges to users"
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
25 PKGDOWNLOAD="https://www.sudo.ws/dist/$PKGNAME-$PKGVERSION.tar.gz"
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
26 PKGDEPENDS=""
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
27 PKGOPTIONS="NLS PAM"
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
28 PKGPROTECT="etc/sudoers etc/pam.d/sudo"
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
29
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
30 : ${CHOST:=$(uname -m)-linux-musl}
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
31 : ${CBUILD:=$(uname -m)-linux-musl}
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
32 : ${CC:=clang}
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
33 : ${CFLAGS:=-O2}
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
34 : ${LDFLAGS:=}
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
35 : ${LIBS:=}
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
36 : ${NLS:=yes}
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
37 : ${PAM:=yes}
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
38
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
39 if [ "$NLS" = "yes" ]; then
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
40 PKGDEPENDS="gettext $PKGDEPENDS"
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
41 with_nls="--enable-nls"
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
42 else
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
43 with_nls="--disable-nls"
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
44 fi
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
45
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
46 if [ "$PAM" = "yes" ]; then
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
47 PKGDEPENDS="linux-pam $PKGDEPENDS"
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
48 with_pam="--with-pam"
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
49 else
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
50 with_pam="--without-pam"
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
51 fi
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
52
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
53 build()
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
54 {
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
55 rm -rf $PKGNAME-$PKGVERSION
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
56 tar xvf $PKGNAME-$PKGVERSION.tar.gz
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
57 cd $PKGNAME-$PKGVERSION
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
58
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
59 CC="$CC" \
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
60 CFLAGS="$CFLAGS" \
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
61 LDFLAGS="$LDFLAGS" \
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
62 LIBS="$LIBS" \
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
63 ./configure \
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
64 --build=$CBUILD \
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
65 --host=$CHOST \
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
66 --prefix= \
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
67 --sbindir=/bin \
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
68 $with_nls \
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
69 $with_pam
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
70 make
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
71 make install DESTDIR=$DESTDIR
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
72 find $DESTDIR -type f -name "*.la" -delete
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
73
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
74 if [ "$PAM" = "yes" ]; then
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
75 install -Dm0600 ../sudo $DESTDIR/etc/pam.d/sudo
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
76 fi
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
77
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
78 cd ..
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
79 rm -rf $PKGNAME-$PKGVERSION
e8400b792705 security/sudo: initial import, closes #1064
David Demelier <markand@malikania.fr>
parents:
diff changeset
80 }

mercurial