rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # @author |
| 4 | # @brief generate the top index for each module doc |
| 5 | |
| 6 | umount #RWPART_MOUNT_DIR# |
| 7 | |
| 8 | mount -t ext4 #RWPART_DEVNAME# #RWPART_MOUNT_DIR# |
| 9 | |
| 10 | if [ $? -eq 0 ]; then |
| 11 | umount #RWPART_MOUNT_DIR# |
| 12 | resize2fs -M #RWPART_DEVNAME# |
| 13 | dmsetup create $(basename #RWPART_DEVNAME#)_dmcd --table "0 $(blockdev --getsz #RWPART_DEVNAME#) crypt aes-cbc-plain #RWPART_KEYSTR# 0 #RWPART_DEVNAME# 0" |
| 14 | if [ $? -eq 0 ]; then |
| 15 | dd if=#RWPART_DEVNAME# of=/dev/mapper/$(basename #RWPART_DEVNAME#)_dmcd bs=1M count=#RWPART_FILESYSTEM_SIZE# |
| 16 | resize2fs /dev/mapper/$(basename #RWPART_DEVNAME#)_dmcd |
| 17 | mount -t ext4 /dev/mapper/$(basename #RWPART_DEVNAME#)_dmcd #RWPART_MOUNT_DIR# |
| 18 | else |
| 19 | resize2fs #RWPART_DEVNAME# |
| 20 | mount -t ext4 #RWPART_DEVNAME# #RWPART_MOUNT_DIR# |
| 21 | exit 0 |
| 22 | fi |
| 23 | else |
| 24 | dmsetup create $(basename #RWPART_DEVNAME#)_dmcd --table "0 $(blockdev --getsz #RWPART_DEVNAME#) crypt aes-cbc-plain #RWPART_KEYSTR# 0 #RWPART_DEVNAME# 0" |
| 25 | if [ $? -ne 0 ]; then |
| 26 | exit 0 |
| 27 | fi |
| 28 | mount -t ext4 /dev/mapper/$(basename #RWPART_DEVNAME#)_dmcd #RWPART_MOUNT_DIR# |
| 29 | fi |