aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPS <p@0x53.net>2026-02-01 12:10:12 +0100
committerPS <p@0x53.net>2026-02-01 12:10:12 +0100
commit049d80ae0e2b5f6370411207ed27fe423f5ff451 (patch)
tree4cdb7da70fff54ef52bd1d0a496d112b9ab19b2c
downloadmdevd-conf-049d80ae0e2b5f6370411207ed27fe423f5ff451.tar.gz
mdevd-conf-049d80ae0e2b5f6370411207ed27fe423f5ff451.tar.bz2
mdevd-conf-049d80ae0e2b5f6370411207ed27fe423f5ff451.zip
version 0.1.0.0
-rw-r--r--AUTHORS10
-rw-r--r--CONTRIBUTING5
-rw-r--r--COPYING13
-rw-r--r--DCO37
-rw-r--r--INSTALL83
-rw-r--r--Makefile87
-rw-r--r--NEWS6
-rwxr-xr-xconfigure196
-rw-r--r--package/deps.mak10
-rw-r--r--package/extras.mak1
-rw-r--r--package/info4
-rw-r--r--package/modes2
-rw-r--r--package/targets.mak22
-rwxr-xr-xsrc/bin/mddc-add-block-sym80
-rwxr-xr-xsrc/bin/mddc-del-block-sym14
-rw-r--r--src/lib/etc/mdev.conf32
-rwxr-xr-xtools/gen-deps.sh35
-rwxr-xr-xtools/gen-targets.sh56
-rwxr-xr-xtools/install.sh69
19 files changed, 762 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..1d835d3
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,10 @@
+Main author:
+ Paul Sopka <psopka@sopka.ch>
+
+Contributors:
+
+Thanks to:
+ Laurent Bercot <ska-skaware@skarnet.org>
+ Dan J. Bernstein <djb@cr.yp.to>
+ Paul Jarc <prj@dogmap.org>
+ Jonathan de Boyne Pollard <J.deBoynePollard@NTLWorld.com>
diff --git a/CONTRIBUTING b/CONTRIBUTING
new file mode 100644
index 0000000..6279422
--- /dev/null
+++ b/CONTRIBUTING
@@ -0,0 +1,5 @@
+ Please add a Signed-Off-By: line at the end of your commit,
+which certifies that you have the right and authority to pass
+it on as an open-source patch, as explicited in the Developer's
+Certificate of Origin available in this project's DCO file,
+or at https://developercertificate.org/
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..2dec60d
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,13 @@
+Copyright (c) 2024-2025 Paul Sopka <psopka@sopka.ch>
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/DCO b/DCO
new file mode 100644
index 0000000..8201f99
--- /dev/null
+++ b/DCO
@@ -0,0 +1,37 @@
+Developer Certificate of Origin
+Version 1.1
+
+Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
+1 Letterman Drive
+Suite D4700
+San Francisco, CA, 94129
+
+Everyone is permitted to copy and distribute verbatim copies of this
+license document, but changing it is not allowed.
+
+
+Developer's Certificate of Origin 1.1
+
+By making a contribution to this project, I certify that:
+
+(a) The contribution was created in whole or in part by me and I
+ have the right to submit it under the open source license
+ indicated in the file; or
+
+(b) The contribution is based upon previous work that, to the best
+ of my knowledge, is covered under an appropriate open source
+ license and I have the right under that license to submit that
+ work with modifications, whether created in whole or in part
+ by me, under the same open source license (unless I am
+ permitted to submit under a different license), as indicated
+ in the file; or
+
+(c) The contribution was provided directly to me by some other
+ person who certified (a), (b) or (c) and I have not modified
+ it.
+
+(d) I understand and agree that this project and the contribution
+ are public and that a record of the contribution (including all
+ personal information I submit with it, including my sign-off) is
+ maintained indefinitely and may be redistributed consistent with
+ this project or the open source license(s) involved.
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..19c0276
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,83 @@
+Build Instructions
+------------------
+
+* Requirements
+ ------------
+
+ - A POSIX-compliant set of utils
+ - A set of OS specific utils
+ - s6 https://skarnet.org/software/s6/
+ - s6-rc https://skarnet.org/software/s6-rc/
+ - execline https://skarnet.org/software/execline/
+
+ This software will run on any operating system that implements
+POSIX.1-2008, available at:
+ https://pubs.opengroup.org/onlinepubs/9699919799/
+
+
+* Standard usage
+ --------------
+
+ ./configure && make && sudo make install
+
+ will work for most users.
+
+
+* Customization
+ -------------
+
+ You can customize paths via flags given to configure.
+ See ./configure --help for a list of all available configure options.
+
+* Make variables
+ --------------
+
+ You can invoke make with a few variables for more configuration.
+
+ INSTALL can be overridden on the make command line. This is
+an even bigger hammer than running ./configure with environment
+variables, so it is advised to only do this when it is the only way of
+obtaining the behaviour you want.
+
+ DESTDIR can be given on the "make install" command line in order to
+install to a staging directory.
+
+* The slashpackage convention
+ ---------------------------
+
+ The slashpackage convention (http://cr.yp.to/slashpackage.html)
+is a package installation scheme that provides a few guarantees
+over other conventions such as the FHS, for instance fixed
+absolute pathnames. skarnet.org packages support it: use the
+--enable-slashpackage option to configure, or
+--enable-slashpackage=DIR for a prefixed DIR/package tree.
+This option will activate slashpackage support during the build
+and set slashpackage-compatible installation directories.
+If $package_home is the home of the package, defined as
+DIR/package/$category/$package-$version with the variables
+read from the package/info file, then:
+
+ --bindir is set to $package_home/command
+ --sbindir is also set to $package_home/command (slashpackage
+differentiates root-only binaries by their Unix rights, not their
+location in the filesystem)
+ --libdir is set to $package_home/
+
+ --prefix is pretty much ignored when you use --enable-slashpackage.
+You should probably not use both --enable-slashpackage and --prefix.
+
+ When using slashpackage, two additional Makefile targets are
+available after "make install":
+ - "make update" changes the default version of the software to the
+freshly installed one. (This is useful when you have several installed
+versions of the same software, which slashpackage supports.)
+ - "make global-links" adds links from /command and /library.so to the
+default version of the binaries and shared libraries.
+
+
+* Out-of-tree builds
+ ------------------
+
+ This package does not support out-of-tree builds. It
+is small, so it does not cost much to duplicate the entire
+source tree if parallel builds are needed.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..0e68c25
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,87 @@
+#
+# This makefile requires make compliant with POSIX Issue 8.
+# It also reliably works with modern GNU make.
+# Do not make changes here.
+# Use the included .mak files.
+#
+
+.POSIX:
+
+IT = conferror
+
+-include config.mak
+
+it: $(IT)
+
+conferror:
+ @echo "Please use ./configure first." ; exit 1
+
+ALL_EXTRAS ::=
+INSTALL_EXTRAS ::=
+
+-include package/extras.mak
+
+include package/targets.mak
+include package/deps.mak
+
+INSTALL ::= ./tools/install.sh
+
+all: $(ALL_BINS) $(ALL_LIBS) $(ALL_EXTRAS)
+
+clean:
+ @exec rm -rf -- $(ALL_BINS) service source bundle etc
+
+distclean: clean
+ @exec rm -f -- config.mak
+
+tgz: distclean
+ @. package/info && \
+ rm -rf /tmp/$$package-$$version && \
+ cp -a . /tmp/$$package-$$version && \
+ cd /tmp && \
+ tar -zpcv --owner=0 --group=0 --numeric-owner --exclude=.git* -f /tmp/$$package-$$version.tar.gz $$package-$$version && \
+ exec rm -rf /tmp/$$package-$$version
+
+install: $(INSTALL_BINS) $(INSTALL_LIBS) $(INSTALL_EXTRAS)
+
+$(ALL_BINS) $(ALL_LIBS):
+ @test -z $$(dirname "$@") || mkdir -p -- $$(dirname "$@")
+ exec sed \
+ -e 's/@syslogdir@/$(syslogdir)/g' \
+ -e 's/@usrlogdir@/$(usrlogdir)/g' \
+ -e 's/@logdep@/$(logdep)/g' \
+ -e 's/@logconfig@/$(logconfig)/g' \
+ -e 's/@loguser@/$(loguser)/g' \
+ -e 's/@sysconfdir@/$(sysconfdir)/g' \
+ -e 's/@usrconfdir@/$(usrconfdir)/g' \
+ -e 's/@tmpfsdir@/$(tmpfsdir)/g' \
+ -e 's/@sysrundir@/$(sysrundir)/g' \
+ -e 's/@usrrundir@/$(usrrundir)/g' \
+ -e 's/@timeout@/$(timeout)/g' \
+ -e 's/@shebangdir@/$(shebangdir)/g' \
+ -- $^ > $@
+
+$(INSTALL_BINS) $(INSTALL_LIBS):
+ exec $(INSTALL) -D -m 644 $^ $@
+ grep -F -- $^ - < package/modes | { read name mode owner && \
+ if [ x$${mode} != x ] ; then chmod $${mode} $@ ; fi && \
+ if [ x$${owner} != x ] ; then chown -- $${owner} $@ ; fi ; } || exit 0
+
+
+$(DESTDIR)$(exthome):
+ exec $(INSTALL) -D -l $(package)-$(version) $@
+
+$(SLASHCOMMAND_BINS):
+ exec $(INSTALL) -D -l $(exthome)/command/$$(basename $@) $@
+
+update: $(DESTDIR)$(exthome)
+global-links: $(SLASHCOMMAND_BINS)
+
+uninstall:
+ exec rm -f $(INSTALL_BINS) $(SLASHCOMMAND_BINS)
+ exec rm -Rf $(libdir)
+
+.PHONY: \
+ it all clean distclean tgz update global-links \
+ install uninstall \
+ $(DESTDIR)$(exthome) $(SLASHCOMMAND_BINS)
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..843464f
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,6 @@
+Changelog for goetia-base.
+
+In 0.0.0.1
+----------
+
+ - Initial release
diff --git a/configure b/configure
new file mode 100755
index 0000000..5facfc0
--- /dev/null
+++ b/configure
@@ -0,0 +1,196 @@
+#!/bin/sh
+
+cd `dirname "$0"`
+. package/info
+
+usage () {
+cat <<EOF
+Usage: $0 [OPTION]... [TARGET]
+
+Defaults for the options are specified in brackets.
+
+Installation directories:
+ --prefix=PREFIX main installation prefix [/]
+ --exec-prefix=EPREFIX installation prefix for executable files [PREFIX]
+
+Fine tuning of the installation directories:
+ --libdir=DIR service and source directories [PREFIX/lib/$package]
+ --bindir=BINDIR user executables [EPREFIX/bin]
+
+Binaries
+ --shebangdir=SHEBANGDIR dir used to find interpreters for scripts [PREFIX/bin]
+
+Logging
+ --syslogdir=LOGDIR system logdir [PREFIX/var/log/goetia]
+ --usrlogdir=LOGDIR user logdir appended to \${HOME} [.local/state/log]
+
+ --logconfig=LOGCONFIG directives for autogenerated s6-log scripts [n3 T]
+ --loguser=LOGUSER user running all system s6-log processes [logger]
+ --logdep=LOGDEP dependencies for autogenerated system s6-log processes [mount]
+
+Other
+ --sysconfdir=CONFIGDIR systemtree configdir [PREFIX/etc/goetia/system]
+ --usrconfdir=CONFIGDIR usertree configdir appended to \${HOME} [.config/goetia]
+
+ --tmpfsdir=TMPFSDIR tmpfs dir used for supervision trees [/run]
+ --sysrundir=SYSRUNDIR systemtree runtime dir appended to TMPFSDIR [system]
+ --usrrundir=USRRUNDIR usertree runtime dir appended to TMPFSDIR [user]
+
+ --timeout=TIMEOUT Timeout in ms for s6-rc invocations in init and shutdown scripts [60000]
+
+Optional features:
+ --enable-slashpackage[=ROOT] assume /package installation at ROOT [disabled]
+
+EOF
+exit 0
+}
+
+# Helper functions
+
+# If your system does not have printf, you can comment this, but it is
+# generally not a good idea to use echo.
+# See http://www.etalabs.net/sh_tricks.html
+echo () {
+ printf %s\\n "$*"
+}
+
+quote () {
+ tr '\n' ' ' <<EOF | grep '^[-[:alnum:]_=,./:]* $' >/dev/null 2>&1 && { echo "$1" ; return 0 ; }
+$1
+EOF
+ echo "$1" | sed -e "s/'/'\\\\''/g" -e "1s/^/'/" -e "\$s/\$/'/" -e "s#^'\([-[:alnum:]_,./:]*\)=\(.*\)\$#\1='\2#" -e "s|\*/|* /|g"
+}
+
+fail () {
+ echo "$*"
+ exit 1
+}
+
+fnmatch () {
+ eval "case \"\$2\" in $1) return 0 ;; *) return 1 ;; esac"
+}
+
+stripdir () {
+ while eval "fnmatch '*/' \"\${$1}\"" ; do
+ eval "$1=\${$1%/}"
+ done
+}
+
+escapeslash () {
+ echo "$1" | sed -e 's/\//\\\//g'
+}
+
+# Actual script
+
+prefix=
+exec_prefix='$prefix'
+bindir='$exec_prefix/bin'
+libdir='$prefix/lib/$package'
+
+shebangdir='$prefix/bin'
+
+syslogdir='$prefix/var/log/goetia'
+usrlogdir='.local/state/log'
+
+logconfig='n3 T'
+loguser='logger'
+logdep='mount'
+
+sysconfdir='$prefix/etc/goetia/system'
+usrconfdir='.config/goetia'
+
+tmpfsdir='$prefix/run'
+sysrundir='system'
+usrrundir='user'
+
+timeout=60000
+
+slashpackage=false
+sproot=
+home=
+exthome=
+build=
+
+for arg ; do
+ case "$arg" in
+ --help) usage ;;
+ --prefix=*) prefix=${arg#*=} ;;
+ --exec-prefix=*) exec_prefix=${arg#*=} ;;
+ --bindir=*) bindir=${arg#*=} ;;
+ --libdir=*) libdir=${arg#*=} ;;
+ --shebangdir=*) shebangdir=${arg#*=} ;;
+ --syslogdir=*) syslogdir=${arg#*=} ;;
+ --usrlogdir=*) usrlogdir=${arg#*=} ;;
+ --logconfig=*) logconfig=${arg#*=} ;;
+ --loguser=*) loguser=${arg#*=} ;;
+ --logdep=*) logdep=${arg#*=} ;;
+ --sysconfdir=*) sysconfdir=${arg#*=} ;;
+ --usrconfdir=*) usrconfdir=${arg#*=} ;;
+ --tmpfsdir=*) tmpfsdir=${arg#*=} ;;
+ --sysrundir=*) sysrundir=${arg#*=} ;;
+ --usrrundir=*) usrrundir=${arg#*=} ;;
+ --timeout=*) timeout=${arg#*=} ;;
+ --enable-slashpackage=*) sproot=${arg#*=} ; slashpackage=true ; ;;
+ --enable-slashpackage) sproot= ; slashpackage=true ;;
+ --disable-slashpackage) sproot= ; installtype=fhs ;;
+ --enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;;
+ -* ) echo "$0: unknown option $arg" ;;
+ *=*) eval "${arg%%=*}=\${arg#*=}" ;;
+ *) target=$arg ;;
+ esac
+done
+
+# Expand installation directories
+stripdir prefix
+for i in exec_prefix bindir libdir shebangdir syslogdir usrlogdir sysconfdir usrconfdir tmpfsdir sysrundir usrrundir sproot ; do
+ eval tmp=\${$i}
+ eval $i=$tmp
+ stripdir $i
+done
+
+# Set slashpackage values
+if $slashpackage ; then
+ home=${sproot}/package/${category}/${package}-${version}
+ exthome=${sproot}/package/${category}/${package}
+ extbinprefix=${exthome}/command
+ bindir=${home}/command
+ libdir=${home}
+fi
+
+echo "Creating config.mak..."
+cmdline=$(quote "$0")
+for i ; do cmdline="$cmdline $(quote "$i")" ; done
+exec 3>&1 1>config.mak
+cat << EOF
+# This file was generated by:
+# $cmdline
+# Any changes made here will be lost if configure is re-run.
+
+IT ::= all
+
+package ::= $package
+prefix ::= $prefix
+exec_prefix ::= $exec_prefix
+bindir ::= $bindir
+libdir ::= $libdir
+shebangdir ::= $(escapeslash "$shebangdir")
+syslogdir ::= $(escapeslash "$syslogdir")
+usrlogdir ::= $(escapeslash "$usrlogdir")
+logconfig ::= $(escapeslash "$logconfig")
+loguser ::= $(escapeslash "$loguser")
+logdep ::= $(escapeslash "$logdep")
+sysconfdir ::= $(escapeslash "$sysconfdir")
+usrconfdir ::= $(escapeslash "$usrconfdir")
+tmpfsdir ::= $(escapeslash "$tmpfsdir")
+sysrundir ::= $(escapeslash "$sysrundir")
+usrrundir ::= $(escapeslash "$usrrundir")
+timeout ::= $timeout
+slashpackage ::= $slashpackage
+sproot ::= $sproot
+version ::= $version
+home ::= $home
+exthome ::= $exthome
+EOF
+
+exec 1>&3 3>&-
+echo " ... done."
diff --git a/package/deps.mak b/package/deps.mak
new file mode 100644
index 0000000..4791490
--- /dev/null
+++ b/package/deps.mak
@@ -0,0 +1,10 @@
+#
+# This file has been generated by tools/gen-deps.sh
+#
+
+mddc-add-block-sym: src/bin/mddc-add-block-sym
+$(DESTDIR)$(bindir)/mddc-add-block-sym: mddc-add-block-sym
+mddc-del-block-sym: src/bin/mddc-del-block-sym
+$(DESTDIR)$(bindir)/mddc-del-block-sym: mddc-del-block-sym
+etc/mdev.conf: src/lib/etc/mdev.conf
+$(DESTDIR)$(libdir)/etc/mdev.conf: etc/mdev.conf
diff --git a/package/extras.mak b/package/extras.mak
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/package/extras.mak
@@ -0,0 +1 @@
+
diff --git a/package/info b/package/info
new file mode 100644
index 0000000..5e659fb
--- /dev/null
+++ b/package/info
@@ -0,0 +1,4 @@
+package=mdevd-conf
+version=0.0.0.1
+category=admin
+package_macro_name=MDEVD-CONF
diff --git a/package/modes b/package/modes
new file mode 100644
index 0000000..441fc78
--- /dev/null
+++ b/package/modes
@@ -0,0 +1,2 @@
+mddc-add-block-sym 0755
+mddc-del-block-sym 0755
diff --git a/package/targets.mak b/package/targets.mak
new file mode 100644
index 0000000..ab9faf1
--- /dev/null
+++ b/package/targets.mak
@@ -0,0 +1,22 @@
+#
+# This file has been generated by tools/gen-targets.sh
+#
+
+ALL_BINS ::= \
+ mddc-add-block-sym \
+ mddc-del-block-sym \
+
+INSTALL_BINS ::= \
+ $(DESTDIR)$(bindir)/mddc-add-block-sym \
+ $(DESTDIR)$(bindir)/mddc-del-block-sym \
+
+SLASHCOMMAND_BINS ::= \
+ $(DESTDIR)$(sproot)/command/mddc-add-block-sym \
+ $(DESTDIR)$(sproot)/command/mddc-del-block-sym \
+
+ALL_LIBS ::= \
+ etc/mdev.conf \
+
+INSTALL_LIBS ::= \
+ $(DESTDIR)$(libdir)/etc/mdev.conf \
+
diff --git a/src/bin/mddc-add-block-sym b/src/bin/mddc-add-block-sym
new file mode 100755
index 0000000..7ee1eca
--- /dev/null
+++ b/src/bin/mddc-add-block-sym
@@ -0,0 +1,80 @@
+#!@shebangdir@/execlineb -P
+
+importas -Si MDEV
+
+if -x0 { eltest -d /sys/block/${MDEV} }
+
+#skip cryptsetup nodes
+if -nx0 { eltest ${MDEV} =~ dm-[0-9] }
+
+background { mkdir -p /dev/disk/by-diskseq }
+background { mkdir -p /dev/disk/by-partuuid }
+background { mkdir -p /dev/disk/by-uuid }
+background { mkdir -p /dev/disk/by-id }
+#background { mkdir -p /dev/disk/by-path }
+
+backtick -Ei DISKSEQ { cat /sys/block/${MDEV}/diskseq }
+background { ln -sf ../../${MDEV} /dev/disk/by-diskseq/${DISKSEQ} }
+
+pipeline { if { eltest -e /sys/block/${MDEV}/device/model } cat /sys/block/${MDEV}/device/model }
+pipeline { sed -e s/\ *$// -e s/\ /_/g }
+withstdinas -ED "" MODEL
+pipeline { if { eltest -e /sys/block/${MDEV}/device/serial } cat /sys/block/${MDEV}/device/serial }
+pipeline { sed -e s/\ *$// -e s/\ /_/g -e s/^/_/g }
+withstdinas -ED "" SERIAL
+background { if { eltest "${MODEL}${SERIAL}" }
+ ln -sf ../../${MDEV} /dev/disk/by-id/${MODEL}${SERIAL}
+}
+
+execline-cd /sys/block/${MDEV}
+
+elglob -0d "" PARTS ${MDEV}*
+if { eltest ${PARTS} }
+define -sd "" SPARTS ${PARTS}
+forx -pE PART { ${SPARTS} }
+ # by-partuuid
+ background {
+ pipeline { grep -- ^PARTUUID= ${PART}/uevent }
+ pipeline { sed -e s/PARTUUID=// }
+ withstdinas -E PARTUUID
+ ln -sf ../../${PART} /dev/disk/by-partuuid/${PARTUUID}
+ }
+ # by-diskseq, by-id
+ background {
+ backtick -Ei PARTN { cat ${PART}/partition }
+ background { ln -sf ../../${PART} /dev/disk/by-diskseq/${DISKSEQ}-part${PARTN} }
+ if { eltest "${MODEL}${SERIAL}" }
+ ln -sf ../../${PART} /dev/disk/by-id/${MODEL}${SERIAL}-part${PARTN}
+ }
+ # only if blkid exists
+ if { redirfd -w 1 /dev/null tryexec { blkid } exit 1 }
+ # by-uuid
+ background {
+ if {
+ pipeline { blkid /dev/${PART} }
+ pipeline { grep " UUID" }
+ pipeline {
+ sed
+ -e s/^.*\ UUID=\"//
+ -e s/\".*//
+ }
+ withstdinas -E UUID
+ if { eltest ${UUID} }
+ ln -sf ../../${PART} /dev/disk/by-uuid/${UUID}
+ }
+ }
+ # by-label
+ background {
+ if {
+ pipeline { blkid /dev/${PART} }
+ pipeline { grep " LABEL" }
+ pipeline {
+ sed
+ -e s/^.*\ LABEL=\"//
+ -e s/\".*//
+ }
+ withstdinas -E LABEL
+ if { eltest ${LABEL} }
+ ln -sf ../../${PART} /dev/disk/by-label/${LABEL}
+ }
+ }
diff --git a/src/bin/mddc-del-block-sym b/src/bin/mddc-del-block-sym
new file mode 100755
index 0000000..caa4ce9
--- /dev/null
+++ b/src/bin/mddc-del-block-sym
@@ -0,0 +1,14 @@
+#!@shebangdir@/execlineb -P
+
+importas -Si MDEV
+
+if -x0 { eltest -d /sys/block/${MDEV} }
+if -x0 { eltest -d /dev/disk }
+
+pipeline { ls -1 /dev/disk }
+forstdin -pE TYPE
+ pipeline { ls -1 /dev/disk/${TYPE} }
+ forstdin -pE SYM
+ backtick -E RPATH { realpath /dev/disk/${TYPE}/${SYM} }
+ if { eltest ${RPATH} =~ /dev/${MDEV}.* }
+ rm -f /dev/disk/${TYPE}/${SYM}
diff --git a/src/lib/etc/mdev.conf b/src/lib/etc/mdev.conf
new file mode 100644
index 0000000..cb71b25
--- /dev/null
+++ b/src/lib/etc/mdev.conf
@@ -0,0 +1,32 @@
+# mdevd-conf
+# null, zero may already exist; therefore ownership has to be changed with command
+null root:root 666 +importas -S MDEV chmod 666 $MDEV
+zero root:root 666 +importas -S MDEV chmod 666 $MDEV
+urandom root:root 666
+random root:root 666
+full root:root 666
+fuse root:root 666
+
+# console may already exist; therefore ownership has to be changed with command
+console root:tty 600 +importas -S MDEV chmod 600 $MDEV
+tty root:tty 666
+ttyS.* root:dialout 660
+tty.* root:tty 620
+ptmx root:tty 666
+
+snd/.* root:audio 660
+
+uinput root:input 660
+input/.* root:input 660
+bus/usb/.*/.* root:usb 660
+
+mem root:kmem 640
+kmem root:kmem 640
+port root:kmem 640
+
+dri/card.* root:video 660
+dri/render.* root:render 666
+
+kfd root:render 666
+-SUBSYSTEM=block;.* root:disk 660 +mddc-add-block-sym
+SUBSYSTEM=block;.* root:disk 660 -mddc-del-block-sym
diff --git a/tools/gen-deps.sh b/tools/gen-deps.sh
new file mode 100755
index 0000000..fafb347
--- /dev/null
+++ b/tools/gen-deps.sh
@@ -0,0 +1,35 @@
+#!/bin/sh -e
+
+. package/info
+
+echo '#'
+echo '# This file has been generated by tools/gen-deps.sh'
+echo '#'
+echo
+
+if test -d src/bin
+then
+ cd src/bin
+ for FILE in $(find * -type f 2> /dev/null); do
+ echo "${FILE}: src/bin/${FILE}"
+ echo "\$(DESTDIR)\$(bindir)/${FILE}: ${FILE}"
+ done
+ cd ../..
+fi
+
+if test -d src/lib
+then
+ cd src/lib
+ for FILE in $(find * -type f 2> /dev/null); do
+ echo "${FILE}: src/lib/${FILE}"
+ echo "\$(DESTDIR)\$(libdir)/${FILE}: ${FILE}"
+ done
+ cd ../..
+fi
+
+if test -f package/extras
+then
+ for EXTRA in $(cat package/extras); do
+ echo "\$(DESTDIR)\$(libdir)/${EXTRA}: ${EXTRA}"
+ done
+fi
diff --git a/tools/gen-targets.sh b/tools/gen-targets.sh
new file mode 100755
index 0000000..3280748
--- /dev/null
+++ b/tools/gen-targets.sh
@@ -0,0 +1,56 @@
+#!/bin/sh -e
+
+. package/info
+
+echo '#'
+echo '# This file has been generated by tools/gen-targets.sh'
+echo '#'
+echo
+
+if test -d src/bin
+then
+ cd src/bin
+
+ echo "ALL_BINS ::= \\"
+
+ for FILE in $(find * -type f 2> /dev/null) ; do
+ echo "\t${FILE} \\"
+ done
+
+ echo
+ echo "INSTALL_BINS ::= \\"
+
+ for FILE in $(find * -type f 2> /dev/null) ; do
+ echo "\t\$(DESTDIR)\$(bindir)/${FILE} \\"
+ done
+
+ echo
+ echo "SLASHCOMMAND_BINS ::= \\"
+
+ for FILE in $(find * -type f 2> /dev/null) ; do
+ echo "\t\$(DESTDIR)\$(sproot)/command/${FILE} \\"
+ done
+
+ cd ../..
+ echo
+fi
+
+if test -d src/lib
+then
+ cd src/lib
+
+ echo "ALL_LIBS ::= \\"
+ for FILE in $(find * -type f 2> /dev/null) ; do
+ echo "\t${FILE} \\"
+ done
+
+ echo
+
+ echo "INSTALL_LIBS ::= \\"
+ for FILE in $(find * -type f 2> /dev/null) ; do
+ echo "\t\$(DESTDIR)\$(libdir)/${FILE} \\"
+ done
+
+ cd ../..
+ echo
+fi
diff --git a/tools/install.sh b/tools/install.sh
new file mode 100755
index 0000000..e96dd7b
--- /dev/null
+++ b/tools/install.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+usage() {
+ echo "usage: $0 [ -D ] [ -l ] [ -m mode ] [ -O owner:group ] src dst" 1>&2
+ exit 1
+}
+
+mkdirp=false
+symlink=false
+mode=0755
+og=
+
+while getopts Dlm:O: name ; do
+ case "$name" in
+ D) mkdirp=true ;;
+ l) symlink=true ;;
+ m) mode=$OPTARG ;;
+ O) og=$OPTARG ;;
+ ?) usage ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+test "$#" -eq 2 || usage
+src=$1
+dst=$2
+tmp="$dst.tmp.$$"
+
+case "$dst" in
+ */) echo "$0: $dst ends in /" 1>&2 ; exit 1 ;;
+esac
+
+set -C
+set -e
+
+if $mkdirp ; then
+ umask 022
+ case "$2" in
+ */*) mkdir -p "${dst%/*}" ;;
+ esac
+fi
+
+trap 'rm -f "$tmp"' EXIT INT QUIT TERM HUP
+
+umask 077
+
+if $symlink ; then
+ ln -s "$src" "$tmp"
+else
+ cat < "$1" > "$tmp"
+ if test -n "$og" ; then
+ chown -- "$og" "$tmp"
+ fi
+ chmod -- "$mode" "$tmp"
+fi
+
+mv -f "$tmp" "$dst"
+if test -d "$dst" ; then
+ rm -f "$dst/$(basename $tmp)"
+ if $symlink ; then
+ mkdir "$tmp"
+ ln -s "$src" "$tmp/$(basename $dst)"
+ mv -f "$tmp/$(basename $dst)" "${dst%/*}"
+ rmdir "$tmp"
+ else
+ echo "$0: $dst is a directory" 1>&2
+ exit 1
+ fi
+fi