Files
Arch-R/packages/sysutils/systemd/package.mk

307 lines
12 KiB
Makefile
Raw Normal View History

2018-07-16 20:45:36 +02:00
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
2018-08-01 23:40:03 +01:00
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="systemd"
PKG_VERSION="255.4"
PKG_SHA256="96e75bd08c57ad401677456fb88ef54a9f05bb1695693013bc6ecce839640fd5"
2018-08-01 23:40:03 +01:00
PKG_LICENSE="LGPL2.1+"
PKG_SITE="http://www.freedesktop.org/wiki/Software/systemd"
PKG_URL="https://github.com/systemd/systemd-stable/archive/v${PKG_VERSION}.tar.gz"
2021-04-03 09:19:29 +00:00
PKG_DEPENDS_TARGET="toolchain libcap kmod util-linux entropy libidn2 wait-time-sync Jinja2:host"
2018-10-22 15:06:12 +02:00
PKG_LONGDESC="A system and session manager for Linux, compatible with SysV and LSB init scripts."
2017-10-09 15:11:25 -07:00
PKG_MESON_OPTS_TARGET="--libdir=/usr/lib \
-Drootprefix=/usr \
-Dsplit-usr=false \
2018-04-18 11:47:06 -07:00
-Dsplit-bin=true \
2022-06-07 15:12:06 -07:00
-Ddefault-hierarchy=unified \
2017-10-09 15:11:25 -07:00
-Dtty-gid=5 \
-Dtests=false \
-Dseccomp=disabled \
-Dselinux=disabled \
-Dapparmor=disabled \
-Dpolkit=disabled \
-Dacl=disabled \
-Daudit=disabled \
-Dblkid=enabled \
-Dfdisk=disabled \
-Dkmod=enabled \
-Dpam=disabled \
-Dpwquality=disabled \
-Dmicrohttpd=disabled \
-Dlibcryptsetup=disabled \
-Dlibcurl=disabled \
-Dlibidn=disabled \
-Dlibidn2=enabled \
-Dlibiptc=disabled \
-Dqrencode=disabled \
-Dgcrypt=disabled \
-Dgnutls=disabled \
-Dopenssl=disabled \
-Dp11kit=disabled \
-Delfutils=disabled \
-Dzlib=disabled \
-Dbzip2=disabled \
-Dxz=disabled \
-Dlz4=disabled \
-Dzstd=disabled \
-Dxkbcommon=disabled \
-Dpcre2=disabled \
-Dglib=disabled \
-Ddbus=disabled \
2017-10-09 15:11:25 -07:00
-Ddefault-dnssec=no \
-Dimportd=disabled \
-Dremote=disabled \
2019-12-10 21:10:38 +00:00
-Dutmp=true \
2017-10-09 15:11:25 -07:00
-Dhibernate=false \
-Denvironment-d=false \
-Dbinfmt=false \
-Drepart=disabled \
2017-10-09 15:11:25 -07:00
-Dcoredump=false \
-Dresolve=false \
-Dlogind=true \
-Dhostnamed=true \
2017-10-09 15:11:25 -07:00
-Dlocaled=false \
-Dmachined=false \
2020-03-04 11:38:01 +00:00
-Dportabled=false \
-Duserdb=false \
-Dhomed=disabled \
2017-10-09 15:11:25 -07:00
-Dnetworkd=false \
-Dtimedated=false \
-Dtimesyncd=true \
2017-10-09 15:11:25 -07:00
-Dfirstboot=false \
-Drandomseed=false \
-Dbacklight=false \
-Dvconsole=false \
-Dquotacheck=false \
-Dsysusers=false \
-Dtmpfiles=true \
-Dhwdb=true \
-Drfkill=false \
-Dldconfig=false \
-Dtpm=false \
-Dima=false \
-Dsmack=false \
-Dgshadow=false \
-Didn=false \
2019-04-13 18:51:09 +01:00
-Dnss-myhostname=false \
-Dnss-mymachines=disabled \
-Dnss-resolve=disabled \
2017-10-09 15:11:25 -07:00
-Dnss-systemd=false \
-Dman=disabled \
-Dhtml=disabled \
2020-03-04 11:38:01 +00:00
-Dlink-udev-shared=true \
-Dlink-systemctl-shared=true \
-Dlink-networkd-shared=false \
2017-10-09 15:11:25 -07:00
-Dbashcompletiondir=no \
-Dzshcompletiondir=no \
-Dkmod-path=/usr/bin/kmod \
-Dmount-path=/usr/bin/mount \
-Dumount-path=/usr/bin/umount \
-Ddebug-tty=${DEBUG_TTY} \
-Dversion-tag=${PKG_VERSION}"
2015-05-22 12:28:24 -07:00
if [ "${PROJECT}" = "Generic" ]; then
PKG_MESON_OPTS_TARGET+=" -Defi=true"
else
PKG_MESON_OPTS_TARGET+=" -Defi=false"
fi
pre_configure_target() {
export TARGET_CFLAGS="${TARGET_CFLAGS} -fno-schedule-insns -fno-schedule-insns2 -Wno-format-truncation"
2017-10-09 15:11:25 -07:00
export LC_ALL=en_US.UTF-8
}
post_makeinstall_target() {
# remove unneeded stuff
safe_remove ${INSTALL}/etc/init.d
safe_remove ${INSTALL}/etc/systemd/system
safe_remove ${INSTALL}/etc/xdg
safe_remove ${INSTALL}/etc/X11
safe_remove ${INSTALL}/usr/bin/kernel-install
safe_remove ${INSTALL}/usr/lib/kernel/install.d
safe_remove ${INSTALL}/usr/lib/rpm
safe_remove ${INSTALL}/usr/lib/systemd/user
safe_remove ${INSTALL}/usr/lib/tmpfiles.d/etc.conf
safe_remove ${INSTALL}/usr/lib/tmpfiles.d/home.conf
safe_remove ${INSTALL}/usr/share/factory
# remove Network adaper renaming rule, this is confusing
safe_remove ${INSTALL}/usr/lib/udev/rules.d/80-net-setup-link.rules
safe_remove ${INSTALL}/usr/lib/udev/rules.d/71-seat.rules
safe_remove ${INSTALL}/usr/lib/udev/rules.d/73-seat-late.rules
# remove getty units, we dont want a console
safe_remove ${INSTALL}/usr/lib/systemd/system/autovt@.service
safe_remove ${INSTALL}/usr/lib/systemd/system/console-getty.service
safe_remove ${INSTALL}/usr/lib/systemd/system/container-getty@.service
safe_remove ${INSTALL}/usr/lib/systemd/system/getty.target
safe_remove ${INSTALL}/usr/lib/systemd/system/getty@.service
safe_remove ${INSTALL}/usr/lib/systemd/system/serial-getty@.service
safe_remove ${INSTALL}/usr/lib/systemd/system/*.target.wants/getty.target
2014-07-04 15:44:53 +03:00
# remove other notused or nonsense stuff (our /etc is ro)
safe_remove ${INSTALL}/usr/lib/systemd/systemd-update-done
safe_remove ${INSTALL}/usr/lib/systemd/system/systemd-update-done.service
safe_remove ${INSTALL}/usr/lib/systemd/system/*.target.wants/systemd-update-done.service
#
safe_remove ${INSTALL}/usr/lib/systemd/system/dev-hugepages.mount
safe_remove ${INSTALL}/usr/lib/systemd/system/*.target.wants/dev-hugepages.mount
#
safe_remove ${INSTALL}/usr/lib/systemd/system/systemd-journald-audit.socket
2014-07-04 15:44:53 +03:00
2021-02-26 11:53:43 -08:00
# adjust systemd-hwdb-update (we have read-only /etc).
sed '/^ConditionNeedsUpdate=.*$/d' -i ${INSTALL}/usr/lib/systemd/system/systemd-hwdb-update.service
2017-10-09 15:11:25 -07:00
2015-01-11 20:27:08 +02:00
# remove nspawn
safe_remove ${INSTALL}/usr/bin/systemd-nspawn
safe_remove ${INSTALL}/usr/lib/systemd/system/systemd-nspawn@.service
2015-01-11 20:27:08 +02:00
# remove unneeded generators
for gen in ${INSTALL}/usr/lib/systemd/system-generators/*; do
case "${gen}" in
*/systemd-debug-generator)
# keep it
;;
*)
safe_remove "${gen}"
;;
esac
done
# remove catalog
safe_remove ${INSTALL}/usr/lib/systemd/catalog
2015-01-11 20:27:08 +02:00
2017-12-17 09:40:04 -08:00
# remove partition
safe_remove ${INSTALL}/usr/lib/systemd/systemd-growfs
safe_remove ${INSTALL}/usr/lib/systemd/systemd-makefs
2017-12-17 09:40:04 -08:00
2016-05-22 20:15:23 +01:00
# distro preset policy
safe_remove ${INSTALL}/usr/lib/systemd/system-preset/*
echo "disable *" > ${INSTALL}/usr/lib/systemd/system-preset/99-default.preset
2015-01-11 20:27:08 +02:00
safe_remove ${INSTALL}/usr/lib/systemd/user-preset/*
echo "disable *" > ${INSTALL}/usr/lib/systemd/user-preset/90-systemd.preset
2017-12-17 09:40:04 -08:00
2015-01-11 20:27:08 +02:00
# remove networkd
safe_remove ${INSTALL}/usr/lib/systemd/network
2015-01-11 20:27:08 +02:00
# remove systemd-time-wait-sync (not detecting slew time updates, using package wait-time-sync)
safe_remove ${INSTALL}/usr/lib/systemd/system/systemd-time-wait-sync.service
safe_remove ${INSTALL}/usr/lib/systemd/systemd-time-wait-sync
2015-01-11 20:27:08 +02:00
# tune journald.conf
sed -e "s,^.*Compress=.*$,Compress=no,g" -i ${INSTALL}/etc/systemd/journald.conf
sed -e "s,^.*MaxFileSec=.*$,MaxFileSec=0,g" -i ${INSTALL}/etc/systemd/journald.conf
sed -e "s,^.*MaxRetentionSec=.*$,MaxRetentionSec=0,g" -i ${INSTALL}/etc/systemd/journald.conf
sed -e "s,^.*RuntimeMaxUse=.*$,RuntimeMaxUse=2M,g" -i ${INSTALL}/etc/systemd/journald.conf
sed -e "s,^.*RuntimeMaxFileSize=.*$,RuntimeMaxFileSize=128K,g" -i ${INSTALL}/etc/systemd/journald.conf
sed -e "s,^.*SplitMode=.*$,SplitMode=none,g" -i ${INSTALL}/etc/systemd/journald.conf
sed -e "s,^.*SystemMaxUse=.*$,SystemMaxUse=10M,g" -i ${INSTALL}/etc/systemd/journald.conf
2015-01-11 20:27:08 +02:00
# tune logind.conf
sed -e "s,^.*HandleLidSwitch=.*$,HandleLidSwitch=ignore,g" -i ${INSTALL}/etc/systemd/logind.conf
if [ "${DISPLAYSERVER}" = "no" ]; then
sed -e "s,^.*HandlePowerKey=.*$,HandlePowerKey=poweroff,g" -i ${INSTALL}/etc/systemd/logind.conf
else
sed -e "s,^.*HandlePowerKey=.*$,HandlePowerKey=ignore,g" -i ${INSTALL}/etc/systemd/logind.conf
fi
2015-01-11 20:27:08 +02:00
# replace systemd-machine-id-setup with ours
safe_remove ${INSTALL}/usr/lib/systemd/system/systemd-machine-id-commit.service
safe_remove ${INSTALL}/usr/lib/systemd/system/*.target.wants/systemd-machine-id-commit.service
safe_remove ${INSTALL}/usr/bin/systemd-machine-id-setup
mkdir -p ${INSTALL}/usr/bin
cp ${PKG_DIR}/scripts/systemd-machine-id-setup ${INSTALL}/usr/bin
cp ${PKG_DIR}/scripts/userconfig-setup ${INSTALL}/usr/bin
cp ${PKG_DIR}/scripts/usercache-setup ${INSTALL}/usr/bin
cp ${PKG_DIR}/scripts/environment-setup ${INSTALL}/usr/bin
2015-01-11 20:27:08 +02:00
# use systemd to set cpufreq governor and tunables
find_file_path scripts/cpufreq && cp -PRv ${FOUND_PATH} ${INSTALL}/usr/bin
mkdir -p ${INSTALL}/usr/sbin
cp ${PKG_DIR}/scripts/network-base-setup ${INSTALL}/usr/sbin
cp ${PKG_DIR}/scripts/systemd-timesyncd-setup ${INSTALL}/usr/sbin
# /etc/resolv.conf and /etc/hosts must be writable
ln -sf /run/libreelec/resolv.conf ${INSTALL}/etc/resolv.conf
ln -sf /run/libreelec/hosts ${INSTALL}/etc/hosts
ln -sf /run/libreelec/environment ${INSTALL}/etc/environment
Add support for kernel overlays Core Kernel modules are now installed to /usr/lib/kernel-overlays/base/lib/modules instead of /usr/lib/modules Firmware files are installed to /usr/lib/kernel-overlays/base/lib/firmware instead of /usr/lib/firmware Packages can choose to install their modules and/or firmwareinto a different overlay directory than base so they are not automatically enabled. A new systemd service kernel-overlays, which is run before any modules are loaded, adds overlays enabled via /storage/.cache/kernel-overlays/*.conf These conf files must either contain the name of a system overlay, which will then be searched for in /usr/lib/kernel-overlays/, or an absolute path starting with '/'. Overlaying is implemented by symlinking files from the overlays to /usr/lib/modules and /usr/lib/firmware as not all platforms support overlayfs. This overlaying system can also be used by addons to provide optional kernel modules and/or firmware by storing the absolute path to the addon directory in the conf file and shipping kernel modules in <addondir>/lib/modules/<KERNELVER>. To save space only symlinks for modules matching the currently running kernel version are created as addons may want to ship modules for older kernel versions as well to be backward-compatible to older LibreELEC versions. Changes since v1: - fixup kernel-overlays-service: add before kmod-static-nodes.service Fix static device nodes for module autoloading not being created. - fixup kernel-overlays-service: fail if /usr/lib/modules exists - squash kernel overlays: use get_kernel_overlay_dir in linux/package.mk - Add support for firmware files via kernel overlays - config/functions: include kernel overlays in addon installation Signed-off-by: Matthias Reichl <hias@horus.com>
2017-09-05 09:17:30 +02:00
# provide 'halt', 'shutdown', 'reboot' & co.
ln -sf /usr/bin/systemctl ${INSTALL}/usr/sbin/halt
ln -sf /usr/bin/systemctl ${INSTALL}/usr/sbin/poweroff
ln -sf /usr/bin/systemctl ${INSTALL}/usr/sbin/reboot
ln -sf /usr/bin/systemctl ${INSTALL}/usr/sbin/runlevel
ln -sf /usr/bin/systemctl ${INSTALL}/usr/sbin/shutdown
ln -sf /usr/bin/systemctl ${INSTALL}/usr/sbin/telinit
2016-01-31 00:22:08 +01:00
# strip
debug_strip ${INSTALL}/usr
2016-01-31 00:22:08 +01:00
# defaults
mkdir -p ${INSTALL}/usr/config
cp -PR ${PKG_DIR}/config/* ${INSTALL}/usr/config
safe_remove ${INSTALL}/etc/modules-load.d
ln -sf /storage/.config/modules-load.d ${INSTALL}/etc/modules-load.d
ln -sf /storage/.config/logind.conf.d ${INSTALL}/etc/systemd/logind.conf.d
ln -sf /storage/.config/sleep.conf.d ${INSTALL}/etc/systemd/sleep.conf.d
ln -sf /storage/.config/timesyncd.conf.d ${INSTALL}/etc/systemd/timesyncd.conf.d
safe_remove ${INSTALL}/etc/sysctl.d
ln -sf /storage/.config/sysctl.d ${INSTALL}/etc/sysctl.d
safe_remove ${INSTALL}/etc/tmpfiles.d
ln -sf /storage/.config/tmpfiles.d ${INSTALL}/etc/tmpfiles.d
safe_remove ${INSTALL}/etc/udev/hwdb.d
ln -sf /storage/.config/hwdb.d ${INSTALL}/etc/udev/hwdb.d
safe_remove ${INSTALL}/etc/udev/rules.d
ln -sf /storage/.config/udev.rules.d ${INSTALL}/etc/udev/rules.d
# journald
ln -sf /storage/.cache/journald.conf.d ${INSTALL}/usr/lib/systemd/journald.conf.d
}
post_install() {
add_group systemd-journal 190
add_group systemd-timesync 191
add_user systemd-timesync x 191 191 "systemd-timesync" "/" "/bin/false"
add_group systemd-network 193
add_user systemd-network x 193 193 "systemd-network" "/" "/bin/sh"
add_group systemd-oom 194
add_user systemd-oom x 194 194 "systemd Userspace OOM Killer" "/" "/bin/false"
add_group adm 4
add_group tty 5
add_group disk 6
add_group lp 7
add_group kmem 9
add_group wheel 10
add_group cdrom 11
add_group dialout 18
add_group floppy 19
add_group utmp 22
add_group tape 33
add_group kvm 36
add_group video 39 pipewire
add_group audio 63 pipewire
add_group input 104
add_group render 105
add_group sgx 106
enable_service machine-id.service
enable_service debugconfig.service
enable_service userconfig.service
enable_service usercache.service
enable_service envconfig.service
enable_service cpufreq.service
enable_service network-base.service
enable_service systemd-timesyncd.service
enable_service systemd-timesyncd-setup.service
}