adapt to new installer
Some checks failed
PikaOS Package Build & Release (amd64-v3) / build (push) Failing after 14s

This commit is contained in:
Ward from fusion-voyager-3 2024-08-23 20:15:26 +03:00
parent c91852898f
commit a7b35e4615
5 changed files with 71 additions and 33 deletions

View File

@ -1 +1 @@
1 2

View File

@ -1,3 +1,9 @@
pikainstall (2.0.0-101pika1) pika; urgency=medium
* Adapt to new installer
-- Ward Nakchbandi <hotrod.master@hotmail.com> Fri, 07 Oct 2022 23:26:00 +0300
pikainstall (1.1.9-101pika3) pika; urgency=medium pikainstall (1.1.9-101pika3) pika; urgency=medium
* PikaOS 4 ISO Fixes * PikaOS 4 ISO Fixes

View File

@ -1,6 +1,9 @@
#! /bin/bash #! /bin/bash
SOCKET_PATH="/tmp/pikainstall-status.sock"
# Clear fstab # Clear fstab
echo 'GEN_FSTAB' | nc -U $SOCKET_PATH || true
touch /etc/fstab touch /etc/fstab
# Generate fstab entries # Generate fstab entries
dpkg -s arch-install-scripts || apt install -y arch-install-scripts cryptsetup dpkg -s arch-install-scripts || apt install -y arch-install-scripts cryptsetup
@ -10,20 +13,24 @@ apt autoremove -y
# Setup Crypttab if needed # Setup Crypttab if needed
if [ -f /var/albius-crypttab-root.sh ] if [ -f /var/albius-crypttab-root.sh ]
then then
echo 'ENCRYPTION' | nc -U $SOCKET_PATH || true
chmod +x /var/albius-crypttab-root.sh chmod +x /var/albius-crypttab-root.sh
/var/albius-crypttab-root.sh /var/albius-crypttab-root.sh
fi fi
if [ -f /var/albius-crypttab.sh ] if [ -f /var/albius-crypttab.sh ]
then then
echo 'ENCRYPTION' | nc -U $SOCKET_PATH || true
chmod +x /var/albius-crypttab.sh chmod +x /var/albius-crypttab.sh
/var/albius-crypttab.sh /var/albius-crypttab.sh
fi fi
echo 'LOCALE' | nc -U $SOCKET_PATH || true
# Generate locales # Generate locales
locale-gen || true locale-gen || true
# Setup keyboard and locales # Setup keyboard and locales
chmod +x /var/albius-lang_linux.sh chmod +x /var/albius-lang_linux.sh
/var/albius-lang_linux.sh /var/albius-lang_linux.sh
# Setup the refind bootloader # Setup the refind bootloader
echo 'BOOTLOADER' | nc -U $SOCKET_PATH || true
chmod +x /var/albius-refind_linux.sh chmod +x /var/albius-refind_linux.sh
/var/albius-refind_linux.sh /var/albius-refind_linux.sh
refind-install refind-install
@ -32,9 +39,11 @@ apt install -y /var/cache/apt/archives/pika-refind-theme*.deb /var/cache/apt/arc
mkdir -p /boot/efi/EFI/BOOT mkdir -p /boot/efi/EFI/BOOT
cp -vf /boot/efi/EFI/refind/refind_x64.efi /boot/efi/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
echo 'LIVE_REMOVE' | nc -U $SOCKET_PATH || true
apt remove live-boot pika-installer-gtk4 -y || true apt remove live-boot pika-installer-gtk4 -y || true
apt autoremove -y || true apt autoremove -y || true
# Create first setup user # Create first setup user
echo 'BASIC_USER' | nc -U $SOCKET_PATH || true
useradd -m -k -U pikaos || true useradd -m -k -U pikaos || true
echo pikaos:pikaos | chpasswd || true echo pikaos:pikaos | chpasswd || true
usermod -a -G sudo pikaos || true usermod -a -G sudo pikaos || true

View File

