Files
BMLFS/build-scripts/dhcpcd.build

108 lines
3.7 KiB
Bash

#! /bin/bash
# dhcpcd
# Source: https://github.com/NetworkConfiguration/dhcpcd/releases/download/v10.0.4/dhcpcd-10.0.4.tar.xz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: openssl [for privilege separation.]
# Recommended: NONE
# Optional: LLVM(with Clang), ntp, chronyd, and ypbind
# LTO: LLVM, not yet tested with GCC+binutils
# If optimizing, use these flags
# Recommended to not use LTO
export CFLAGS="-march=native -mtune=native -pipe -O3 "
export CXXFLAGS=$CFLAGS
unset LDFLAGS
# Recent releases of dhcpcd implement privilege separation.
install -v -m700 -d /var/lib/dhcpcd &&
# Add the group and user
groupadd -g 52 dhcpcd &&
useradd -c 'dhcpcd PrivSep' \
-d /var/lib/dhcpcd \
-g dhcpcd \
-s /bin/false \
-u 52 dhcpcd &&
chown -v dhcpcd:dhcpcd /var/lib/dhcpcd
# Configure
export WNO="-Wno-implicit-function-declaration "
CFLAGS="-L/opt/openssl/lib -lssl -Wl,-rpath=/opt/openssl/lib " \
CFLAGS="$CFLAGS $WNO " \
CXXFLAGS=$CFLAGS \
LDFLAGS="-L/opt/openssl/lib -lssl -Wl,-rpath=/opt/openssl/lib " \
./configure --prefix=/usr \
--sysconfdir=/etc \
--libexecdir=/usr/lib/dhcpcd \
--dbdir=/var/lib/dhcpcd \
--privsepuser=dhcpcd \
--runstatedir=/run \
--enable-ipv6 \
--enable-privsep \
--enable-seccomp $BUILDTRUPLE
read -p "Compile? " && make -j2 &&
read -p "Press Enter to install" &&
sudo -S make DESTDIR=${BUILD} install
sudo -S mkdir -pv /BMAN/install
sudo -S mkdir -pv /BMAN/usr/share
sudo -S mv $BUILD/usr/share/man /BMAN/usr/share/
unset WNO
read -p "Press Enter to create pakage description." &&
cd $BUILD && sudo mkdir -v install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
dhcpcd: dhcpcd (DHCP client daemon)
dhcpcd:
dhcpcd: The DHCP client program dhcpcd is used to connect to a network by
dhcpcd: contacting a DHCP server. dhcpcd gets an IP address and other
dhcpcd: information from a corresponding DHCP server, configures the network
dhcpcd: interface automatically, and tries to renew the lease time according
dhcpcd: to RFC2131 or RFC1541 depending on the command line option.
dhcpcd:
dhcpcd:
dhcpcd:
dhcpcd:
EOF
cat > /tmp/doinst.sh << "EOF"
groupadd -g 52 dhcpcd &&
useradd -c 'dhcpcd PrivSep' \
-d /var/lib/dhcpcd \
-g dhcpcd \
-s /bin/false \
-u 52 dhcpcd
chown -v dhcpcd:dhcpcd /var/lib/dhcpcd
EOF
sudo -S mv /tmp/doinst.sh install/ &&
sudo -S mv /tmp/slack-desc install/ &&
sudo makepkg -l y -c n $PKGS/dhcpcd-10.0.4-$PSUFFIX &&
cd /BMAN
cat > /tmp/slack-desc << "EOF"
dhcpcd-doc: Manuals for dhcpcd (DHCP client daemon)
dhcpcd-doc:
dhcpcd-doc: The DHCP client program dhcpcd is used to connect to a network by
dhcpcd-doc: contacting a DHCP server. dhcpcd gets an IP address and other
dhcpcd-doc: information from a corresponding DHCP server, configures the network
dhcpcd-doc: interface automatically, and tries to renew the lease time according
dhcpcd-doc: to RFC2131 or RFC1541 depending on the command line option.
dhcpcd-doc:
EOF
sudo -S mv /tmp/slack-desc install/
sudo makepkg -l y -c n $PKGS/dhcpcd-doc-10.0.4-$NOPSUFFIX
sudo -S rm -rf /BMAN/*
sudo rm -rf $BUILD/*