first commit
This commit is contained in:
9
external/packages/raspi/export-image/00-allow-rerun/00-run.sh
vendored
Executable file
9
external/packages/raspi/export-image/00-allow-rerun/00-run.sh
vendored
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if [ ! -x "${ROOTFS_DIR}/usr/bin/qemu-arm-static" ]; then
|
||||
cp /usr/bin/qemu-arm-static "${ROOTFS_DIR}/usr/bin/"
|
||||
fi
|
||||
|
||||
if [ -e "${ROOTFS_DIR}/etc/ld.so.preload" ]; then
|
||||
mv "${ROOTFS_DIR}/etc/ld.so.preload" "${ROOTFS_DIR}/etc/ld.so.preload.disabled"
|
||||
fi
|
||||
1
external/packages/raspi/export-image/01-user-rename/00-packages
vendored
Normal file
1
external/packages/raspi/export-image/01-user-rename/00-packages
vendored
Normal file
@@ -0,0 +1 @@
|
||||
userconf-pi
|
||||
9
external/packages/raspi/export-image/01-user-rename/01-run.sh
vendored
Executable file
9
external/packages/raspi/export-image/01-user-rename/01-run.sh
vendored
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if [[ "${DISABLE_FIRST_BOOT_USER_RENAME}" == "0" ]]; then
|
||||
on_chroot <<- EOF
|
||||
SUDO_USER="${FIRST_USER_NAME}" rename-user -f -s
|
||||
EOF
|
||||
else
|
||||
rm -f "${ROOTFS_DIR}/etc/xdg/autostart/piwiz.desktop"
|
||||
fi
|
||||
9
external/packages/raspi/export-image/02-set-sources/01-run.sh
vendored
Executable file
9
external/packages/raspi/export-image/02-set-sources/01-run.sh
vendored
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache"
|
||||
find "${ROOTFS_DIR}/var/lib/apt/lists/" -type f -delete
|
||||
on_chroot << EOF
|
||||
apt-get update
|
||||
apt-get -y dist-upgrade
|
||||
apt-get clean
|
||||
EOF
|
||||
3
external/packages/raspi/export-image/03-network/01-run.sh
vendored
Executable file
3
external/packages/raspi/export-image/03-network/01-run.sh
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
install -m 644 files/resolv.conf "${ROOTFS_DIR}/etc/"
|
||||
1
external/packages/raspi/export-image/03-network/files/resolv.conf
vendored
Normal file
1
external/packages/raspi/export-image/03-network/files/resolv.conf
vendored
Normal file
@@ -0,0 +1 @@
|
||||
nameserver 8.8.8.8
|
||||
17
external/packages/raspi/export-image/04-set-partuuid/00-run.sh
vendored
Executable file
17
external/packages/raspi/export-image/04-set-partuuid/00-run.sh
vendored
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
#if [ "${NO_PRERUN_QCOW2}" = "0" ]; then
|
||||
#
|
||||
# IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
|
||||
#
|
||||
# IMGID="$(dd if="${IMG_FILE}" skip=440 bs=1 count=4 2>/dev/null | xxd -e | cut -f 2 -d' ')"
|
||||
#
|
||||
# BOOT_PARTUUID="${IMGID}-01"
|
||||
# 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"
|
||||
#
|
||||
#fi
|
||||
116
external/packages/raspi/export-image/05-finalise/01-run.sh
vendored
Executable file
116
external/packages/raspi/export-image/05-finalise/01-run.sh
vendored
Executable file
@@ -0,0 +1,116 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
#IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
|
||||
#INFO_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.info"
|
||||
|
||||
on_chroot << EOF
|
||||
if [ -x /etc/init.d/fake-hwclock ]; then
|
||||
/etc/init.d/fake-hwclock stop
|
||||
fi
|
||||
if hash hardlink 2>/dev/null; then
|
||||
hardlink -t /usr/share/doc
|
||||
fi
|
||||
EOF
|
||||
|
||||
if [ -d "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config" ]; then
|
||||
chmod 700 "${ROOTFS_DIR}/home/${FIRST_USER_NAME}/.config"
|
||||
fi
|
||||
|
||||
rm -f "${ROOTFS_DIR}/usr/bin/qemu-arm-static"
|
||||
|
||||
if [ "${USE_QEMU}" != "1" ]; then
|
||||
if [ -e "${ROOTFS_DIR}/etc/ld.so.preload.disabled" ]; then
|
||||
mv "${ROOTFS_DIR}/etc/ld.so.preload.disabled" "${ROOTFS_DIR}/etc/ld.so.preload"
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -f "${ROOTFS_DIR}/etc/network/interfaces.dpkg-old"
|
||||
|
||||
rm -f "${ROOTFS_DIR}/etc/apt/sources.list~"
|
||||
rm -f "${ROOTFS_DIR}/etc/apt/trusted.gpg~"
|
||||
|
||||
rm -f "${ROOTFS_DIR}/etc/passwd-"
|
||||
rm -f "${ROOTFS_DIR}/etc/group-"
|
||||
rm -f "${ROOTFS_DIR}/etc/shadow-"
|
||||
rm -f "${ROOTFS_DIR}/etc/gshadow-"
|
||||
rm -f "${ROOTFS_DIR}/etc/subuid-"
|
||||
rm -f "${ROOTFS_DIR}/etc/subgid-"
|
||||
|
||||
rm -f "${ROOTFS_DIR}"/var/cache/debconf/*-old
|
||||
rm -f "${ROOTFS_DIR}"/var/lib/dpkg/*-old
|
||||
|
||||
rm -f "${ROOTFS_DIR}"/usr/share/icons/*/icon-theme.cache
|
||||
|
||||
rm -f "${ROOTFS_DIR}/var/lib/dbus/machine-id"
|
||||
|
||||
true > "${ROOTFS_DIR}/etc/machine-id"
|
||||
|
||||
ln -nsf /proc/mounts "${ROOTFS_DIR}/etc/mtab"
|
||||
|
||||
find "${ROOTFS_DIR}/var/log/" -type f -exec cp /dev/null {} \;
|
||||
|
||||
rm -f "${ROOTFS_DIR}/root/.vnc/private.key"
|
||||
rm -f "${ROOTFS_DIR}/etc/vnc/updateid"
|
||||
|
||||
#update_issue "$(basename "${EXPORT_DIR}")"
|
||||
#install -m 644 "${ROOTFS_DIR}/etc/rpi-issue" "${ROOTFS_DIR}/boot/issue.txt"
|
||||
#
|
||||
#cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE"
|
||||
|
||||
|
||||
#{
|
||||
# if [ -f "$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" ]; then
|
||||
# firmware=$(zgrep "firmware as of" \
|
||||
# "$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" | \
|
||||
# head -n1 | sed -n 's|.* \([^ ]*\)$|\1|p')
|
||||
# printf "\nFirmware: https://github.com/raspberrypi/firmware/tree/%s\n" "$firmware"
|
||||
#
|
||||
# kernel="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/git_hash")"
|
||||
# printf "Kernel: https://github.com/raspberrypi/linux/tree/%s\n" "$kernel"
|
||||
#
|
||||
# uname="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/uname_string7")"
|
||||
# printf "Uname string: %s\n" "$uname"
|
||||
# fi
|
||||
#
|
||||
# printf "\nPackages:\n"
|
||||
# dpkg -l --root "$ROOTFS_DIR"
|
||||
#} >> "$INFO_FILE"
|
||||
|
||||
#mkdir -p "${DEPLOY_DIR}"
|
||||
#
|
||||
#rm -f "${DEPLOY_DIR}/${ARCHIVE_FILENAME}${IMG_SUFFIX}.*"
|
||||
#rm -f "${DEPLOY_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
|
||||
#
|
||||
#mv "$INFO_FILE" "$DEPLOY_DIR/"
|
||||
#
|
||||
#if [ "${USE_QCOW2}" = "0" ] && [ "${NO_PRERUN_QCOW2}" = "0" ]; then
|
||||
# ROOT_DEV="$(mount | grep "${ROOTFS_DIR} " | cut -f1 -d' ')"
|
||||
#
|
||||
# unmount "${ROOTFS_DIR}"
|
||||
# zerofree "${ROOT_DEV}"
|
||||
#
|
||||
# unmount_image "${IMG_FILE}"
|
||||
#else
|
||||
# unload_qimage
|
||||
# make_bootable_image "${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.qcow2" "$IMG_FILE"
|
||||
#fi
|
||||
#
|
||||
#case "${DEPLOY_COMPRESSION}" in
|
||||
#zip)
|
||||
# pushd "${STAGE_WORK_DIR}" > /dev/null
|
||||
# zip -"${COMPRESSION_LEVEL}" \
|
||||
# "${DEPLOY_DIR}/${ARCHIVE_FILENAME}${IMG_SUFFIX}.zip" "$(basename "${IMG_FILE}")"
|
||||
# popd > /dev/null
|
||||
# ;;
|
||||
#gz)
|
||||
# pigz --force -"${COMPRESSION_LEVEL}" "$IMG_FILE" --stdout > \
|
||||
# "${DEPLOY_DIR}/${ARCHIVE_FILENAME}${IMG_SUFFIX}.img.gz"
|
||||
# ;;
|
||||
#xz)
|
||||
# xz --compress --force --threads 0 --memlimit-compress=50% -"${COMPRESSION_LEVEL}" \
|
||||
# --stdout "$IMG_FILE" > "${DEPLOY_DIR}/${ARCHIVE_FILENAME}${IMG_SUFFIX}.img.xz"
|
||||
# ;;
|
||||
#none | *)
|
||||
# cp "$IMG_FILE" "$DEPLOY_DIR/"
|
||||
#;;
|
||||
#esac
|
||||
67
external/packages/raspi/export-image/prerun.sh
vendored
Executable file
67
external/packages/raspi/export-image/prerun.sh
vendored
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
#if [ "${NO_PRERUN_QCOW2}" = "0" ]; then
|
||||
# IMG_FILE="${STAGE_WORK_DIR}/${IMG_FILENAME}${IMG_SUFFIX}.img"
|
||||
#
|
||||
# unmount_image "${IMG_FILE}"
|
||||
#
|
||||
# rm -f "${IMG_FILE}"
|
||||
#
|
||||
# rm -rf "${ROOTFS_DIR}"
|
||||
# mkdir -p "${ROOTFS_DIR}"
|
||||
#
|
||||
# BOOT_SIZE="$((256 * 1024 * 1024))"
|
||||
# ROOT_SIZE=$(du --apparent-size -s "${EXPORT_ROOTFS_DIR}" --exclude var/cache/apt/archives --exclude boot --block-size=1 | cut -f 1)
|
||||
#
|
||||
# # All partition sizes and starts will be aligned to this size
|
||||
# ALIGN="$((4 * 1024 * 1024))"
|
||||
# # Add this much space to the calculated file size. This allows for
|
||||
# # some overhead (since actual space usage is usually rounded up to the
|
||||
# # filesystem block size) and gives some free space on the resulting
|
||||
# # image.
|
||||
# ROOT_MARGIN="$(echo "($ROOT_SIZE * 0.2 + 200 * 1024 * 1024) / 1" | bc)"
|
||||
#
|
||||
# BOOT_PART_START=$((ALIGN))
|
||||
# BOOT_PART_SIZE=$(((BOOT_SIZE + ALIGN - 1) / ALIGN * ALIGN))
|
||||
# ROOT_PART_START=$((BOOT_PART_START + BOOT_PART_SIZE))
|
||||
# ROOT_PART_SIZE=$(((ROOT_SIZE + ROOT_MARGIN + ALIGN - 1) / ALIGN * ALIGN))
|
||||
# IMG_SIZE=$((BOOT_PART_START + BOOT_PART_SIZE + ROOT_PART_SIZE))
|
||||
#
|
||||
# truncate -s "${IMG_SIZE}" "${IMG_FILE}"
|
||||
#
|
||||
# parted --script "${IMG_FILE}" mklabel msdos
|
||||
# parted --script "${IMG_FILE}" unit B mkpart primary fat32 "${BOOT_PART_START}" "$((BOOT_PART_START + BOOT_PART_SIZE - 1))"
|
||||
# parted --script "${IMG_FILE}" unit B mkpart primary ext4 "${ROOT_PART_START}" "$((ROOT_PART_START + ROOT_PART_SIZE - 1))"
|
||||
#
|
||||
# echo "Creating loop device..."
|
||||
# cnt=0
|
||||
# until LOOP_DEV="$(losetup --show --find --partscan "$IMG_FILE")"; do
|
||||
# if [ $cnt -lt 5 ]; then
|
||||
# cnt=$((cnt + 1))
|
||||
# echo "Error in losetup. Retrying..."
|
||||
# sleep 5
|
||||
# else
|
||||
# echo "ERROR: losetup failed; exiting"
|
||||
# exit 1
|
||||
# fi
|
||||
# done
|
||||
#
|
||||
# BOOT_DEV="${LOOP_DEV}p1"
|
||||
# ROOT_DEV="${LOOP_DEV}p2"
|
||||
#
|
||||
# ROOT_FEATURES="^huge_file"
|
||||
# for FEATURE in 64bit; do
|
||||
# if grep -q "$FEATURE" /etc/mke2fs.conf; then
|
||||
# ROOT_FEATURES="^$FEATURE,$ROOT_FEATURES"
|
||||
# fi
|
||||
# done
|
||||
# mkdosfs -n bootfs -F 32 -s 4 -v "$BOOT_DEV" > /dev/null
|
||||
# mkfs.ext4 -L rootfs -O "$ROOT_FEATURES" "$ROOT_DEV" > /dev/null
|
||||
#
|
||||
# mount -v "$ROOT_DEV" "${ROOTFS_DIR}" -t ext4
|
||||
# mkdir -p "${ROOTFS_DIR}/boot"
|
||||
# mount -v "$BOOT_DEV" "${ROOTFS_DIR}/boot" -t vfat
|
||||
#
|
||||
# rsync -aHAXx --exclude /var/cache/apt/archives --exclude /boot "${EXPORT_ROOTFS_DIR}/" "${ROOTFS_DIR}/"
|
||||
# rsync -rtx "${EXPORT_ROOTFS_DIR}/boot/" "${ROOTFS_DIR}/boot/"
|
||||
#fi
|
||||
Reference in New Issue
Block a user