2018-05-28 21:12:29 +02:00
|
|
|
#!/bin/bash
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2021-09-16 04:52:54 +02:00
|
|
|
# Copyright 2008, 2009, 2010, 2013, 2014, 2017, 2018, 2020, 2021 Patrick J. Volkerding, Sebeka, MN, USA
|
2009-08-26 17:00:38 +02:00
|
|
|
# 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.
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
cd $(dirname $0) ; CWD=$(pwd)
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
PKGNAM=dhcpcd
|
|
|
|
VERSION=${VERSION:-$(echo dhcpcd-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
|
2022-08-28 21:16:39 +02:00
|
|
|
BUILD=${BUILD:-2}
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2021-09-16 04:52:54 +02:00
|
|
|
# By default, Slackware builds dhcpcd with privilege separation, which improves
|
|
|
|
# security by ensuring that any security vulnerabilies such as buffer overflows
|
|
|
|
# or shell metacharacter insertion would gain access to an unprivileged user
|
2021-09-17 19:22:57 +02:00
|
|
|
# (the dhcpcd user) rather than the root user.
|
2021-09-16 04:52:54 +02:00
|
|
|
PRIVSEP=${PRIVSEP:-yes}
|
|
|
|
|
2018-09-21 20:51:07 +02:00
|
|
|
NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
|
2010-05-19 10:58:23 +02:00
|
|
|
|
|
|
|
# Automatically determine the architecture we're building on:
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
2016-06-30 22:26:57 +02:00
|
|
|
i?86) export ARCH=i586 ;;
|
2010-05-19 10:58:23 +02:00
|
|
|
arm*) export ARCH=arm ;;
|
|
|
|
# Unless $ARCH is already set, use uname -m for all other archs:
|
|
|
|
*) export ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2018-05-28 21:12:29 +02:00
|
|
|
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
|
|
|
|
# the name of the created package would be, and then exit. This information
|
|
|
|
# could be useful to other scripts.
|
|
|
|
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
|
|
|
|
echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2009-08-26 17:00:38 +02:00
|
|
|
TMP=${TMP:-/tmp}
|
|
|
|
PKG=$TMP/package-dhcpcd
|
|
|
|
|
2016-06-30 22:26:57 +02:00
|
|
|
if [ "$ARCH" = "i586" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
|
2010-05-19 10:58:23 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2009-08-26 17:00:38 +02:00
|
|
|
elif [ "$ARCH" = "s390" ]; then
|
|
|
|
SLKCFLAGS="-O2"
|
2010-05-19 10:58:23 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2009-08-26 17:00:38 +02:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
2010-05-19 10:58:23 +02:00
|
|
|
LIBDIRSUFFIX="64"
|
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
2009-08-26 17:00:38 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG
|
|
|
|
cd $TMP
|
|
|
|
rm -rf dhcpcd-$VERSION
|
2018-05-28 21:12:29 +02:00
|
|
|
tar xvf $CWD/dhcpcd-$VERSION.tar.?z || exit 1
|
2009-08-26 17:00:38 +02:00
|
|
|
cd dhcpcd-$VERSION
|
|
|
|
chown -R root:root .
|
|
|
|
find . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
2019-09-30 23:08:32 +02:00
|
|
|
-exec chmod 755 {} \+ -o \
|
2009-08-26 17:00:38 +02:00
|
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
2019-09-30 23:08:32 +02:00
|
|
|
-exec chmod 644 {} \+
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2019-01-23 23:02:34 +01:00
|
|
|
patch -p1 --verbose < $CWD/patches/dhcpcd.conf-Don-t-invoke-wpa_supplicant-by-default.patch || exit 1
|
|
|
|
patch -p1 --verbose < $CWD/patches/use-hostname_short-in-dhcpcd.conf.patch || exit 1
|
|
|
|
patch -p1 --verbose < $CWD/patches/dhcpcd.conf-request_ntp_server_by_default.patch || exit 1
|
2022-08-28 21:16:39 +02:00
|
|
|
patch -p1 --verbose < $CWD/patches/645c32dd1a511527b7eb88443a28dfe7704d5f52.patch || exit 1
|
|
|
|
patch -p1 --verbose < $CWD/patches/38befd4e867583002b96ec39df733585d74c4ff5.patch || exit 1
|
2013-11-04 18:08:47 +01:00
|
|
|
|
2010-05-19 10:58:23 +02:00
|
|
|
# At this point, it should be safe to assume that /var will be mounted by the
|
|
|
|
# time dhcpcd is called, as all non-root local filesystems are mounted from
|
|
|
|
# /etc/rc.d/rc.S, and /var should not be on a network filesystem. As such,
|
|
|
|
# we'll use the FHS layout instead of putting things in /etc/dhcpc
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2021-09-16 04:52:54 +02:00
|
|
|
# Set options to build with or without privsep:
|
|
|
|
if [ "$PRIVSEP" = "yes" ]; then
|
|
|
|
PRIVSEP_OPTIONS="--enable-privsep --privsepuser=dhcpcd"
|
|
|
|
unset TAG
|
|
|
|
else
|
|
|
|
PRIVSEP_OPTIONS="--disable-privsep"
|
|
|
|
TAG="_noprivsep"
|
|
|
|
fi
|
|
|
|
|
2010-05-19 10:58:23 +02:00
|
|
|
# Yes, /lib/dhcpcd is correct, even on x86_64.
|
2009-08-26 17:00:38 +02:00
|
|
|
CFLAGS="$SLKCFLAGS" \
|
2010-05-19 10:58:23 +02:00
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
|
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
|
|
|
--sbindir=/sbin \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--dbdir=/var/lib/dhcpcd \
|
|
|
|
--libexecdir=/lib/dhcpcd \
|
|
|
|
--mandir=/usr/man \
|
2018-05-28 21:12:29 +02:00
|
|
|
--rundir=/run \
|
2021-09-16 04:52:54 +02:00
|
|
|
$PRIVSEP_OPTIONS \
|
2018-05-28 21:12:29 +02:00
|
|
|
--build=$ARCH-slackware-linux || exit 1
|
2010-05-19 10:58:23 +02:00
|
|
|
|
|
|
|
make $NUMJOBS || make || exit 1
|
|
|
|
make install DESTDIR=$PKG HOOKSCRIPTS="50-ntp.conf 50-yp.conf" || exit 1
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" \
|
|
|
|
| grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
|
|
|
|
2010-05-19 10:58:23 +02:00
|
|
|
# Let's not clobber the config file
|
|
|
|
mv $PKG/etc/dhcpcd.conf $PKG/etc/dhcpcd.conf.new
|
|
|
|
|
2012-09-26 03:10:42 +02:00
|
|
|
# Compress and link manpages, if any:
|
|
|
|
if [ -d $PKG/usr/man ]; then
|
|
|
|
( cd $PKG/usr/man
|
|
|
|
for manpagedir in $(find . -type d -name "man*") ; do
|
|
|
|
( cd $manpagedir
|
|
|
|
for eachpage in $( find . -type l -maxdepth 1) ; do
|
|
|
|
ln -s $( readlink $eachpage ).gz $eachpage.gz
|
|
|
|
rm $eachpage
|
|
|
|
done
|
|
|
|
gzip -9 *.?
|
|
|
|
)
|
|
|
|
done
|
|
|
|
)
|
|
|
|
fi
|
2010-05-19 10:58:23 +02:00
|
|
|
|
2009-08-26 17:00:38 +02:00
|
|
|
mkdir -p $PKG/usr/doc/dhcpcd-$VERSION
|
Fri Jan 3 22:41:57 UTC 2020
a/grep-3.4-x86_64-1.txz: Upgraded.
ap/linuxdoc-tools-0.9.73-x86_64-4.txz: Rebuilt.
Upgraded some included components:
asciidoc-8.6.10-0.13.20180605git986f99d.fc32,
docbook-style-xsl-1.79.2-10.fc31, docbook-utils-0.6.14-48.fc31,
gnome-doc-utils-0.20.10-20.fc32, gtk-doc-1.32-2.fc32,
opensp-1.5.2-33.fc31, perl-XML-NamespaceSupport-1.12-9.fc31,
perl-XML-SAX-1.02-2.fc31, perl-XML-SAX-Base-1.09-9.fc31,
sgml-common-0.6.3-53.fc31, xmlto-0.0.28-12.fc31.
Thanks to Stuart Winter.
n/dhcpcd-8.1.5-x86_64-1.txz: Upgraded.
n/sshfs-3.7.0-x86_64-1.txz: Upgraded.
x/libinput-1.15.0-x86_64-1.txz: Upgraded.
xap/MPlayer-20200103-x86_64-1.txz: Upgraded.
extra/pure-alsa-system/MPlayer-20200103-x86_64-1_alsa.txz: Upgraded.
2020-01-03 23:41:57 +01:00
|
|
|
cp -a BUILDING* LICENSE* README* $PKG/usr/doc/dhcpcd-$VERSION
|
2009-08-26 17:00:38 +02:00
|
|
|
|
2012-09-26 03:10:42 +02:00
|
|
|
# If there's a ChangeLog, installing at least part of the recent history
|
|
|
|
# is useful, but don't let it get totally out of control:
|
|
|
|
if [ -r ChangeLog ]; then
|
|
|
|
DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
|
|
|
|
cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
|
|
|
|
touch -r ChangeLog $DOCSDIR/ChangeLog
|
|
|
|
fi
|
|
|
|
|
2009-08-26 17:00:38 +02:00
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
2010-05-19 10:58:23 +02:00
|
|
|
zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
|
2009-08-26 17:00:38 +02:00
|
|
|
|
|
|
|
cd $PKG
|
2021-09-16 04:52:54 +02:00
|
|
|
/sbin/makepkg -l y -c n $TMP/dhcpcd-$VERSION-$ARCH-$BUILD$TAG.txz
|