6d7f4c0222611bfaacd58b4f16b9706525a16fb2
[automated-distro-installer] / fai / config / hooks / instsoft.DEFAULT
1 #!/bin/bash
2
3 # exit for any vm which is not our test vm
4 if ifclass VM && ! ifclass demohost || ifclass VOL_STABLE_BOOTSTRAP; then
5 exit 0
6 fi
7
8 keyfile=/var/lib/fai/config/distro-install-common/luks/host-$HOSTNAME
9 f=$target/root/keyscript
10 cat > $f <<EOFOUTER
11 #!/bin/sh
12 cat <<'EOF'
13 $(cat $keyfile)
14 EOF
15 EOFOUTER
16 chmod +x $f
17
18
19 f=$target/root/keyscript-manual
20 cat >$f <<'EOF'
21 #!/bin/sh
22 if ! [ -e /tmp/key ]; then
23 stty -echo
24 read pass
25 printf '%s' "$pass" > /tmp/key
26 fi
27 cat /tmp/key
28 EOF
29 chmod +x $f
30
31
32 # for hosts which don't have these data volumes, copy the specific
33 # files we need.
34 if ifclass demohost; then
35 files=(/var/lib/fai/config/distro-install-common/luks/host-demohost)
36 elif ifclass tp; then
37 files=(/var/lib/fai/config/distro-install-common/luks/host-{tp,demohost})
38 fi
39 if [[ ${files[0]} ]]; then
40 d=$target/q/root/luks
41 mkdir -p $d
42 cp ${files[@]} $d
43 chmod -R o-rwx $d
44 fi