Move crypt question to main script
This commit is contained in:
parent
408f2aa873
commit
d872a99180
7
run.py
7
run.py
@ -42,6 +42,12 @@ def blockdevice(termsize, settings):
|
|||||||
settings["blockdevice"] = _ask("Install where?", os.listdir("/sys/block/"), enforce=False)
|
settings["blockdevice"] = _ask("Install where?", os.listdir("/sys/block/"), enforce=False)
|
||||||
|
|
||||||
|
|
||||||
|
def cryptroot(termsize, settings):
|
||||||
|
print("Do you want to encrypt your root partition?")
|
||||||
|
print("Please note that there is no way to recover your data if you forget your password.")
|
||||||
|
settings["cryptroot"] = _ask("Encrypt root?", [ "yes", "no" ])
|
||||||
|
|
||||||
|
|
||||||
def rundir(termsize, settings, directory, validation_suffix, subfile="", ask=False):
|
def rundir(termsize, settings, directory, validation_suffix, subfile="", ask=False):
|
||||||
for filename in sorted(os.listdir(directory)):
|
for filename in sorted(os.listdir(directory)):
|
||||||
if filename[-len(validation_suffix):] == validation_suffix:
|
if filename[-len(validation_suffix):] == validation_suffix:
|
||||||
@ -108,6 +114,7 @@ def main():
|
|||||||
motd(termsize, settings)
|
motd(termsize, settings)
|
||||||
efibios(termsize, settings)
|
efibios(termsize, settings)
|
||||||
blockdevice(termsize, settings)
|
blockdevice(termsize, settings)
|
||||||
|
cryptroot(termsize, settings)
|
||||||
rundir(termsize, settings, "checks", ".check")
|
rundir(termsize, settings, "checks", ".check")
|
||||||
rundir(termsize, settings, "steps", ".step")
|
rundir(termsize, settings, "steps", ".step")
|
||||||
rundir(termsize, settings, "flavours", ".flavour", "install.sh", ask=True)
|
rundir(termsize, settings, "flavours", ".flavour", "install.sh", ask=True)
|
||||||
|
@ -6,11 +6,7 @@ mkfs.fat -F32 ${blockdevice}1
|
|||||||
echo -n "~> Do you want to encrypt root? (Y/n) "
|
echo -n "~> Do you want to encrypt root? (Y/n) "
|
||||||
read answer
|
read answer
|
||||||
|
|
||||||
if [ "$answer" == "n" ] || [ "$answer" == "N" ]; then
|
if [ "$cryptroot" == "yes" ]; then
|
||||||
echo "~> There are close to no reasons to not do this, but hey, you're an adult."
|
|
||||||
rootformat=${blockdevice}2
|
|
||||||
didCrypt=0
|
|
||||||
else
|
|
||||||
echo "~> Formatting root (/) for crypto"
|
echo "~> Formatting root (/) for crypto"
|
||||||
cryptsetup -v luksFormat ${blockdevice}2
|
cryptsetup -v luksFormat ${blockdevice}2
|
||||||
echo "~> Here's the header crypto:"
|
echo "~> Here's the header crypto:"
|
||||||
@ -18,7 +14,9 @@ else
|
|||||||
echo "~> Open the crypt container"
|
echo "~> Open the crypt container"
|
||||||
cryptsetup luksOpen ${blockdevice}2 cryptroot
|
cryptsetup luksOpen ${blockdevice}2 cryptroot
|
||||||
rootformat=/dev/mapper/cryptroot
|
rootformat=/dev/mapper/cryptroot
|
||||||
didCrypt=1
|
else
|
||||||
|
echo "~> There are close to no reasons to not do this, but hey, you're an adult."
|
||||||
|
rootformat=${blockdevice}2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "~> Formatting $rootformat EXT4"
|
echo "~> Formatting $rootformat EXT4"
|
||||||
|
@ -26,7 +26,7 @@ else
|
|||||||
arch-chroot /mnt grub-install --target=i386-pc /dev/*da
|
arch-chroot /mnt grub-install --target=i386-pc /dev/*da
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$didCrypt" -eq 1 ]; then
|
if [ "$cryptroot" -eq 1 ]; then
|
||||||
echo "GRUB_CMDLINE_LINUX='cryptdevice=UUID=`blkid -o value ${blockdevice}2 | head -n 1`:cryptroot'" > /mnt/etc/default/grub
|
echo "GRUB_CMDLINE_LINUX='cryptdevice=UUID=`blkid -o value ${blockdevice}2 | head -n 1`:cryptroot'" > /mnt/etc/default/grub
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user