From 51e439c16943149d150e87d7ea75d273327a985e Mon Sep 17 00:00:00 2001 From: Valeria Fadeeva Date: Sat, 4 Nov 2023 16:02:39 +0500 Subject: [PATCH] Update --- .github/FUNDING.yml | 15 +++++++++++++++ push.sh | 3 +++ src/usr/bin/dracut-rebuild | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100755 .github/FUNDING.yml create mode 100755 push.sh create mode 100755 src/usr/bin/dracut-rebuild diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100755 index 0000000..77389e0 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,15 @@ +# These are supported funding model platforms + +#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] + +#patreon: # Replace with a single Patreon username +#open_collective: # Replace with a single Open Collective username +#ko_fi: # Replace with a single Ko-fi username +#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +#liberapay: # Replace with a single Liberapay username +#issuehunt: # Replace with a single IssueHunt username +#otechie: # Replace with a single Otechie username +#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] +#github: [Valeria-Fadeeva] +custom: ["https://www.tinkoff.ru/rm/fadeeva.valeriya96/9bLRi79066", "https://yoomoney.ru/to/4100115921160758", "https://qiwi.com/n/VALERIAFADEEVA", "valeria.fadeeva.me"] diff --git a/push.sh b/push.sh new file mode 100755 index 0000000..a9a24d8 --- /dev/null +++ b/push.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +git add . && git commit -m "Update" && git push diff --git a/src/usr/bin/dracut-rebuild b/src/usr/bin/dracut-rebuild new file mode 100755 index 0000000..e03e2d3 --- /dev/null +++ b/src/usr/bin/dracut-rebuild @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# +# Rebuild all the initrds using dracut + +# This finds the best token for systemd-boot +find_token() { + if [[ -s /etc/kernel/entry-token ]] ; then + cat /etc/kernel/entry-token + elif [[ -s /etc/machine-id ]] ; then + cat /etc/machine-id + elif [[ $(grep "^IMAGE_ID=" /etc/os-release) ]] ; then + grep "^IMAGE_ID=" /etc/os-release | awk -F"=" '{print $2}' + elif [[ $(grep "^ID=" /etc/os-release) ]] ; then + grep "^ID=" /etc/os-release | awk -F"=" '{print $2}' + fi +} + +[[ -f /etc/kernel-install-for-dracut.conf ]] && source /etc/kernel-install-for-dracut.conf +ESP=$(bootctl --print-esp-path) +TOKEN=$(find_token) +while read -r pkgbase; do + kernelversion=$(basename "${pkgbase%/pkgbase}") + kernelname=$(cat "${pkgbase}") + INITRD_PATH="${ESP}/${TOKEN}/${kernelversion}" + if [[ ! -d "$INITRD_PATH" ]] ; then + echo 'Failed to build initrds, use "sudo reinstall-kernels" instead' 1>&2 + exit 1 + fi + echo "Running dracut for ${kernelname}-${kernelversion}" + [[ ${DRACUT_QUIET} == "true" ]] && DRACUT_EXTRA_PARAMS=" --quiet" + dracut --force --hostonly --no-hostonly-cmdline${DRACUT_EXTRA_PARAMS} "${INITRD_PATH}/initrd" "${kernelversion}" + [[ ${NO_DRACUT_FALLBACK} != "true" ]] && dracut --force --no-hostonly${DRACUT_EXTRA_PARAMS} "${INITRD_PATH}/initrd-fallback" "${kernelversion}" +done < <(find /usr/lib/modules -maxdepth 2 -type f -name pkgbase) + +