blob: da43b45208060e333300f3f2b00c7ffd2c4593ec [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001#!/bin/sh
2#
3# @author
4# @brief generate the top index for each module doc
5
6umount #RWPART_MOUNT_DIR#
7
8mount -t ext4 #RWPART_DEVNAME# #RWPART_MOUNT_DIR#
9
10if [ $? -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
23else
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#
29fi