@ -1,15 +1,17 @@
#! /bin/bash #! /bin/bash
SOCKET_PATH="/tmp/pikainstall-status.sock"
# Mount host partitions to chroot # Mount host partitions to chroot
echo 'BIND' | nc -U $SOCKET_PATH || true
mkdir -pv "$1"/media/cdrom mkdir -pv "$1"/media/cdrom
mount --bind /cdrom "$1"/media/cdrom mount --bind /cdrom "$1"/media/cdrom
mount --bind /dev "$1/dev" mount --bind /dev "$1/dev"
mount -t tmpfs run "$1/run" -o mode=0755,nosuid,nodev mount -t tmpfs run "$1/run" -o mode=0755,nosuid,nodev
mount -t proc proc "$1/proc" -o nosuid,nodev,noexec mount -t proc proc "$1/proc" -o nosuid,nodev,noexec
mount -t sysfs sys "$1/sys" -o nosuid,nodev,noexec,ro mount -t sysfs sys "$1/sys" -o nosuid,nodev,noexec,ro
# Delete unwanted kernels
rm -rfv "$1"/boot/*arch*
# Copy cdrom pool to apt cache # Copy cdrom pool to apt cache
echo 'ARCH_COPY' | nc -U $SOCKET_PATH || true
mkdir -p "$1"/var/cache/apt/archives mkdir -p "$1"/var/cache/apt/archives
cp -rvf /cdrom/pool/main/* "$1"/var/cache/apt/archives/ cp -rvf /cdrom/pool/main/* "$1"/var/cache/apt/archives/
# Run Chroot Commands # Run Chroot Commands
@ -19,17 +21,20 @@ chroot "$1" /bin/bash -c "/usr/lib/pika/pikainstall/pika-install-chroot.sh"
# Setup Disk Encryption # Setup Disk Encryption
if [ -f /var/albius-crypttab-manual.sh ] if [ -f /var/albius-crypttab-manual.sh ]
then then
echo 'ENCRYPTION' | nc -U $SOCKET_PATH || true
chmod +x /var/albius-crypttab-manual.sh chmod +x /var/albius-crypttab-manual.sh
/var/albius-crypttab-manual.sh /var/albius-crypttab-manual.sh
fi fi
# Setup Swaps # Setup Swaps
if [ -f /tmp/pika-installer-gtk4-swaplist ] if [ -f /tmp/pika-installer-gtk4-swaplist ]
then then
echo 'SWAP' | nc -U $SOCKET_PATH || true
for i in $(cat /tmp/pika-installer-gtk4-swaplist) for i in $(cat /tmp/pika-installer-gtk4-swaplist)
do do
echo "UUID="$(blkid -s UUID -o value $i)" none swap sw 0 0" >> "$1"/etc/fstab echo "UUID="$(blkid -s UUID -o value $i)" none swap sw 0 0" >> "$1"/etc/fstab
done done
fi fi
echo 'UNBIND' | nc -U $SOCKET_PATH || true
# Unmount host partitions from chroot # Unmount host partitions from chroot
umount "$1/media/cdrom" || umount -lf "$1/media/cdrom" || true umount "$1/media/cdrom" || umount -lf "$1/media/cdrom" || true
umount "$1/dev" || umount -lf "$1/dev" || true umount "$1/dev" || umount -lf "$1/dev" || true

View File

@ -3,10 +3,10 @@
# import libs # import libs
import argparse import argparse
import subprocess import subprocess
import os, errno import os, errno, socket
# Version # Version
version="1.1.9" version="2.0.0"
dist="PikaOS 4" dist="PikaOS 4"
image="/run/live/medium/live/filesystem.squashfs" image="/run/live/medium/live/filesystem.squashfs"
@ -42,9 +42,9 @@ echo '{LUKS_PASSWD}' | cryptsetup luksAddKey UUID={HOME_PART_UUID} /keyfile.txt
""" """
_CRYPTTAB_MANUAL_SETUP_FILE = """#!/usr/bin/bash _CRYPTTAB_MANUAL_SETUP_FILE = """#!/usr/bin/bash
cat /tmp/pika-installer-gtk4-crypttab >> {CHROOT_PATH}/etc/crypttab cat /tmp/PIKA_CRYPT/crypttab >> {CHROOT_PATH}/etc/
cat {CHROOT_PATH}/etc/crypttab cat {CHROOT_PATH}/etc/crypttab
cp -rvf /key-*.txt {CHROOT_PATH}/ cp -rvf /tmp/PIKA_CRYPT/key-*.txt {CHROOT_PATH}/
""" """
_LANG_SETUP_FILE = """#!/usr/bin/bash _LANG_SETUP_FILE = """#!/usr/bin/bash
@ -54,7 +54,7 @@ update-locale LANG={LOCALE}
touch /etc/default/keyboard touch /etc/default/keyboard
echo 'XKBMODEL="pc105"' > /etc/default/keyboard echo 'XKBMODEL="pc105"' > /etc/default/keyboard
echo 'XKBLAYOUT="{KEYBOARD}"' >> /etc/default/keyboard echo 'XKBLAYOUT="{KEYBOARD}"' >> /etc/default/keyboard
echo 'XKBVARIANT=""' >> /etc/default/keyboard echo 'XKBVARIANT="{KVARIANT}"' >> /etc/default/keyboard
echo 'XKBOPTIONS=""' >> /etc/default/keyboard echo 'XKBOPTIONS=""' >> /etc/default/keyboard
echo 'BACKSPACE="guess"' >> /etc/default/keyboard echo 'BACKSPACE="guess"' >> /etc/default/keyboard
echo 'KEYMAP={KEYBOARD}' >> /etc/default/keyboard echo 'KEYMAP={KEYBOARD}' >> /etc/default/keyboard
@ -89,10 +89,13 @@ parser.add_argument("-k", "--keyboard", help="Choose what keyboard layout to use
parser.add_argument("-c", "--cryptkey", help="Luks passkey to /home.", metavar="password123", default=None, nargs=1) parser.add_argument("-c", "--cryptkey", help="Luks passkey to /home.", metavar="password123", default=None, nargs=1)
parser.add_argument("-m", "--manual", help="Is this a manual install for gui.", metavar="0", default=None, nargs=1) parser.add_argument("-m", "--manual", help="Is this a manual install for gui.", metavar="0", default=None, nargs=1)
parser.add_argument("-t", "--timezone", help="Choose what timezone to use.", metavar="America/New_York", default=argparse.SUPPRESS, required=True, nargs=1) parser.add_argument("-t", "--timezone", help="Choose what timezone to use.", metavar="America/New_York", default=argparse.SUPPRESS, required=True, nargs=1)
parser.add_argument("-kv", "--kvariant", help="Choose what keyboard variant to use.", metavar="dvorak", default=None, nargs=1)
args = parser.parse_args() args = parser.parse_args()
# Print all command-line arguments. # Print all command-line arguments.
socket_path = "/tmp/pikainstall-status.sock"
CHROOT_PATH = listToString(args.root[0]) CHROOT_PATH = listToString(args.root[0])
# Get root info # Get root info
@ -193,23 +196,31 @@ elif root_uuid != home_uuid:
# With All Checks Clear and info gathered let's start installing # With All Checks Clear and info gathered let's start installing
# extract the squashfs image to root from casper # extract the squashfs image to root from casper
subprocess.run(['touch', '/tmp/pika-installer-gtk4-status-image.txt']) try:
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client:
client.connect(socket_path)
client.sendall("IMAGE".encode('utf-8'))
except:
pass
squashfs_cmd = ['unsquashfs', '-f', '-d', CHROOT_PATH, image] squashfs_cmd = ['unsquashfs', '-f', '-d', CHROOT_PATH, image]
subprocess.run(squashfs_cmd) subprocess.run(squashfs_cmd)
# Enable bls_boot on boot partiton # Enable bls_boot on boot partiton
subprocess.run(['touch', '/tmp/pika-installer-gtk4-status-flag1.txt']) try:
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as client:
client.connect(socket_path)
client.sendall("FLAG".encode('utf-8'))
except:
pass
boot_flag_cmd = ['/usr/lib/pika/pikainstall/partition-helper.sh', 'flag', CHROOT_PATH + '/boot', 'bls_boot', 'on'] boot_flag_cmd = ['/usr/lib/pika/pikainstall/partition-helper.sh', 'flag', CHROOT_PATH + '/boot', 'bls_boot', 'on']
subprocess.run(boot_flag_cmd) subprocess.run(boot_flag_cmd)
# Enable esp on EFI partiton # Enable esp on EFI partiton
subprocess.run(['touch', '/tmp/pika-installer-gtk4-status-flag2.txt'])
efi_flag_cmd = ['/usr/lib/pika/pikainstall/partition-helper.sh', 'flag', CHROOT_PATH + '/boot/efi', 'esp', 'on'] efi_flag_cmd = ['/usr/lib/pika/pikainstall/partition-helper.sh', 'flag', CHROOT_PATH + '/boot/efi', 'esp', 'on']
subprocess.run(efi_flag_cmd) subprocess.run(efi_flag_cmd)
# Write crypttab script if system has encryption # Write crypttab script if system has encryption
if root_part_encrypt != "luks_none": if root_part_encrypt != "luks_none":
subprocess.run(['touch', '/tmp/pika-installer-gtk4-status-crypt.txt'])
CRYPTTAB_ROOT_FILE_PATH = '/var/albius-crypttab-root.sh' CRYPTTAB_ROOT_FILE_PATH = '/var/albius-crypttab-root.sh'
CHROOT_CRYPTTAB_ROOT_FILE_PATH = CHROOT_PATH+CRYPTTAB_ROOT_FILE_PATH CHROOT_CRYPTTAB_ROOT_FILE_PATH = CHROOT_PATH+CRYPTTAB_ROOT_FILE_PATH
print("writing to:") print("writing to:")
@ -225,7 +236,6 @@ if root_part_encrypt != "luks_none":
# Write crypttab script if system has encryption # Write crypttab script if system has encryption
if root_uuid != home_uuid and args.manual is None and home_passwd is not None : if root_uuid != home_uuid and args.manual is None and home_passwd is not None :
if home_part_encrypt != "luks_none": if home_part_encrypt != "luks_none":
subprocess.run(['touch', '/tmp/pika-installer-gtk4-status-crypt.txt'])
CRYPTTAB_FILE_PATH = '/var/albius-crypttab.sh' CRYPTTAB_FILE_PATH = '/var/albius-crypttab.sh'
CHROOT_CRYPTTAB_FILE_PATH = CHROOT_PATH+CRYPTTAB_FILE_PATH CHROOT_CRYPTTAB_FILE_PATH = CHROOT_PATH+CRYPTTAB_FILE_PATH
silentremove(CHROOT_CRYPTTAB_FILE_PATH) silentremove(CHROOT_CRYPTTAB_FILE_PATH)
@ -240,7 +250,6 @@ if root_uuid != home_uuid and args.manual is None and home_passwd is not None :
file.write(albius_crypttab_file) file.write(albius_crypttab_file)
if args.manual is not None and args.manual[0] == "2": if args.manual is not None and args.manual[0] == "2":
subprocess.run(['touch', '/tmp/pika-installer-gtk4-status-crypt.txt'])
CRYPTTAB_MANUAL_FILE_PATH = '/var/albius-crypttab-manual.sh' CRYPTTAB_MANUAL_FILE_PATH = '/var/albius-crypttab-manual.sh'
CHROOT_CRYPTTAB_MANUAL_FILE_PATH = CRYPTTAB_MANUAL_FILE_PATH CHROOT_CRYPTTAB_MANUAL_FILE_PATH = CRYPTTAB_MANUAL_FILE_PATH
silentremove(CHROOT_CRYPTTAB_MANUAL_FILE_PATH) silentremove(CHROOT_CRYPTTAB_MANUAL_FILE_PATH)
@ -252,27 +261,38 @@ if args.manual is not None and args.manual[0] == "2":
) )
file.write(albius_crypttab_manual_file) file.write(albius_crypttab_manual_file)
# Write lang script # Write lang script
if args.kvariant is not None:
LANG_FILE_PATH = '/var/albius-lang_linux.sh' LANG_FILE_PATH = '/var/albius-lang_linux.sh'
CHROOT_LANG_FILE_PATH = CHROOT_PATH+LANG_FILE_PATH CHROOT_LANG_FILE_PATH = CHROOT_PATH+LANG_FILE_PATH
silentremove(CHROOT_LANG_FILE_PATH) silentremove(CHROOT_LANG_FILE_PATH)
print("writing to:") print("writing to:")
print(CHROOT_LANG_FILE_PATH) print(CHROOT_LANG_FILE_PATH)
with open(CHROOT_LANG_FILE_PATH, "w") as file: with open(CHROOT_LANG_FILE_PATH, "w") as file:
subprocess.run(['touch', '/tmp/pika-installer-gtk4-status-lang.txt'])
lang_crypttab_file = _LANG_SETUP_FILE.format( lang_crypttab_file = _LANG_SETUP_FILE.format(
LOCALE=listToString(args.locale), LOCALE=listToString(args.locale),
KEYBOARD=listToString(args.keyboard), KEYBOARD=listToString(args.keyboard),
TIMEZONE=listToString(args.timezone), TIMEZONE=listToString(args.timezone),
KVARIANT=listToString(args.kvariant),
)
file.write(lang_crypttab_file)
else:
LANG_FILE_PATH = '/var/albius-lang_linux.sh'
CHROOT_LANG_FILE_PATH = CHROOT_PATH+LANG_FILE_PATH
silentremove(CHROOT_LANG_FILE_PATH)
print("writing to:")
print(CHROOT_LANG_FILE_PATH)
with open(CHROOT_LANG_FILE_PATH, "w") as file:
lang_crypttab_file = _LANG_SETUP_FILE.format(
LOCALE=listToString(args.locale),
KEYBOARD=listToString(args.keyboard),
TIMEZONE=listToString(args.timezone),
KVARIANT="",
) )
file.write(lang_crypttab_file) file.write(lang_crypttab_file)
# Write refind script # Write refind script
if root_part_encrypt == "luks_none": if root_part_encrypt == "luks_none":
subprocess.run(['touch', '/tmp/pika-installer-gtk4-status-boot.txt'])
REFIND_FILE_PATH = '/var/albius-refind_linux.sh' REFIND_FILE_PATH = '/var/albius-refind_linux.sh'
CHROOT_REFIND_FILE_PATH = CHROOT_PATH+REFIND_FILE_PATH CHROOT_REFIND_FILE_PATH = CHROOT_PATH+REFIND_FILE_PATH
silentremove(CHROOT_REFIND_FILE_PATH) silentremove(CHROOT_REFIND_FILE_PATH)
@ -284,7 +304,6 @@ if root_part_encrypt == "luks_none":
) )
file.write(refind_crypttab_file) file.write(refind_crypttab_file)
else: else:
subprocess.run(['touch', '/tmp/pika-installer-gtk4-status-boot.txt'])
REFIND_FILE_PATH = '/var/albius-refind_linux.sh' REFIND_FILE_PATH = '/var/albius-refind_linux.sh'
CHROOT_REFIND_FILE_PATH = CHROOT_PATH+REFIND_FILE_PATH CHROOT_REFIND_FILE_PATH = CHROOT_PATH+REFIND_FILE_PATH
silentremove(CHROOT_REFIND_FILE_PATH) silentremove(CHROOT_REFIND_FILE_PATH)
@ -299,7 +318,6 @@ else:
# Run pika-install-script # Run pika-install-script
subprocess.run(['touch', '/tmp/pika-installer-gtk4-status-post.txt'])
bind_dev_cmd = ['/usr/lib/pika/pikainstall/pika-install-host.sh', listToString(CHROOT_PATH)] bind_dev_cmd = ['/usr/lib/pika/pikainstall/pika-install-host.sh', listToString(CHROOT_PATH)]
subprocess.run(bind_dev_cmd) subprocess.run(bind_dev_cmd)