exit 1
fi
-# for calling outside of FAI without args:
+
+# for calling outside of FAI.
#
-# source /b/fai/fai-wrapper
+# source /b/fai/fai-wrapper (note: this exports everything, including functions).
# - set any appropriate classes with: fai-setclass OPT1... which sets CLASS_OPT1=true...
# or run eval-fai-classfile FILE.
-# - Set a VOL_DISTROVER (if not doing mkroot2) eg:
-# fai-setclass VOL_NABIA
-# - fai-setclass IANK|FSF
+# - fai-setclass IANK|FSF (if not already set in 51-multiboot)
# /a/bin/fai/fai/config/hooks/partition.DEFAULT
#
-# ARGS (only 1 is valid):
+## ARGS (only 0 or 1 is valid). All args are for use outside of fai.
#
-# mkroot2: for running outside of fai and setting up the root2/boot2 luks and btrfs and tab files
+# mkroot2: for setting up the root2/boot2 luks and btrfs and tab files
#
-# mkroot2tab: for running outside of fai and setting up the root2/boot2 tab files, in case luks and btrfs
+# mkroot2tab: for setting up the root2/boot2 tab files, in case luks and btrfs
# happen to already be setup.
#
-# mktab: for running outside of fai and generating a crypttab for
-# the main root fs in /tmp/fai. Must run with env var, eg export DISTRO=trisquelaramo.
+# mktab: for generating a crypttab for the main root fs in
+# /tmp/fai. Requires DISTRO be set, see below.
#
# Example use in a bootstrap distro:
# scp /b/fai/fai-wrapper /a/bin/fai/fai/config/{distro-install-common/devbyid,hooks/partition.DEFAULT} root@HOST:
-# sl HOST
+# sl root@HOST
# . fai-wrapper # ignore error that FAI is not set, it is not needed for SPECIAL_DISK purposes.
# fai-setclass FSF
# export SPECIAL_DISK=/dev/sde
# export DISTRO=trisquelecne # not actually used
-# ./partition.DEFAULT
+# . ./partition.DEFAULT
#
# ## cryptsetup wont take within a pipeline
# mapfile -t lines < <(awk '! /swap/ {print $2,$1}' /tmp/fai/crypttab )
## potentially useful later:
# sed 's#/root/keyscript,#decrypt_keyctl,#;s/$/,noauto/' /tmp/fai/crypttab >/etc/crypttab
#
-## environment variables:
+##### environment variables:
#
# HOSTNAME: if demohost, we set the luks password to just
# 'x'. Used in various other ways too.
#
# SPECIAL_DISK: For use outside of fai. A base disk name like
# /dev/sdk. If set, we just cryptsetup and partition this one disk then
-# exit. This is useful for partitioning a disk in preparation to replace
-# a failed or failing disk from a raid10 array. This also sets REPARTITION.
+# exit. It creates a single lvm pv/vg/lv called "data". If this is
+# partitioning intended to go into a root filesystem, you can modify the
+# script to change that, or run commands manually afterwards. This also
+# sets REPARTITION.
#
-# DISTRO: if not set, derived from VOL_... variable in a switch below.
+# DISTRO: if not set, derived from VOL_... variable in a switch.
+# Required except for mkroot2, mkroot2tab, or SPECIAL_DISK.
#
-# classes:
+##### classes:
#
-# FSF|IANK: what kind of partitioning we want to do.
+# FSF|IANK: what kind of partitioning we want to do. Required anytime we
+# do partitioning.
#
# REPARTITION: forces repartitioning even if we detect the proper amount
# of partitions already exist.
DISTRO=trisquelaramo
elif ifclass VOL_ECNE; then
DISTRO=trisquelecne
- elif $mkroot2 || $mkroot2tab; then
+ elif $mkroot2 || $mkroot2tab || [[ $SPECIAL_DISK ]]; then
:
else
echo "PARTITIONER ERROR: no distro class/var set" >&2
exit 0
else
mktab
- if ! fsf && [[ ! $SPECIAL_DISK ]]; then
+ if ! fsf; then
getluks
fi
fi