2 # Copyright (C) 2019 Ian Kelling
3 # SPDX-License-Identifier: AGPL-3.0-or-later
6 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
8 [[ $EUID == 0 ]] ||
exec sudo
-E "${BASH_SOURCE[0]}" "$@"
9 if [[ $
- != *i
* ]]; then
10 exec &>>/var
/log
/keyscript-on.log
11 echo "$0: starting. $(date)"
15 sed="sed --follow-symlinks"
17 if [[ ! -e /tmp
/keyscript-off
]]; then
18 if [[ $
($sed -rn 's/^ID=(.*)/\1/p' /etc
/os-release
) == arch
]]; then
19 if ! grep -q '^\s*FILES=' /etc
/mkinitcpio.conf
; then
20 $sed -ri 's/^#(\s*FILES=.*)/\1/' /etc
/mkinitcpio.conf
# uncomment
25 # old name. can remove this sometime after aug 2019
26 $sed -i "s#/root/keyscript-manual,#${x},#" /etc
/crypttab
27 if grep -q "${x}," /etc
/crypttab
; then
28 $sed -i "s#${x},#/root/keyscript,#" /etc
/crypttab
33 # switch to easy or hard login pass which is the same as luks
34 f
=/q
/root
/shadow
/traci-simple
35 [[ $HOSTNAME != tpnew
]] || usermod
-p "$(cat $f)" iank
37 echo "$0: finished. $(date)"