adjust first_boot script to GPT partition layout
Signed-off-by: Michel Stempin <michel.stempin@wanadoo.fr>
This commit is contained in:
parent
fb4a95f171
commit
a452990d84
|
@ -3,10 +3,15 @@
|
||||||
# Uncomment the following line to get debug info
|
# Uncomment the following line to get debug info
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
SELF=$(basename $0)
|
|
||||||
|
|
||||||
source /usr/local/lib/utils
|
source /usr/local/lib/utils
|
||||||
|
|
||||||
|
SELF=$(basename $0)
|
||||||
|
root_part=$(cat /proc/cmdline | sed -n 's|^.*root=/dev/\([^ ]*\).*|\1|p')
|
||||||
|
part_num=${root_part#mmcblk0p}
|
||||||
|
if [ "${part_num}" -eq 1 ]; then
|
||||||
|
die 0 "recovery mode"
|
||||||
|
fi
|
||||||
|
|
||||||
notif () {
|
notif () {
|
||||||
info "$@"
|
info "$@"
|
||||||
printf "$@" > /sys/class/graphics/fb0/notification
|
printf "$@" > /sys/class/graphics/fb0/notification
|
||||||
|
@ -27,8 +32,6 @@ check_root_id () {
|
||||||
}
|
}
|
||||||
|
|
||||||
resize_rootfs_partition () {
|
resize_rootfs_partition () {
|
||||||
local root_part=$(cat /proc/cmdline | sed -n 's|^.*root=/dev/\([^ ]*\).*|\1|p')
|
|
||||||
local part_num=${root_part#mmcblk0p}
|
|
||||||
if [ "${part_num}" = "{$root_part}" ]; then
|
if [ "${part_num}" = "{$root_part}" ]; then
|
||||||
die 2 "${root_part} is not an SD card. Don't know how to expand it, aborting"
|
die 2 "${root_part} is not an SD card. Don't know how to expand it, aborting"
|
||||||
fi
|
fi
|
||||||
|
@ -50,7 +53,6 @@ resize_rootfs_partition () {
|
||||||
d
|
d
|
||||||
${part_num}
|
${part_num}
|
||||||
n
|
n
|
||||||
p
|
|
||||||
${part_num}
|
${part_num}
|
||||||
${part_start}
|
${part_start}
|
||||||
+1G
|
+1G
|
||||||
|
@ -69,7 +71,6 @@ reload_partition_table () {
|
||||||
}
|
}
|
||||||
|
|
||||||
resize_rootfs_filesystem () {
|
resize_rootfs_filesystem () {
|
||||||
local root_part=$(cat /proc/cmdline | sed -n 's|^.*root=/dev/\([^ ]*\).*|\1|p')
|
|
||||||
resize2fs /dev/${root_part} >/dev/null 2>&1 || die 7 "cannot resize the root filesystem, aborting"
|
resize2fs /dev/${root_part} >/dev/null 2>&1 || die 7 "cannot resize the root filesystem, aborting"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -106,8 +107,6 @@ create_backing_store_partition () {
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|
||||||
# Find out the root partition number from kernel command line
|
# Find out the root partition number from kernel command line
|
||||||
local root_part=$(cat /proc/cmdline | sed -n 's|^.*root=/dev/\([^ ]*\).*|\1|p')
|
|
||||||
local part_num=${root_part#mmcblk0p}
|
|
||||||
if [ "$part_num" = "$root_part" ]; then
|
if [ "$part_num" = "$root_part" ]; then
|
||||||
die 5 "$root_part is not an SD card. Don't know how to create the backing store partition"
|
die 5 "$root_part is not an SD card. Don't know how to create the backing store partition"
|
||||||
fi
|
fi
|
||||||
|
@ -130,13 +129,12 @@ create_backing_store_partition () {
|
||||||
# Create a third FAT32 partition that filsl the disk
|
# Create a third FAT32 partition that filsl the disk
|
||||||
fdisk /dev/mmcblk0 >/dev/null 2>&1 <<EOF
|
fdisk /dev/mmcblk0 >/dev/null 2>&1 <<EOF
|
||||||
n
|
n
|
||||||
p
|
|
||||||
3
|
3
|
||||||
|
|
||||||
|
|
||||||
t
|
t
|
||||||
3
|
3
|
||||||
c
|
11
|
||||||
w
|
w
|
||||||
EOF
|
EOF
|
||||||
sync
|
sync
|
||||||
|
|
Loading…
Reference in New Issue