--- encrypt 2017-12-25 11:30:54.000000000 -0800 +++ encrypt-custom 2018-01-17 15:38:17.878734369 -0800 @@ -60,6 +60,13 @@ allow-discards) cryptargs="${cryptargs} --allow-discards" ;; + shutdown-after*) + IFS='=' read opt timeo <&2 ;; @@ -85,7 +92,11 @@ #loop until we get a real password while ! eval cryptsetup open --type luks ${resolved} ${cryptname} ${cryptargs} ${CSQUIET}; do - sleep 2; + if [ -n "$shutdown_after" ]; then + echo "Input timeout. Shutting down." + for x in u s o; do echo $x > /proc/sysrq-trigger; sleep 2; done + fi + sleep 2 done fi if [ -e "/dev/mapper/${cryptname}" ]; then