forked from coreos/fedora-coreos-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
overlay.d: abort booting if system has more than 1 'boot' partition
Inspired by: coreos/fedora-coreos-tracker#976 Signed-off-by: Nikita Dubrovskii <[email protected]>
- Loading branch information
1 parent
904141f
commit 1fd59fc
Showing
3 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...lay.d/05core/usr/lib/dracut/modules.d/35coreos-ignition/coreos-ensure-single-partition.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
# checks and aborts the boot if system has several partitions with label specified by $1 | ||
|
||
set -euo pipefail | ||
|
||
PARTITIONS=() | ||
mapfile -t PARTITIONS < <(lsblk -o LABEL,NAME --pairs --paths --noheadings | grep "LABEL=\""$1"\"") | ||
|
||
LENGTH=${#PARTITIONS[@]} | ||
if [[ ${LENGTH} -gt 1 ]]; then | ||
echo "System has "${LENGTH}" partitions with '"$1"' label:" | ||
for PT in "${PARTITIONS[@]}"; do | ||
echo "${PT}" | ||
done | ||
echo "Please 'wipefs' other partitions/disks and reboot. Aborting..." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters