perhaps ready?

This commit is contained in:
Ward from fusion-voyager-3 2023-10-20 17:09:49 +03:00
parent 19d2d1192a
commit c43a513dac
2 changed files with 50 additions and 1 deletions

View File

@ -1,7 +1,12 @@
#! /bin/bash #! /bin/bash
apt remove casper -y apt remove casper -y
apt autoremove -y apt autoremove -y
if [ -f /tmp/albius-crypttab.sh ]
then
chmod +x /tmp/albius-crypttab.sh
/tmp/albius-crypttab.sh /tmp/albius-crypttab.sh
fi
chmod +x /tmp/albius-refind_linux.sh
/tmp/albius-refind_linux.sh /tmp/albius-refind_linux.sh
refind-install refind-install
apt install -y /var/cache/apt/archives/pika-refind-theme*.deb apt install -y /var/cache/apt/archives/pika-refind-theme*.deb

View File

@ -3,6 +3,7 @@
# import libs # import libs
import argparse import argparse
import subprocess import subprocess
import os
# Version # Version
version="1.0" version="1.0"
@ -12,6 +13,24 @@ image="/cdrom/casper/filesystem.squashfs"
# Print Program info # Print Program info
print("pikainstall " + version + ": PikaOS terminal installer! for " + dist + ".") print("pikainstall " + version + ": PikaOS terminal installer! for " + dist + ".")
### text files
_REFIND_SETUP_FILE = """#!/usr/bin/bash
touch /boot/refind_linux.conf
echo '"'Boot with standard options'"' '"'nvidia-drm.modeset=1 root=UUID={ROOT_PART_UUID} quiet splash ---'"' > /boot/refind_linux.conf
echo '"'Boot with logging'"' '"'nvidia-drm.modeset=1 root=UUID={ROOT_PART_UUID} ---'"' >> /boot/refind_linux.conf
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
cat /etc/crypttab
echo "crypt_root UUID={ROOT_PART_UUID} none luks,discard" > /etc/crypttab
echo "crypt_home UUID={HOME_PART_UUID} /keyfile.txt luks" >> /etc/crypttab
touch /keyfile.txt
openssl genrsa > /keyfile.txt
echo "{LUKS_PASSWD}" | cryptsetup luksAddKey UUID={HOME_PART_UUID} /keyfile.txt -
"""
# Global Functions # Global Functions
## List to string ## List to string
def listToString(s): def listToString(s):
@ -108,6 +127,31 @@ subprocess.run(squashfs_cmd)
efi_flag_cmd = ['/usr/lib/pika/pikainstall/partition-helper.sh', 'flag', listToString(args.efi), 'bls_boot', 'on'] efi_flag_cmd = ['/usr/lib/pika/pikainstall/partition-helper.sh', 'flag', listToString(args.efi), 'bls_boot', 'on']
subprocess.run(efi_flag_cmd) subprocess.run(efi_flag_cmd)
CHROOT_PATH = listToString(args.root)
# Write crypttab script if system has encryption
if home_encrypt == "luks_none":
CRYPTTAB_FILE_PATH = '/tmp/albius-crypttab.sh'
CHROOT_CRYPTTAB_FILE_PATH=os.path.join(dir,file)
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,
)
file.write(albius_crypttab_file)
# Write refind script if system has encryption
REFIND_FILE_PATH = '/tmp/albius-refind_linux.sh'
CHROOT_REFIND_FILE_PATH=os.path.join(dir,file)
with open(CHROOT_REFIND_FILE_PATH, "w") as file:
refind_crypttab_file = _REFIND_SETUP_FILE.format(
ROOT_PART_UUID=root_uuid,
)
file.write(refind_crypttab_file)
## Run pika-install-script ## Run pika-install-script
bind_dev_cmd = ['/usr/lib/pika/pikainstall/pika-install-host.sh', listToString(args.root)] bind_dev_cmd = ['/usr/lib/pika/pikainstall/pika-install-host.sh', listToString(args.root)]
subprocess.run(bind_dev_cmd) subprocess.run(bind_dev_cmd)