From d5e86414b0f52bb9d39ab2e9c12d98fe7a0e7f33 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 2 Jul 2012 18:11:31 +0200 Subject: Splitting out already reviewed verify-checksums script. --- scripts/boot/3010-verify-checksums | 63 +++++++++++++++++++++++++++++++++++ scripts/boot/9990-verify-checksums.sh | 63 ----------------------------------- 2 files changed, 63 insertions(+), 63 deletions(-) create mode 100755 scripts/boot/3010-verify-checksums delete mode 100755 scripts/boot/9990-verify-checksums.sh (limited to 'scripts/boot') diff --git a/scripts/boot/3010-verify-checksums b/scripts/boot/3010-verify-checksums new file mode 100755 index 0000000..7dd5da3 --- /dev/null +++ b/scripts/boot/3010-verify-checksums @@ -0,0 +1,63 @@ +#!/bin/sh + +#set -e + +Verify_checksums () +{ + _MOUNTPOINT="${1}" + + _DIGESTS="sha512 sha384 sha256 sha224 sha1 md5" + _TTY="/dev/tty8" + + log_begin_msg "Verifying checksums" + + cd "${_MOUNTPOINT}" + + for _DIGEST in ${_DIGESTS} + do + _CHECKSUMS="$(echo ${_DIGEST} | tr [a-z] [A-Z])SUMS" + + if [ -e "${_CHECKSUMS}" ] + then + echo "Found ${_CHECKSUMS}..." > "${_TTY}" + + if [ -e "/bin/${_DIGEST}sum" ] + then + echo "Checking ${_CHECKSUMS}..." > "${_TTY}" + + # Verify checksums + /bin/${_DIGEST}sum -c "${_CHECKSUMS}" < "${_TTY}" > "${_TTY}" + _RETURN="${?}" + + # Stop after first verification + break + else + echo "Not found /bin/${_DIGEST}sum..." > "${_TTY}" + fi + fi + done + + log_end_msg + + case "${_RETURN}" in + 0) + log_success_msg "Verification successfull, rebooting in 10 seconds." + sleep 10 + + # Unmount live-media + cd / + umount -f ${_MOUNTPOINT} > /dev/null 2>&1 + sync + + # Attempt to remount all mounted filesystems read-only + echo u > /proc/sysrq-trigger + + # Immediately reboot the system without syncing or unmounting filesystems + echo b > /proc/sysrq-trigger + ;; + + *) + panic "Verification failed, $(basename ${_TTY}) for more information." + ;; + esac +} diff --git a/scripts/boot/9990-verify-checksums.sh b/scripts/boot/9990-verify-checksums.sh deleted file mode 100755 index 7dd5da3..0000000 --- a/scripts/boot/9990-verify-checksums.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -#set -e - -Verify_checksums () -{ - _MOUNTPOINT="${1}" - - _DIGESTS="sha512 sha384 sha256 sha224 sha1 md5" - _TTY="/dev/tty8" - - log_begin_msg "Verifying checksums" - - cd "${_MOUNTPOINT}" - - for _DIGEST in ${_DIGESTS} - do - _CHECKSUMS="$(echo ${_DIGEST} | tr [a-z] [A-Z])SUMS" - - if [ -e "${_CHECKSUMS}" ] - then - echo "Found ${_CHECKSUMS}..." > "${_TTY}" - - if [ -e "/bin/${_DIGEST}sum" ] - then - echo "Checking ${_CHECKSUMS}..." > "${_TTY}" - - # Verify checksums - /bin/${_DIGEST}sum -c "${_CHECKSUMS}" < "${_TTY}" > "${_TTY}" - _RETURN="${?}" - - # Stop after first verification - break - else - echo "Not found /bin/${_DIGEST}sum..." > "${_TTY}" - fi - fi - done - - log_end_msg - - case "${_RETURN}" in - 0) - log_success_msg "Verification successfull, rebooting in 10 seconds." - sleep 10 - - # Unmount live-media - cd / - umount -f ${_MOUNTPOINT} > /dev/null 2>&1 - sync - - # Attempt to remount all mounted filesystems read-only - echo u > /proc/sysrq-trigger - - # Immediately reboot the system without syncing or unmounting filesystems - echo b > /proc/sysrq-trigger - ;; - - *) - panic "Verification failed, $(basename ${_TTY}) for more information." - ;; - esac -} -- cgit v1.2.3