Initial commit

This commit is contained in:
2026-03-21 12:43:00 -05:00
commit 83bf16823c
438 changed files with 33617 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
[hook]
name = "mkinitramfs-all-kernels"
[when]
phase = "post"
operation = ["install", "update", "remove"]
paths = [
"usr/lib/modules/*",
"lib/modules/*",
"boot/*",
]
[exec]
command = "/usr/share/depot.d/scripts/update-all-initramfs"
needs_paths = false
+40
View File
@@ -0,0 +1,40 @@
[build]
type = "meson"
[alternatives]
provides = [ "initramfs" ]
[build.flags]
build_dir = "build"
post_install = [
'install -Dm755 "$DEPOT_SPECDIR/update-all-initramfs" "$DESTDIR/usr/share/depot.d/scripts/update-all-initramfs"',
'install -Dm644 "$DEPOT_SPECDIR/99-mkinitramfs.toml" "$DESTDIR/usr/share/depot.d/hooks/99-mkinitramfs.toml"',
]
[dependencies]
build = [
"rust",
"meson",
"git"
]
runtime = [
"glibc",
"libunwind",
"kmod"
]
[package]
description = "Simple tool for creating an Initramfs"
homepage = "https://gitlab.com/SFG545/mkinitramfs"
license = "MIT"
name = "mkinitramfs"
version = "0.2.0"
revision = 1
[[source]]
extract_dir = "$name-$version"
url = "https://gitlab.com/SFG545/mkinitramfs.git"
sha256 = "skip"
[[manual_sources]]
files = [ "update-all-initramfs", "99-mkinitramfs.toml" ]
+88
View File
@@ -0,0 +1,88 @@
#!/bin/sh
set -eu
MKINITRAMFS=${MKINITRAMFS:-mkinitramfs}
DEPMOD=${DEPMOD:-depmod}
BOOT_DIR=${BOOT_DIR:-/boot}
if ! command -v "$MKINITRAMFS" >/dev/null 2>&1; then
echo "error: $MKINITRAMFS not found in PATH" >&2
exit 1
fi
if ! command -v "$DEPMOD" >/dev/null 2>&1; then
echo "error: $DEPMOD not found in PATH" >&2
exit 1
fi
if [ ! -d "$BOOT_DIR" ]; then
echo "error: boot directory not found: $BOOT_DIR" >&2
exit 1
fi
versions=""
add_version() {
v=$1
case "
$versions
" in
*"
$v
"*) ;;
*)
if [ -z "$versions" ]; then
versions=$v
else
versions=$versions"
"$v
fi
;;
esac
}
for moddir in /lib/modules/*/; do
[ -d "$moddir" ] || continue
kver=${moddir%/}
kver=${kver##*/}
[ -n "$kver" ] || continue
vmlinuz_link="$moddir/vmlinuz"
[ -e "$vmlinuz_link" ] || continue
kernel_image=$(readlink -f "$vmlinuz_link" 2>/dev/null) || continue
[ -f "$kernel_image" ] || continue
add_version "$kver"
done
if [ -z "$versions" ]; then
echo "no versioned kernels found via /lib/modules/*/vmlinuz" >&2
exit 0
fi
(
cd "$BOOT_DIR" || exit 1
printf '%s\n' "$versions" | while IFS= read -r kver; do
[ -n "$kver" ] || continue
vmlinuz_link="/lib/modules/$kver/vmlinuz"
kernel_image=$(readlink -f "$vmlinuz_link" 2>/dev/null) || {
echo "skipping $kver: cannot resolve /lib/modules/$kver/vmlinuz" >&2
continue
}
[ -f "$kernel_image" ] || {
echo "skipping $kver: kernel image not found at $kernel_image" >&2
continue
}
echo "running depmod for $kver" >&2
"$DEPMOD" -a "$kver" || {
echo "error: depmod failed for $kver, skipping initramfs" >&2
continue
}
echo "updating initramfs for $kver (kernel: $kernel_image)" >&2
"$MKINITRAMFS" "$kver"
done
)