98.20. libstoragemgmt-1.11.0
Storage array and local disk management library, the lsmd plugin daemon and lsmcli
| Version | 1.11.0, release 1 |
| Shelf | disk — Block devices: partitioning, RAID, LVM, block encryption, SMART, NVMe, recovery, image writing and async I/O |
| Phase | 41_system (System), 402 of 1047 in build order |
| Licence | LGPL-2.1-or-later |
| Homepage | https://libstorage.github.io/libstoragemgmt-doc/ |
| Build time | 0.4 SBU |
| Installed size | 4.1 MiB in 389 files |
| Recipe | ports/core/disk/libstoragemgmt/kpkgbuild |
About
libstoragemgmt is a vendor-neutral library for managing storage: RAID controllers, storage arrays and the local disks of the machine, through one API (liblsm), the lsmcli command and plugins for each kind of hardware. The plugins run under lsmd, a daemon that clients reach through sockets in /run/lsm/ipc. In KDOS its consumer is udisks2, built with --enable-lsm, whose LSM module reaches lsmd through those sockets. The port installs the library, lsmcli, lsmd, the plugins, and a service script that starts lsmd at boot.
Sources
libstoragemgmt-1.11.0.tar.gz(1.0 MiB)
sha25607fd9c8e498a052b7ed201c56936120910ec4992fa1f3ade88a0c66e088bdc93
upstream: https://github.com/libstorage/libstoragemgmt/releases/download/1.11.0/libstoragemgmt-1.11.0.tar.gz
archive copy: sources-1/disk--libstoragemgmt-1.11.0.tar.gz
Dependencies
Depends on: glib, sqlite, eudev, python3, libconfig, perl, pkgconf, bash-completion.
Required by (1): udisks2.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install libstoragemgmt'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/disk/libstoragemgmt.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/disk/libstoragemgmt
echo '07fd9c8e498a052b7ed201c56936120910ec4992fa1f3ade88a0c66e088bdc93 libstoragemgmt-1.11.0.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/libstoragemgmt
SRC=$SRC_ROOT/libstoragemgmt-1.11.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libstoragemgmt-1.11.0.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
export CFLAGS="$CFLAGS -Wno-error"
export CXXFLAGS="$CXXFLAGS -Wno-error"
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--libdir=/usr/lib \
--localstatedir=/var \
--disable-static \
--without-test \
--without-smispy \
--without-ledmon \
--with-bash-completion-dir=/usr/share/bash-completion/completions \
--with-systemdsystemunitdir=no \
--with-systemd-sysusersdir=no \
--with-systemd-tmpfilesdir=no \
PYTHON=python3
make
make DESTDIR=$PKG install
install -d "$PKG/etc/init.d"
cat > "$PKG/etc/init.d/51_lsmd.sh" <<'KDOS_SH'
#!/bin/bash
. /etc/init.d/service_helper
NAME="lsmd"
DAEMON="/usr/bin/lsmd"
case "$1" in
start)
[ ! -x "$DAEMON" ] && { echo "[SKIP] $NAME: $DAEMON not found"; exit 0; }
echo "[KDOS] Starting $NAME..."
install -d -m 775 -g libstoragemgmt /run/lsm /run/lsm/ipc
# -d: stay in the foreground, so ksvc watches the daemon itself.
supervise "$NAME" "$DAEMON" -d
;;
stop) stop_service "$NAME" ;;
status) check_status "$NAME" ;;
*) echo "Usage: $0 {start|stop|status}"; exit 1 ;;
esac
KDOS_SH
chmod 755 "$PKG/etc/init.d/51_lsmd.sh"
The switches, and why each is set:
CFLAGS,CXXFLAGS— The tree’s flags with-Wno-erroradded.configure.acadds-WerrortoCPPFLAGS, which come beforeCFLAGSandCXXFLAGSon every compile line, so the later-Wno-errorwins and a warning a newer compiler adds does not stop the build.--without-test— Leaves out the test suite. Its configure checks need thechecklibrary andchrpath, which the tree does not carry, andvalgrindfor the memory-leak tests.--without-smispy— Leaves out the SMI-S plugin for storage arrays, which is Python and needspywbem. The tree has no pywbem port.--without-ledmon— Leaves out LED slot management, which needs the ledmon library. The tree has no ledmon port; with the defaultyes, configure stops when it does not find one.--with-bash-completion-dir=/usr/share/bash-completion/completions— Wherelsmcli’s completion goes. Without it configure asks pkg-config, and falls back to/etc/bash_completion.dwhen that fails.--with-systemdsystemunitdir=no,--with-systemd-sysusersdir=no,--with-systemd-tmpfilesdir=no— Each defaults to the directory pkg-config reports for systemd;noinstalls no unit, sysusers or tmpfiles file. KDOS has no systemd (see No systemd); the service script andpostinstall.shdo the work of the three files.PYTHON=python3— The interpreterAM_PATH_PYTHONchecks and records; it decides where the Python binding and the Python plugins are installed.
The common switches of each build system are explained in the Flag glossary.
postinstall.sh runs on the installed system after the package is adopted:
root="${PKG_ROOT:-/}"
grep -q '^libstoragemgmt:' "$root/etc/group" 2>/dev/null || groupadd -R "$root" -r libstoragemgmt
grep -q '^libstoragemgmt:' "$root/etc/passwd" 2>/dev/null || \
useradd -R "$root" -r -g libstoragemgmt -d /run/lsm -s /sbin/nologin libstoragemgmt
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/libstoragemgmt, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf libstoragemgmt-1.11.0-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/libstoragemgmt, and runs the triggers its paths call for.
Contents
Installed programs: arcconf_lsmplugin, hpsa_lsmplugin, local_lsmplugin, lsmcli, lsmd, megaraid_lsmplugin, nfs_lsmplugin, sim_lsmplugin, simc_lsmplugin, targetd_lsmplugin.
Installed libraries: libstoragemgmt.so.
Installed directories: /etc/lsm, /usr/include/libstoragemgmt, /usr/lib/python3.14/site-packages/arcconf_plugin, /usr/lib/python3.14/site-packages/hpsa_plugin, /usr/lib/python3.14/site-packages/local_plugin, /usr/lib/python3.14/site-packages/lsm, /usr/lib/python3.14/site-packages/megaraid_plugin, /usr/lib/python3.14/site-packages/nfs_plugin, /usr/lib/python3.14/site-packages/sim_plugin, /usr/lib/python3.14/site-packages/targetd_plugin, /usr/libexec/lsm.d, /usr/share/licenses/libstoragemgmt.
Short descriptions
arcconf_lsmplugin |
LibstorageMgmt Arcconf plugin |
hpsa_lsmplugin |
LibstorageMgmt HP SmartArray plugin |
local_lsmplugin |
LibstorageMgmt Local Pseudo plugin |
lsmcli |
libStorageMgmt command line interface |
lsmd |
lsmd |
megaraid_lsmplugin |
LibstorageMgmt MegaRAID plugin |
nfs_lsmplugin |
LibstorageMgmt local network file system plugin |
sim_lsmplugin |
LibStorageMgmt simulator python plugin |
simc_lsmplugin |
LibstorageMgmt Simulator C Plugin |
targetd_lsmplugin |
libStorageMgmt targetd plugin |
libstoragemgmt.pc |
Storage array management library |
Notes
- The service script is written by
build.sh./etc/init.d/51_lsmd.shcreates/run/lsmand/run/lsm/ipcwith mode 775 and the grouplibstoragemgmt, the modes and group of upstream’s tmpfiles entry, then startslsmd -dundersupervise.lsmdexits at start when it cannot read and write the socket directory, and-dkeeps it in the foreground instead of forking away from the supervisor. How the service scripts run is in rcS and the service scripts. It runs after01_udev.sh, whose device database the local-disk plugin reads. postinstall.shcreates thelibstoragemgmtaccount.lsmd, started as root, drops to it for every plugin that does not need root; without the account the plugins keep root. The script works onPKG_ROOT, the rootkpkgaddis installing into, and creates the group and the user only when/etc/groupand/etc/passwdthere do not already name them.