commit 09f5797d3271a17f0f0a5e4b9298d66823d5b2c1 Author: EnumDev Date: Thu May 8 17:18:59 2025 +0300 Initial Commit diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..1d585b1 --- /dev/null +++ b/pkg.info @@ -0,0 +1,9 @@ +name: udev +description: Userspace device file manager +version: 256 +url: https://github.com/systemd/systemd +license: GPL-2.0-or-later,LGPL-2.1-or-later +architecture: any +depends: ["acl","bash","gcc","glibc","hwdata","kbd","kmod","libcap","util-linux"] +make_depends: ["gperf","meson","python-jinja"] +type: source diff --git a/source-files/udev-hwdb.bpmhook b/source-files/udev-hwdb.bpmhook new file mode 100644 index 0000000..faf52ff --- /dev/null +++ b/source-files/udev-hwdb.bpmhook @@ -0,0 +1,5 @@ +trigger_operations: ["install", "upgrade", "remove"] +target_type: "path" +targets: ["usr/lib/udev/hwdb.d/*.hwdb"] +depends: ["udev"] +run: "udev-hwdb update" diff --git a/source-files/udevd.esv b/source-files/udevd.esv new file mode 100644 index 0000000..78d3d04 --- /dev/null +++ b/source-files/udevd.esv @@ -0,0 +1,6 @@ +name: udevd +description: Userspace device file manager daemon +type: background +start_cmd: /etc/esvm/scripts/udevd.sh +stop_cmd: udevadm control -e +exit_method: stop_command diff --git a/source-files/udevd.sh b/source-files/udevd.sh new file mode 100755 index 0000000..36378fa --- /dev/null +++ b/source-files/udevd.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +udevd --daemon && udevadm trigger --action=add + +while udevadm control --ping; do + sleep 0.1 +done diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..0bdc283 --- /dev/null +++ b/source.sh @@ -0,0 +1,68 @@ +# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +DOWNLOAD="https://github.com/systemd/systemd/archive/v${BPM_PKG_VERSION}/systemd-${BPM_PKG_VERSION}.tar.gz" +FILENAME="${DOWNLOAD##*/}" + +# The prepare function is executed in the root of the temp directory +# This function is used for downloading files and putting them into the correct location +prepare() { + wget "$DOWNLOAD" + tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE" +} + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + sed -i -e 's/GROUP="render"/GROUP="video"/' -e 's/GROUP="sgx", //' rules.d/50-udev-default.rules.in + sed '/systemd-sysctl/s/^/#/' -i rules.d/99-systemd.rules.in + sed '/NETWORK_DIRS/s/systemd/udev/' -i src/basic/path-lookup.h + + mkdir build + cd build + + meson setup --prefix=/usr \ + --buildtype=release \ + -Dmode=release \ + -Ddev-kvm-mode=0660 \ + -Dlink-udev-shared=false \ + -Dlogind=false \ + -Dvconsole=false .. \ + + export udev_helpers=$(grep "'name' :" ../src/udev/meson.build | awk '{print $3}' | tr -d ",'" | grep -v 'udevadm') + ninja udevadm systemd-hwdb \ + $(ninja -n | grep -Eo '(src/(lib)?udev|rules.d|hwdb.d)/[^ ]*') \ + $(realpath libudev.so --relative-to .) \ + $udev_helpers +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + cd build + + export udev_helpers=$(grep "'name' :" ../src/udev/meson.build | awk '{print $3}' | tr -d ",'" | grep -v 'udevadm') + + install -dm644 "$BPM_OUTPUT"/usr/{bin,sbin,lib,include} + install -dm644 "$BPM_OUTPUT"/usr/{lib,share}/pkgconfig + install -m755 -d "$BPM_OUTPUT"/{usr/lib,etc}/udev/{hwdb.d,rules.d,network} + install -m755 -d "$BPM_OUTPUT"/usr/{lib,share}/pkgconfig + install -m755 udevadm "$BPM_OUTPUT"/usr/bin/ + install -m755 systemd-hwdb "$BPM_OUTPUT"/usr/bin/udev-hwdb + ln -sfn ../bin/udevadm "$BPM_OUTPUT"/usr/sbin/udevd + cp -a libudev.so{,*[0-9]} "$BPM_OUTPUT"/usr/lib/ + install -m644 ../src/libudev/libudev.h "$BPM_OUTPUT"/usr/include/ + install -m644 src/libudev/*.pc "$BPM_OUTPUT"/usr/lib/pkgconfig/ + install -m644 src/udev/*.pc "$BPM_OUTPUT"/usr/share/pkgconfig/ + install -m644 ../src/udev/udev.conf "$BPM_OUTPUT"/etc/udev/ + install -m644 rules.d/* ../rules.d/README "$BPM_OUTPUT"/usr/lib/udev/rules.d/ + install -m644 $(find ../rules.d/*.rules -not -name '*power-switch*') "$BPM_OUTPUT"/usr/lib/udev/rules.d/ + install -m644 hwdb.d/* ../hwdb.d/{*.hwdb,README} "$BPM_OUTPUT"/usr/lib/udev/hwdb.d/ + install -m755 $udev_helpers "$BPM_OUTPUT"/usr/lib/udev + install -m644 ../network/99-default.link "$BPM_OUTPUT"/usr/lib/udev/network + install -Dm644 "$BPM_WORKDIR"/udevd.esv "$BPM_OUTPUT"/etc/esvm/services/udevd.esv + install -Dm755 "$BPM_WORKDIR"/udevd.sh "$BPM_OUTPUT"/etc/esvm/scripts/udevd.sh + install -Dm644 "$BPM_WORKDIR"/udev-hwdb.bpmhook "$BPM_OUTPUT"/var/lib/bpm/hooks/udev-hwdb.bpmhook + install -Dm644 ../LICENSE.{GPL2,LGPL2.1} -t "$BPM_OUTPUT"/usr/share/licenses/udev/ +}