fix home check

This commit is contained in:
Ward from fusion-voyager-3 2023-10-20 18:16:36 +03:00
parent 3f5563f141
commit 0bba839821
4 changed files with 31 additions and 12 deletions

View File

@ -1,4 +1,4 @@
pikainstall (1.0-100pika1) pikauwu; urgency=medium
pikainstall (1.0.1-100pika1) pikauwu; urgency=medium
* Initial release.

View File

@ -8,5 +8,5 @@ Rules-Requires-Root: no
Package: pikainstall
Architecture: linux-any
Depends: ${misc:Depends}, squashfs-tools, arch-install-scripts
Depends: ${misc:Depends}, squashfs-tools, arch-install-scripts, cryptsetup
Description: Command line installer for PikaOS

View File

@ -1,6 +1,11 @@
#! /bin/bash
apt remove casper -y
apt autoremove -y
if [ -f /tmp/albius-crypttab-root.sh ]
then
chmod +x /tmp/albius-crypttab-root.sh
/tmp/albius-crypttab-root.sh
fi
if [ -f /tmp/albius-crypttab.sh ]
then
chmod +x /tmp/albius-crypttab.sh

View File

@ -6,7 +6,7 @@ import subprocess
import os
# Version
version="1.0"
version="1.0.1"
dist="PikaOS 3"
image="/cdrom/casper/filesystem.squashfs"
@ -21,9 +21,13 @@ echo '"'Boot with logging'"' '"'nvidia-drm.modeset=1 root=UUID={ROOT_PART_UUID}
echo '"'Boot with safe graphics'"' '"'nvidia-drm.modeset=1 root=UUID={ROOT_PART_UUID} nomodeset ---'"' >> /boot/refind_linux.conf
"""
_CRYPTTAB_SETUP_FILE = """#!/usr/bin/bash
_CRYPTTAB_ROOT_SETUP_FILE = """#!/usr/bin/bash
cat /etc/crypttab
echo "crypt_root UUID={ROOT_PART_UUID} none luks,discard" > /etc/crypttab
"""
_CRYPTTAB_SETUP_FILE = """#!/usr/bin/bash
cat /etc/crypttab
echo "crypt_home UUID={HOME_PART_UUID} /keyfile.txt luks" >> /etc/crypttab
touch /keyfile.txt
openssl genrsa > /keyfile.txt
@ -131,12 +135,22 @@ subprocess.run(efi_flag_cmd)
CHROOT_PATH = listToString(args.root)
# Write crypttab script if system has encryption
if home_encrypt == "luks_none":
if root_encrypt != "luks_none":
CRYPTTAB_ROOT_FILE_PATH = '/tmp/albius-crypttab-root.sh'
CHROOT_CRYPTTAB_ROOT_FILE_PATH = os.path.join(CHROOT_PATH,CRYPTTAB_ROOT_FILE_PATH)
with open(CHROOT_CRYPTTAB_ROOT_FILE_PATH, "w") as file:
albius_crypttab_root_file = _CRYPTTAB_ROOT_SETUP_FILE.format(
ROOT_PART_UUID=root_uuid,
)
file.write(albius_crypttab_root_file)
# Write crypttab script if system has encryption
if args.home is not None:
if home_encrypt != "luks_none":
CRYPTTAB_FILE_PATH = '/tmp/albius-crypttab.sh'
CHROOT_CRYPTTAB_FILE_PATH=os.path.join(dir,file)
CHROOT_CRYPTTAB_FILE_PATH =os .path.join(CHROOT_PATH,CRYPTTAB_FILE_PATH)
with open(CHROOT_CRYPTTAB_FILE_PATH, "w") as file:
albius_crypttab_file = _CRYPTTAB_SETUP_FILE.format(
ROOT_PART_UUID=root_uuid,
HOME_PART_UUID=home_uuid,
LUKS_PASSWD=home_passwd,
)