aboutsummaryrefslogtreecommitdiffstats
path: root/export-image/04-finalise
diff options
context:
space:
mode:
authorSerge Schneider <[email protected]>2018-03-02 20:08:24 +0000
committerSerge Schneider <[email protected]>2018-03-13 12:50:50 +0000
commitff2d5edee18efbb7ba2498e5bf8d308c186c4866 (patch)
tree380dd4fb8138fcbcf374839a880deb3191ca0725 /export-image/04-finalise
parent56da271499afe7ae8e35a8fd30f04135283b2fb0 (diff)
shellcheck
Diffstat (limited to 'export-image/04-finalise')
-rwxr-xr-xexport-image/04-finalise/01-run.sh81
1 files changed, 41 insertions, 40 deletions
diff --git a/export-image/04-finalise/01-run.sh b/export-image/04-finalise/01-run.sh
index b093f01..b706774 100755
--- a/export-image/04-finalise/01-run.sh
+++ b/export-image/04-finalise/01-run.sh
@@ -8,74 +8,75 @@ on_chroot << EOF
hardlink -t /usr/share/doc
EOF
-if [ -d ${ROOTFS_DIR}/home/pi/.config ]; then
- chmod 700 ${ROOTFS_DIR}/home/pi/.config
+if [ -d "${ROOTFS_DIR}/home/pi/.config" ]; then
+ chmod 700 "${ROOTFS_DIR}/home/pi/.config"
fi
-rm -f ${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache
-rm -f ${ROOTFS_DIR}/usr/bin/qemu-arm-static
+rm -f "${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache"
+rm -f "${ROOTFS_DIR}/usr/bin/qemu-arm-static"
-rm -f ${ROOTFS_DIR}/etc/apt/sources.list~
-rm -f ${ROOTFS_DIR}/etc/apt/trusted.gpg~
+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/passwd-"
+rm -f "${ROOTFS_DIR}/etc/group-"
+rm -f "${ROOTFS_DIR}/etc/shadow-"
+rm -f "${ROOTFS_DIR}/etc/gshadow-"
-rm -f ${ROOTFS_DIR}/var/cache/debconf/*-old
-rm -f ${ROOTFS_DIR}/var/lib/dpkg/*-old
+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}/usr/share/icons/*/icon-theme.cache"
-rm -f ${ROOTFS_DIR}/var/lib/dbus/machine-id
+rm -f "${ROOTFS_DIR}/var/lib/dbus/machine-id"
-true > ${ROOTFS_DIR}/etc/machine-id
+true > "${ROOTFS_DIR}/etc/machine-id"
-ln -nsf /proc/mounts ${ROOTFS_DIR}/etc/mtab
+ln -nsf /proc/mounts "${ROOTFS_DIR}/etc/mtab"
-for _FILE in $(find ${ROOTFS_DIR}/var/log/ -type f); do
- true > ${_FILE}
-done
+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
-install files/LICENSE.oracle ${ROOTFS_DIR}/boot/
+update_issue "$(basename "${EXPORT_DIR}")"
+install -m 644 "${ROOTFS_DIR}/etc/rpi-issue" "${ROOTFS_DIR}/boot/issue.txt"
+install files/LICENSE.oracle "${ROOTFS_DIR}/boot/"
cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE"
-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" >> "$INFO_FILE"
+{
+ 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" >> "$INFO_FILE"
+ 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" >> "$INFO_FILE"
+ uname="$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/uname_string7")"
-printf "\nPackages:\n">> "$INFO_FILE"
-dpkg -l --root "$ROOTFS_DIR" >> "$INFO_FILE"
+ printf "Uname string: %s\n" "$uname"
+ printf "\nPackages:\n"
+ dpkg -l --root "$ROOTFS_DIR"
+} >> "$INFO_FILE"
-ROOT_DEV=$(mount | grep "${ROOTFS_DIR} " | cut -f1 -d' ')
+ROOT_DEV="$(mount | grep "${ROOTFS_DIR} " | cut -f1 -d' ')"
-unmount ${ROOTFS_DIR}
-zerofree -v ${ROOT_DEV}
+unmount "${ROOTFS_DIR}"
+zerofree -v "${ROOT_DEV}"
-unmount_image ${IMG_FILE}
+unmount_image "${IMG_FILE}"
-mkdir -p ${DEPLOY_DIR}
+mkdir -p "${DEPLOY_DIR}"
-rm -f ${DEPLOY_DIR}/image_${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.zip
+rm -f "${DEPLOY_DIR}/image_${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.zip"
-pushd ${STAGE_WORK_DIR} > /dev/null
-zip ${DEPLOY_DIR}/image_${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.zip $(basename ${IMG_FILE})
+pushd "${STAGE_WORK_DIR}" > /dev/null
+zip "${DEPLOY_DIR}/image_${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.zip" \
+ "$(basename "${IMG_FILE}")"
popd > /dev/null
cp "$INFO_FILE" "$DEPLOY_DIR"