| #!/bin/sh |
| # |
| # @author |
| # @brief generate the top index for each module doc |
| |
| umount #RWPART_MOUNT_DIR# |
| |
| mount -t ext4 #RWPART_DEVNAME# #RWPART_MOUNT_DIR# |
| |
| if [ $? -eq 0 ]; then |
| umount #RWPART_MOUNT_DIR# |
| resize2fs -M #RWPART_DEVNAME# |
| dmsetup create $(basename #RWPART_DEVNAME#)_dmcd --table "0 $(blockdev --getsz #RWPART_DEVNAME#) crypt aes-cbc-plain #RWPART_KEYSTR# 0 #RWPART_DEVNAME# 0" |
| if [ $? -eq 0 ]; then |
| dd if=#RWPART_DEVNAME# of=/dev/mapper/$(basename #RWPART_DEVNAME#)_dmcd bs=1M count=#RWPART_FILESYSTEM_SIZE# |
| resize2fs /dev/mapper/$(basename #RWPART_DEVNAME#)_dmcd |
| mount -t ext4 /dev/mapper/$(basename #RWPART_DEVNAME#)_dmcd #RWPART_MOUNT_DIR# |
| else |
| resize2fs #RWPART_DEVNAME# |
| mount -t ext4 #RWPART_DEVNAME# #RWPART_MOUNT_DIR# |
| exit 0 |
| fi |
| else |
| dmsetup create $(basename #RWPART_DEVNAME#)_dmcd --table "0 $(blockdev --getsz #RWPART_DEVNAME#) crypt aes-cbc-plain #RWPART_KEYSTR# 0 #RWPART_DEVNAME# 0" |
| if [ $? -ne 0 ]; then |
| exit 0 |
| fi |
| mount -t ext4 /dev/mapper/$(basename #RWPART_DEVNAME#)_dmcd #RWPART_MOUNT_DIR# |
| fi |