feat(iso): Use jq only after it's installed (#7)

This commit is contained in:
hygienic-books 2023-10-23 02:16:02 +02:00
parent 2f41de67c6
commit d685431684

View File

@ -44,8 +44,45 @@ function we_are_changerooted () {
fi
}
function uefi_or_bios () {
function no_kernel_update_in_iso () {
#1.1
sed -ri -e 's'$'\x1''#(IgnorePkg)[^\r\n\f]+'$'\x1''\1 = linux linux-headers'$'\x1''g' /etc/pacman.conf
}
function set_ntp () {
#1.2
timedatectl set-ntp true
}
function resize_cow_space () {
#1.3
mount -o remount,size='50%' /run/archiso/cowspace
}
function update_pacman_db () {
#1.4
printf -- '%s\n' 'Refreshing mirror list ...'
systemctl start reflector
# In an ISO and for the minimal number of packages we need we do not
# care about partial upgrades
pacman -Syyuu --noconfirm
}
function install_pkgs () {
#1.5
printf -- '%s\n' 'Installing packages ...'
pacman -S --needed --noconfirm "${@}"
}
function install_zfs () {
#1.6
declare reset_colors='\033[0m'
curl -s 'https://raw.githubusercontent.com/eoli3n/archiso-zfs/master/init' | bash
printf -- "${reset_colors}"
}
function uefi_or_bios () {
#1.7
local part_count_linux part_count_efi
# Select disks with at least one partition. Among them count how many
# with the given partition type code we have.
@ -72,43 +109,6 @@ function uefi_or_bios () {
fi
}
function no_kernel_update_in_iso () {
#1.2
sed -ri -e 's'$'\x1''#(IgnorePkg)[^\r\n\f]+'$'\x1''\1 = linux linux-headers'$'\x1''g' /etc/pacman.conf
}
function set_ntp () {
#1.3
timedatectl set-ntp true
}
function resize_cow_space () {
#1.4
mount -o remount,size='50%' /run/archiso/cowspace
}
function update_pacman_db () {
#1.5
printf -- '%s\n' 'Refreshing mirror list ...'
systemctl start reflector
# In an ISO and for the minimal number of packages we need we do not
# care about partial upgrades
pacman -Syyuu --noconfirm
}
function install_pkgs () {
#1.6
printf -- '%s\n' 'Installing packages ...'
pacman -S --needed --noconfirm "${@}"
}
function install_zfs () {
#1.7
declare reset_colors='\033[0m'
curl -s 'https://raw.githubusercontent.com/eoli3n/archiso-zfs/master/init' | bash
printf -- "${reset_colors}"
}
function get_partitions () {
declare partitions_json
partitions_json="$(lsblk --output PATH,PARTTYPE --json --tree)" || return 1
@ -873,13 +873,13 @@ function main () {
if we_are_changerooted; then
install_os_in_chroot #2.2
else
uefi_or_bios #1.1
no_kernel_update_in_iso #1.2
set_ntp #1.3
resize_cow_space #1.4
update_pacman_db #1.5
install_pkgs 'jq' #1.6
install_zfs #1.7
no_kernel_update_in_iso #1.1
set_ntp #1.2
resize_cow_space #1.3
update_pacman_db #1.4
install_pkgs 'jq' #1.5
install_zfs #1.6
uefi_or_bios #1.7
setup_zpool #1.8
mount_system #1.9
copy_zpool_cache #1.10