Move common code to build script
This commit is contained in:
parent
e6ccaa329f
commit
cc650d4355
4 changed files with 8 additions and 6 deletions
4
build.sh
4
build.sh
|
@ -17,6 +17,7 @@ export STAGE
|
|||
export STAGE_DIR
|
||||
export STAGE_WORK_DIR
|
||||
export ROOTFS_DIR
|
||||
export BOOTFS_DIR
|
||||
|
||||
export IMG_FILE
|
||||
export ZIP_FILE
|
||||
|
@ -67,6 +68,7 @@ main() {
|
|||
STAGE_DIR="$BASE_DIR/$STAGE"
|
||||
STAGE_WORK_DIR="$WORK_DIR/$STAGE"
|
||||
ROOTFS_DIR="$STAGE_WORK_DIR/rootfs"
|
||||
BOOTFS_DIR="$ROOTFS_DIR/boot"
|
||||
|
||||
IMG_FILE="$STAGE_WORK_DIR/$IMG_DATE-${IMG_NAME}.img"
|
||||
ZIP_FILE="$DEPLOY_DIR/image_$IMG_DATE-${IMG_NAME}.zip"
|
||||
|
@ -74,7 +76,7 @@ main() {
|
|||
mkdir -p "$WORK_DIR"
|
||||
mkdir -p "$DEPLOY_DIR"
|
||||
mkdir -p "$ROOTFS_DIR"
|
||||
mkdir -p "$ROOTFS_DIR/boot"
|
||||
mkdir -p "$BOOTFS_DIR"
|
||||
|
||||
pushd "$STAGE_DIR" > /dev/null
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
install -m 644 files/cmdline.txt ${ROOTFS_DIR}/boot/
|
||||
install -m 644 files/config.txt ${ROOTFS_DIR}/boot/
|
||||
install -m 644 files/cmdline.txt ${BOOTFS_DIR}
|
||||
install -m 644 files/config.txt ${BOOTFS_DIR}
|
||||
|
|
|
@ -4,7 +4,7 @@ unmount_image "$IMG_FILE"
|
|||
|
||||
rm -f "$IMG_FILE"
|
||||
|
||||
BOOT_SIZE=$(du --apparent-size -s "$ROOTFS_DIR/boot" --block-size=1 | cut -f 1)
|
||||
BOOT_SIZE=$(du --apparent-size -s "$BOOTFS_DIR" --block-size=1 | cut -f 1)
|
||||
TOTAL_SIZE=$(du --apparent-size -s "$ROOTFS_DIR" --exclude var/cache/apt/archives --block-size=1 | cut -f 1)
|
||||
|
||||
IMG_SIZE=$((BOOT_SIZE + TOTAL_SIZE + (800 * 1024 * 1024)))
|
||||
|
@ -51,4 +51,4 @@ mkdosfs -n boot -F 32 -v $BOOT_DEV > /dev/null
|
|||
mkfs.ext4 -O ^huge_file $ROOT_DEV > /dev/null
|
||||
|
||||
mount -v $ROOT_DEV "$ROOTFS_DIR" -t ext4
|
||||
mount -v $BOOT_DEV "$ROOTFS_DIR/boot" -t vfat
|
||||
mount -v $BOOT_DEV "$BOOTFS_DIR" -t vfat
|
||||
|
|
|
@ -8,4 +8,4 @@ ROOT_PARTUUID="${IMGID}-02"
|
|||
sed -i "s/BOOTDEV/PARTUUID=${BOOT_PARTUUID}/" ${ROOTFS_DIR}/etc/fstab
|
||||
sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" ${ROOTFS_DIR}/etc/fstab
|
||||
|
||||
sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" ${ROOTFS_DIR}/boot/cmdline.txt
|
||||
sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" ${BOOTFS_DIR}/cmdline.txt
|
||||
|
|
Reference in a new issue