Adding temporary notes in a readme file.
[debian-live-boot/hramrach.git] / scripts / boot / verify-checksums.sh
blob7dd5da3753c541ead973e92c45030566015d0735
1 #!/bin/sh
3 #set -e
5 Verify_checksums ()
7 _MOUNTPOINT="${1}"
9 _DIGESTS="sha512 sha384 sha256 sha224 sha1 md5"
10 _TTY="/dev/tty8"
12 log_begin_msg "Verifying checksums"
14 cd "${_MOUNTPOINT}"
16 for _DIGEST in ${_DIGESTS}
18 _CHECKSUMS="$(echo ${_DIGEST} | tr [a-z] [A-Z])SUMS"
20 if [ -e "${_CHECKSUMS}" ]
21 then
22 echo "Found ${_CHECKSUMS}..." > "${_TTY}"
24 if [ -e "/bin/${_DIGEST}sum" ]
25 then
26 echo "Checking ${_CHECKSUMS}..." > "${_TTY}"
28 # Verify checksums
29 /bin/${_DIGEST}sum -c "${_CHECKSUMS}" < "${_TTY}" > "${_TTY}"
30 _RETURN="${?}"
32 # Stop after first verification
33 break
34 else
35 echo "Not found /bin/${_DIGEST}sum..." > "${_TTY}"
38 done
40 log_end_msg
42 case "${_RETURN}" in
44 log_success_msg "Verification successfull, rebooting in 10 seconds."
45 sleep 10
47 # Unmount live-media
48 cd /
49 umount -f ${_MOUNTPOINT} > /dev/null 2>&1
50 sync
52 # Attempt to remount all mounted filesystems read-only
53 echo u > /proc/sysrq-trigger
55 # Immediately reboot the system without syncing or unmounting filesystems
56 echo b > /proc/sysrq-trigger
60 panic "Verification failed, $(basename ${_TTY}) for more information."
62 esac