b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | # |
| 2 | # Copyright (C) 2010-2013 OpenWrt.org |
| 3 | # |
| 4 | |
| 5 | rootpartuuid() { |
| 6 | local cmdline=$(cat /proc/cmdline) |
| 7 | local bootpart=${cmdline##*root=} |
| 8 | bootpart=${bootpart%% *} |
| 9 | local uuid=${bootpart#PARTUUID=} |
| 10 | echo ${uuid%-02} |
| 11 | } |
| 12 | |
| 13 | bootdev_from_uuid() { |
| 14 | blkid | grep "PTUUID=\"$(rootpartuuid)\"" | cut -d : -f1 |
| 15 | } |
| 16 | |
| 17 | bootpart_from_uuid() { |
| 18 | blkid | grep $(rootpartuuid)-01 | cut -d : -f1 |
| 19 | } |
| 20 | |
| 21 | rootpart_from_uuid() { |
| 22 | blkid | grep $(rootpartuuid)-02 | cut -d : -f1 |
| 23 | } |
| 24 | |
| 25 | apalis_mount_boot() { |
| 26 | mkdir -p /boot |
| 27 | [ -f /boot/uImage ] || { |
| 28 | mount -o rw,noatime $(bootpart_from_uuid) /boot > /dev/null |
| 29 | } |
| 30 | } |