forked from OERV-BSP/image-builder
29 lines
647 B
Bash
29 lines
647 B
Bash
#!/usr/bin/env false
|
|
|
|
filesystem_generate_uuid_ext4() {
|
|
uuidgen
|
|
}
|
|
|
|
filesystem_validate_uuid_ext4() {
|
|
echo "${1}" | sed -n '/^[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{12\}$/!q1'
|
|
}
|
|
|
|
filesystem_set_uuid_ext4() {
|
|
device="${1}"
|
|
uuid="${2}"
|
|
if ! filesystem_validate_uuid_ext4 "${uuid}"; then
|
|
loge "Invalid ext4 serial number: ${uuid}"
|
|
exit 1
|
|
fi
|
|
logcmd tune2fs -U "${uuid}" "${device}"
|
|
}
|
|
|
|
filesystem_make_fs_ext4() {
|
|
logcmd mkfs.ext4 "${1}"
|
|
}
|
|
|
|
filesystem_shrink_ext4() {
|
|
logcmd e2fsck -y -f "${1}"
|
|
for i in $(seq 1 10); do logcmd resize2fs -M "${1}"; done
|
|
}
|