install.sh bug fixes, autostart cgroup detachment, vault key security #20

Merged
obel1x merged 9 commits from unbrot/fedora-OEMDRV:main into main 2026-05-01 17:59:24 +02:00
2 changed files with 15 additions and 11 deletions
Showing only changes of commit 92b5e9c4a6 - Show all commits
+2 -2
View File
@@ -1,4 +1,4 @@
# OEMDRV Bootstrap — install.sh + install_from_repo.sh # OEMDRV Bootstrap — install.sh
the script `./system_setup/install.sh` prepares a target machine for automated Fedora deployment. It shrinks an existing partition to carve out a dedicated **OEMDRV** partition, which Anaconda/Kickstart will detect automatically during installation. the script `./system_setup/install.sh` prepares a target machine for automated Fedora deployment. It shrinks an existing partition to carve out a dedicated **OEMDRV** partition, which Anaconda/Kickstart will detect automatically during installation.
@@ -37,7 +37,7 @@ curl -fsSL ${REPO_URL%.git}/raw/branch/${REPO_BRANCH:-main}/system_setup/install
sudo -E bash /tmp/install.sh sudo -E bash /tmp/install.sh
``` ```
That way, install.sh should know what to pull. Both are optional. That way, install.sh should know what to pull.
## After the script completes ## After the script completes
+13 -9
View File
@@ -196,9 +196,12 @@ collect_free_space() {
$1+0 > 0 { $1+0 > 0 {
for (i = 1; i <= NF; i++) { for (i = 1; i <= NF; i++) {
if ($i == "free") { if ($i == "free") {
start=$2; end=$3; size=$4; gsub(/MiB/,"",$2); gsub(/MiB/,"",$3);
gsub(/MiB/,"",start); gsub(/MiB/,"",end); gsub(/MiB/,"",size); e=int($3+0);
s=int(start+0); e=int(end+0); sz=int(size+0); raw_s=$2+0;
s=int(raw_s)+(raw_s>int(raw_s)?1:0);
if (s < 1) s = 1;
sz=e-s;
if (sz >= min) print s " " e " " sz; if (sz >= min) print s " " e " " sz;
break break
} }
@@ -332,12 +335,12 @@ SEL=-1
while true; do while true; do
echo echo
if [[ $FS_IDX -gt 0 && $shrink_count -gt 0 ]]; then if [[ $FS_IDX -gt 0 && $shrink_count -gt 0 ]]; then
read -r -p "Enter f<n> to use free space, s<n> to shrink a partition, or q to quit: " INPUT read -r -p "Enter f<n> to use free space, s<n> to shrink a partition, or q to quit: " INPUT || { echo; echo "Aborted."; exit 0; }
elif [[ $FS_IDX -gt 0 ]]; then elif [[ $FS_IDX -gt 0 ]]; then
read -r -p "Enter number of free space region to use, or q to quit: " INPUT read -r -p "Enter number of free space region to use, or q to quit: " INPUT || { echo; echo "Aborted."; exit 0; }
[[ "$INPUT" =~ ^[0-9]+$ ]] && INPUT="f${INPUT}" [[ "$INPUT" =~ ^[0-9]+$ ]] && INPUT="f${INPUT}"
else else
read -r -p "Enter number of partition to shrink, or q to quit: " INPUT read -r -p "Enter number of partition to shrink, or q to quit: " INPUT || { echo; echo "Aborted."; exit 0; }
[[ "$INPUT" =~ ^[0-9]+$ ]] && INPUT="s${INPUT}" [[ "$INPUT" =~ ^[0-9]+$ ]] && INPUT="s${INPUT}"
fi fi
@@ -458,15 +461,16 @@ fi
# ── Create OEMDRV partition ─────────────────────────────────────────────────── # ── Create OEMDRV partition ───────────────────────────────────────────────────
info "Creating new OEMDRV partition (${OEMDRV_START}${OEMDRV_END} MiB) on $WORK_DISK..." info "Creating new OEMDRV partition (${OEMDRV_START}${OEMDRV_END} MiB) on $WORK_DISK..."
printf 'Yes\n' | parted "$WORK_DISK" mkpart anacondainstall btrfs "${OEMDRV_START}MiB" "${OEMDRV_END}MiB" \ parted -s "$WORK_DISK" mkpart anacondainstall btrfs "${OEMDRV_START}MiB" "${OEMDRV_END}MiB" \
|| die "parted mkpart failed. Check that the target area is free space on $WORK_DISK." || die "parted mkpart failed. Check that the target area is free space on $WORK_DISK."
partprobe "$WORK_DISK" partprobe "$WORK_DISK"
sleep 1 sleep 1
# Determine new partition number (highest on the disk after partprobe) # Find the partition whose start matches OEMDRV_START (±1 MiB for alignment)
NEW_PNUM=$(parted -s "$WORK_DISK" -m unit MiB print 2>/dev/null \ NEW_PNUM=$(parted -s "$WORK_DISK" -m unit MiB print 2>/dev/null \
| awk -F: '/^[0-9]/{n=$1} END{print n}') | awk -F: -v s="$OEMDRV_START" '
/^[0-9]/ { gsub(/MiB/,"",$2); if (int($2+0) >= s-1 && int($2+0) <= s+1) { print $1; exit } }')
[[ -n "$NEW_PNUM" ]] || die "Could not determine new partition number on $WORK_DISK." [[ -n "$NEW_PNUM" ]] || die "Could not determine new partition number on $WORK_DISK."
OEMDRV_DEV=$(new_part_device "$WORK_DISK" "$NEW_PNUM") OEMDRV_DEV=$(new_part_device "$WORK_DISK" "$NEW_PNUM")