From cdeea6bf8b114e499c650e14549fd0affd5d5b4a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 26 Apr 2013 09:39:47 +0200 Subject: Renumbering the first three early scripts. --- scripts/boot/0010-debug | 27 ++++++++++++ scripts/boot/0020-read-only | 56 ++++++++++++++++++++++++ scripts/boot/0030-verify-checksums | 89 ++++++++++++++++++++++++++++++++++++++ scripts/boot/0110-debug | 27 ------------ scripts/boot/0120-read-only | 56 ------------------------ scripts/boot/3010-verify-checksums | 89 -------------------------------------- 6 files changed, 172 insertions(+), 172 deletions(-) create mode 100755 scripts/boot/0010-debug create mode 100755 scripts/boot/0020-read-only create mode 100755 scripts/boot/0030-verify-checksums delete mode 100755 scripts/boot/0110-debug delete mode 100755 scripts/boot/0120-read-only delete mode 100755 scripts/boot/3010-verify-checksums (limited to 'scripts/boot') diff --git a/scripts/boot/0010-debug b/scripts/boot/0010-debug new file mode 100755 index 0000000..f223e93 --- /dev/null +++ b/scripts/boot/0010-debug @@ -0,0 +1,27 @@ +#!/bin/sh + +#set -e + +Debug () +{ + for _PARAMETER in ${_CMDLINE} + do + case "${_PARAMETER}" in + live-boot.debug|debug) + LIVE_DEBUG="true" + ;; + esac + done + + case "${LIVE_DEBUG}" in + true) + ;; + + *) + return 0 + ;; + esac + + # Write the trace output + set -x +} diff --git a/scripts/boot/0020-read-only b/scripts/boot/0020-read-only new file mode 100755 index 0000000..859f771 --- /dev/null +++ b/scripts/boot/0020-read-only @@ -0,0 +1,56 @@ +#!/bin/sh + +#set -e + +Read_only () +{ + for _PARAMETER in ${_CMDLINE} + do + case "${_PARAMETER}" in + live-boot.read-only=*|read-only=*) + LIVE_READ_ONLY="true" + LIVE_READ_ONLY_DEVICES="${_PARAMETER#*read-only=}" + ;; + + live-boot.read-only|read-only) + LIVE_READ_ONLY="true" + ;; + esac + done + + case "${LIVE_READ_ONLY}" in + true) + ;; + + *) + return 0 + ;; + esac + + # Marking some block devices as read-only to ensure that nothing + # gets written as linux still writes to 'only' read-only mounted filesystems. + LIVE_READ_ONLY_DEVICES="${LIVE_READ_ONLY_DEVICES:-/dev/sd* /dev/vd*}" + + for _DEVICE in $(echo ${LIVE_READ_ONLY_DEVICES} | sed -e 's|,| |g') + do + if [ ! -b "${_DEVICE}" ] + then + continue + fi + + echo -n "live-boot: Setting ${_DEVICE} read-only..." > /dev/console + + blockdev --setro ${_DEVICE} + _RETURN="${?}" + + case "${_RETURN}" in + 0) + echo " done, use 'blockdev --setrw ${_DEVICE}' to set read-write." > /dev/console + ;; + + *) + echo " failed." > /dev/console + ;; + esac + done +} diff --git a/scripts/boot/0030-verify-checksums b/scripts/boot/0030-verify-checksums new file mode 100755 index 0000000..08b2972 --- /dev/null +++ b/scripts/boot/0030-verify-checksums @@ -0,0 +1,89 @@ +#!/bin/sh + +#set -e + +Verify_checksums () +{ + for _PARAMETER in ${_CMDLINE} + do + case "${_PARAMETER}" in + live-boot.verify-checksums=*|verify-checksums=*) + LIVE_VERIFY_CHECKSUMS="true" + LIVE_VERIFY_CHECKSUMS_DIGESTS="${_PARAMETER#*verify-checksums=}" + ;; + + live-boot.verify-checksums|verify-checksums) + LIVE_VERIFY_CHECKSUMS="true" + ;; + esac + done + + case "${LIVE_VERIFY_CHECKSUMS}" in + true) + ;; + + *) + return 0 + ;; + esac + + _MOUNTPOINT="${1}" + + LIVE_VERIFY_CHECKSUMS_DIGESTS="${LIVE_VERIFY_CHECKSUMS_DIGESTS:-sha512 sha384 sha256 sha224 sha1 md5}" + _TTY="/dev/tty8" + + log_begin_msg "Verifying checksums" + + cd "${_MOUNTPOINT}" + + for _DIGEST in $(echo ${LIVE_VERIFY_CHECKSUMS_DIGESTS} | sed -e 's|,| |g') + do + _CHECKSUMS="$(echo ${_DIGEST} | tr [a-z] [A-Z])SUMS ${_DIGEST}sum.txt" + + for _CHECKSUM in ${_CHECKSUMS} + do + if [ -e "${_CHECKSUM}" ] + then + echo "Found ${_CHECKSUM}..." > "${_TTY}" + + if [ -e "/bin/${_DIGEST}sum" ] + then + echo "Checking ${_CHECKSUM}..." > "${_TTY}" + + # Verify checksums + /bin/${_DIGEST}sum -c "${_CHECKSUM}" < "${_TTY}" > "${_TTY}" + _RETURN="${?}" + + # Stop after first verification + break + else + echo "Not found /bin/${_DIGEST}sum..." > "${_TTY}" + fi + fi + done + 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/0110-debug b/scripts/boot/0110-debug deleted file mode 100755 index f223e93..0000000 --- a/scripts/boot/0110-debug +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -#set -e - -Debug () -{ - for _PARAMETER in ${_CMDLINE} - do - case "${_PARAMETER}" in - live-boot.debug|debug) - LIVE_DEBUG="true" - ;; - esac - done - - case "${LIVE_DEBUG}" in - true) - ;; - - *) - return 0 - ;; - esac - - # Write the trace output - set -x -} diff --git a/scripts/boot/0120-read-only b/scripts/boot/0120-read-only deleted file mode 100755 index 859f771..0000000 --- a/scripts/boot/0120-read-only +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -#set -e - -Read_only () -{ - for _PARAMETER in ${_CMDLINE} - do - case "${_PARAMETER}" in - live-boot.read-only=*|read-only=*) - LIVE_READ_ONLY="true" - LIVE_READ_ONLY_DEVICES="${_PARAMETER#*read-only=}" - ;; - - live-boot.read-only|read-only) - LIVE_READ_ONLY="true" - ;; - esac - done - - case "${LIVE_READ_ONLY}" in - true) - ;; - - *) - return 0 - ;; - esac - - # Marking some block devices as read-only to ensure that nothing - # gets written as linux still writes to 'only' read-only mounted filesystems. - LIVE_READ_ONLY_DEVICES="${LIVE_READ_ONLY_DEVICES:-/dev/sd* /dev/vd*}" - - for _DEVICE in $(echo ${LIVE_READ_ONLY_DEVICES} | sed -e 's|,| |g') - do - if [ ! -b "${_DEVICE}" ] - then - continue - fi - - echo -n "live-boot: Setting ${_DEVICE} read-only..." > /dev/console - - blockdev --setro ${_DEVICE} - _RETURN="${?}" - - case "${_RETURN}" in - 0) - echo " done, use 'blockdev --setrw ${_DEVICE}' to set read-write." > /dev/console - ;; - - *) - echo " failed." > /dev/console - ;; - esac - done -} diff --git a/scripts/boot/3010-verify-checksums b/scripts/boot/3010-verify-checksums deleted file mode 100755 index 08b2972..0000000 --- a/scripts/boot/3010-verify-checksums +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh - -#set -e - -Verify_checksums () -{ - for _PARAMETER in ${_CMDLINE} - do - case "${_PARAMETER}" in - live-boot.verify-checksums=*|verify-checksums=*) - LIVE_VERIFY_CHECKSUMS="true" - LIVE_VERIFY_CHECKSUMS_DIGESTS="${_PARAMETER#*verify-checksums=}" - ;; - - live-boot.verify-checksums|verify-checksums) - LIVE_VERIFY_CHECKSUMS="true" - ;; - esac - done - - case "${LIVE_VERIFY_CHECKSUMS}" in - true) - ;; - - *) - return 0 - ;; - esac - - _MOUNTPOINT="${1}" - - LIVE_VERIFY_CHECKSUMS_DIGESTS="${LIVE_VERIFY_CHECKSUMS_DIGESTS:-sha512 sha384 sha256 sha224 sha1 md5}" - _TTY="/dev/tty8" - - log_begin_msg "Verifying checksums" - - cd "${_MOUNTPOINT}" - - for _DIGEST in $(echo ${LIVE_VERIFY_CHECKSUMS_DIGESTS} | sed -e 's|,| |g') - do - _CHECKSUMS="$(echo ${_DIGEST} | tr [a-z] [A-Z])SUMS ${_DIGEST}sum.txt" - - for _CHECKSUM in ${_CHECKSUMS} - do - if [ -e "${_CHECKSUM}" ] - then - echo "Found ${_CHECKSUM}..." > "${_TTY}" - - if [ -e "/bin/${_DIGEST}sum" ] - then - echo "Checking ${_CHECKSUM}..." > "${_TTY}" - - # Verify checksums - /bin/${_DIGEST}sum -c "${_CHECKSUM}" < "${_TTY}" > "${_TTY}" - _RETURN="${?}" - - # Stop after first verification - break - else - echo "Not found /bin/${_DIGEST}sum..." > "${_TTY}" - fi - fi - done - 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