Auto-detect root partition
This commit is contained in:
parent
2bb360c490
commit
c3e8255546
@ -5,12 +5,26 @@ if [[ $EUID -ne 0 ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Find root device
|
||||||
|
for cmd in $(cat /proc/cmdline); do
|
||||||
|
[[ $(cut -d'=' -f1 <<< $cmd) == "root" ]] && \
|
||||||
|
root_device=$(cut -d'=' -f2 <<< $cmd) && \
|
||||||
|
boot_device="${root_device%?}1" && break
|
||||||
|
done
|
||||||
|
[[ -z $boot_device ]] && echo "Unknown boot device. Exiting..." >&2 && exit 1
|
||||||
|
|
||||||
|
# Make sure correct boot partition is mounted
|
||||||
|
df | grep -q $boot_device && umount /boot
|
||||||
|
mount $boot_device /boot
|
||||||
|
|
||||||
choices=$(dialog \
|
choices=$(dialog \
|
||||||
--title "Configure display output" \
|
--title "Configure display output" \
|
||||||
--menu "\nChoose an option: \n" 10 60 7 \
|
--menu "\nChoose an option: \n" 10 60 7 \
|
||||||
1 "Enable HDMI display output" \
|
1 "Enable HDMI display output" \
|
||||||
2 "Enable LCD display output" 2>&1 >/dev/tty)
|
2 "Enable LCD display output" \
|
||||||
|
2>&1 >/dev/tty)
|
||||||
|
|
||||||
|
[[ -z $choices ]] && exit 0
|
||||||
for choice in $choices
|
for choice in $choices
|
||||||
do
|
do
|
||||||
case $choice in
|
case $choice in
|
||||||
@ -28,8 +42,6 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Display reboot confirmation
|
# Display reboot confirmation
|
||||||
dialog \
|
dialog \
|
||||||
--title "Almost done" \
|
--title "Almost done" \
|
||||||
|
Loading…
Reference in New Issue
Block a user