Make sanity checks even stricter and fix efi path

This commit is contained in:
Ward Nakchbandi (Cosmic Fusion) 2024-01-05 21:44:48 +03:00 committed by GitHub
parent 3ef0c27856
commit ee34c01712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 40 deletions

View File

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

View File

@ -29,8 +29,8 @@ chmod +x /var/albius-refind_linux.sh
refind-install refind-install
apt install -y /var/cache/apt/archives/pika-refind-theme*.deb /var/cache/apt/archives/booster*.deb apt install -y /var/cache/apt/archives/pika-refind-theme*.deb /var/cache/apt/archives/booster*.deb
# EFI workaround for MSI # EFI workaround for MSI
mkdir -p /boot/EFI/BOOT mkdir -p /boot/efi/EFI/BOOT
cp -vf /boot/EFI/refind/refind_x64.efi /boot/EFI/BOOT/BOOTX64.EFI cp -vf /boot/efi/EFI/refind/refind_x64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI
# Remove installer from installed system # Remove installer from installed system
apt remove casper vanilla-installer -y || true apt remove casper vanilla-installer -y || true
apt autoremove -y || true apt autoremove -y || true

View File

@ -2,7 +2,7 @@
# import libs # import libs
import argparse import argparse
import subprocess import subprocess
import os import os
# Version # Version
@ -81,10 +81,10 @@ root_part_encrypt = root_part_encrypt_command.stdout.readline().decode("utf-8").
root_uuid_encrypt_command = subprocess.Popen(['/usr/lib/pika/pikainstall/partition-helper.sh', 'encrypt-uuid'] + args.root, stdout=subprocess.PIPE, stderr=subprocess.PIPE) root_uuid_encrypt_command = subprocess.Popen(['/usr/lib/pika/pikainstall/partition-helper.sh', 'encrypt-uuid'] + args.root, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
root_uuid_encrypt = root_uuid_encrypt_command.stdout.readline().decode("utf-8").strip() root_uuid_encrypt = root_uuid_encrypt_command.stdout.readline().decode("utf-8").strip()
## Print Root info ## Print Root info
print("\nRoot UUID: {}".format(root_uuid)) print("\nRoot UUID: {}".format(root_uuid))
if root_part_encrypt == "luks_none": if root_part_encrypt == "luks_none":
print("Root Encryption Partition: Root is not encrypted!") print("Root Encryption Partition: Root is not encrypted!")
print("Root Encryption UUID: Root is not encrypted!") print("Root Encryption UUID: Root is not encrypted!")
else: else:
print("Root Encryption Partition: {}".format(root_part_encrypt)) print("Root Encryption Partition: {}".format(root_part_encrypt))
print("Root Encryption UUID: {}".format(root_uuid_encrypt)) print("Root Encryption UUID: {}".format(root_uuid_encrypt))
@ -114,16 +114,47 @@ if args.home is not None:
print("\nHome UUID: {}".format(home_uuid)) print("\nHome UUID: {}".format(home_uuid))
if home_part_encrypt == "luks_none": if home_part_encrypt == "luks_none":
print("Home Encryption Partition: Home is not encrypted!") print("Home Encryption Partition: Home is not encrypted!")
print("Home Encryption UUID: Home is not encrypted!") print("Home Encryption UUID: Home is not encrypted!")
else: else:
print("Home Encryption Partition: {}".format(home_part_encrypt)) print("Home Encryption Partition: {}".format(home_part_encrypt))
print("Home Encryption UUID: {}".format(home_uuid_encrypt)) print("Home Encryption UUID: {}".format(home_uuid_encrypt))
## Ask user for Home luks partition password for the key-filing process ## Ask user for Home luks partition password for the key-filing process
print("\nPlease enter the LUKS password for the device" + home_part_encrypt + " :") print("\nPlease enter the LUKS password for the device" + home_part_encrypt + " :")
home_passwd = input("Warning: Do not enter this incorrectly or late installation will fail! ") home_passwd = input("Warning: Do not enter this incorrectly or late installation will fail! ")
# Checks # Checks
# Make sure mountpoints are not /dev prefixes
if args.root[0].startswith('/dev'):
print("Error: Root mount point is pointed a device, please use a mountpoint.")
exit(1)
if args.boot[0].startswith('/dev'):
print("Error: Boot mount point is pointed a device, please use a mountpoint.")
exit(1)
if args.efi[0].startswith('/dev'):
print("Error: EFI mount point is pointed a device, please use a mountpoint.")
exit(1)
if args.home is not None:
if args.home[0].startswith('/dev'):
print("Error: Home mount point is pointed a device, please use a mountpoint.")
exit(1)
# Make sure All mounts are in the correct place releative to chroot
if args.boot[0] == f"{args.root[0]}/boot":
print("Boot Partition Check: OK!")
else:
print(f"Error: Boot mount point is not in a correct place relative to chroot, please mount it in {args.root[0]}/boot and supply the new mountpoint!")
exit(1)
if args.efi[0] == f"{args.root[0]}/boot/efi":
print("EFI Partition Check: OK!")
else:
print(f"Error: EFI mount point is not in a correct place relative to chroot, please mount it in {args.root[0]}/boot/efi and supply the new mountpoint!")
exit(1)
if args.home is not None:
if args.home[0] == f"{args.root[0]}/home":
print("Home Partition Check: OK!")
else:
print(f"Error: Home mount point is not in a correct place relative to chroot, please mount it in {args.root[0]}/home and supply the new mountpoint!")
exit(1)
# Make sure to avoid any mounts pointing at the same partition # Make sure to avoid any mounts pointing at the same partition
if root_uuid == boot_uuid: if root_uuid == boot_uuid:
print("Error: Root and Boot are mounted on the same drive, please place boot on it's own partition.") print("Error: Root and Boot are mounted on the same drive, please place boot on it's own partition.")
@ -144,37 +175,6 @@ elif args.home is not None:
elif efi_uuid == home_uuid: elif efi_uuid == home_uuid:
print("Error: EFI and Home are mounted on the same drive, consider removing the -H/--home argument.") print("Error: EFI and Home are mounted on the same drive, consider removing the -H/--home argument.")
exit(1) exit(1)
# Make sure mountpoints are not /dev prefixes
if args.root[0].startswith('/dev'):
print("Error: Root mount point is pointed a device, please use a mountpoint.")
exit(1)
if args.boot[0].startswith('/dev'):
print("Error: Boot mount point is pointed a device, please use a mountpoint.")
exit(1)
if args.efi[0].startswith('/dev'):
print("Error: EFI mount point is pointed a device, please use a mountpoint.")
exit(1)
if args.home is not None:
if args.home[0].startswith('/dev'):
print("Error: Home mount point is pointed a device, please use a mountpoint.")
exit(1)
# Make sure All mounts are releative to chroot
if args.boot[0].startswith(args.root[0]):
print("Boot Partition Check: OK!")
else:
print("Error: Boot mount point is not relative to chroot, please mount it some inside the chroot and supply the new mountpoint!")
exit(1)
if args.efi[0].startswith(args.root[0]):
print("EFI Partition Check: OK!")
else:
print("Error: EFI mount point is not relative to chroot, please mount it some inside the chroot and supply the new mountpoint!")
exit(1)
if args.home is not None:
if args.home[0].startswith(args.root[0]):
print("Home Partition Check: OK!")
else:
print("Error: Home mount point is not relative to chroot, please mount it some inside the chroot and supply the new mountpoint!")
exit(1)
# With All Checks Clear and info gathered let's start installing # With All Checks Clear and info gathered let's start installing