#!/bin/bash -x
+# Copyright (C) 2016 Ian Kelling
-# see t.org for how to call
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
set -eE -o pipefail
trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
. /a/bin/fai/fai-wrapper
export LUKS_DIR=/root/luks
-export HOSTNAME=$hostname
export DISTRO=arch
partition_script=/a/bin/fai/fai/config/hooks/partition.DEFAULT
chmod +x $partition_script
fi
# https://wiki.archlinux.org/index.php/Dm-crypt/Device_encryption#Keyfiles
-cp /root/luks/host-$hostname /mnt/crypto_keyfile.bin
+cp /root/luks/host-$HOSTNAME /mnt/crypto_keyfile.bin
chmod 600 /mnt/crypto_keyfile.bin
ln -s /run/systemd/resolve/resolv.conf /mnt/etc/resolv.conf
# not necsesary, but makes reboot go fast.
-#umount -R /mnt; sleep 1
+umount -R /mnt; sleep 1
# causes 255 exit code, so doing this from the caller script.
# reboot now