updated the installer so that it should actually work
Some checks failed
Build / build (push) Failing after 5m23s

This commit is contained in:
tumillanino
2025-11-11 18:57:02 +11:00
parent a7bd4d9457
commit 33dd952ad4
583 changed files with 161651 additions and 67 deletions

View File

@@ -0,0 +1,28 @@
BSD 3-Clause License
Copyright (c) 2023, Arkane Linux
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,2 @@
# os-installer-config-arkdep
Configuration files for [os-installer](https://gitlab.gnome.org/p3732/os-installer), Arkane Linux arkdep.

View File

@@ -0,0 +1,6 @@
label: gpt
unit: sectors
sector-size: 512
start= 2048, size= 2097152, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B
start= 2099200, type=4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709

Binary file not shown.

View File

@@ -0,0 +1,42 @@
%YAML 1.2
---
distribution_name: 'Arkane Linux'
internet_connection_required: yes
internet_checker_url: 'http://nmcheck.gnome.org/check_network_status.txt'
fixed_language: no
suggested_languages:
- 'de'
- 'en'
- 'es'
- 'fr'
- 'nl'
- 'uk'
welcome_page:
logo : '/usr/share/pixmaps/arkanelinux-logo.png'
text : 'Welcome to Arkane Linux!
This program will guide you through the installation process.
Althrough the live environment tries to imitate an actual install as best as possible it
still differs in many ways, Arkane Linux is best experienced on a full proper installation.'
usage : yes
minimum_disk_size: 64
offer_disk_encryption: yes
skip_user: yes
skip_locale: yes
failure_help_url: 'https://duckduckgo.com/?q="os-installer {}"+"failed installation"'
browser_cmd: 'firefox'
disks_cmd : 'gnome-disks'
wifi_cmd : 'gnome-control-center wifi'

View File

@@ -0,0 +1,7 @@
LABEL=arkane_root /home btrfs rw,relatime,subvol=arkdep/shared/home,compress=zstd 0 1
LABEL=arkane_root /root btrfs rw,relatime,subvol=arkdep/shared/root,compress=zstd 0 1
LABEL=arkane_root /arkdep btrfs rw,relatime,subvol=arkdep,compress=zstd 0 1
LABEL=arkane_root /var/lib/flatpak btrfs rw,relatime,subvol=arkdep/shared/flatpak,compress=zstd 0 1
LABEL=arkane_boot /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
/arkdep/shared/swapfile none swap defaults 0 0

View File

@@ -0,0 +1,2 @@
root:x:0:root
wheel:x:998:

View File

@@ -0,0 +1 @@
arkanelinux

View File

@@ -0,0 +1,57 @@
#!/usr/bin/env bash
set -o pipefail
## Set common variables
#
# Commonly used variables
declare -r workdir='/mnt'
declare -r osidir='/etc/os-installer'
declare -r scriptsdir="$osidir/scripts/configure.sh.d"
# Get target disk UUID
if [[ $OSI_DEVICE_IS_PARTITION -ne 0 ]]; then
declare -r uuid=$(sudo blkid -o value -s UUID ${OSI_DEVICE_PATH})
elif [[ $OSI_DEVICE_PATH == *"nvme"*"n"* ]]; then
declare -r uuid=$(sudo blkid -o value -s UUID ${OSI_DEVICE_PATH}p2)
else
declare -r uuid=$(sudo blkid -o value -s UUID ${OSI_DEVICE_PATH}2)
fi
# User can provide full name as input, if they do only the first word will be used as username
# OSI_USER_NAME is still used in the account comments
declare firstname=($OSI_USER_NAME)
firstname=${firstname[0]}
## Set common functions
#
# Quit script with error if called
quit_on_err () {
if [[ -n $1 ]]; then
printf "$1\n"
fi
# Ensure console prints error
sleep 2
exit 1
}
## Execute scripts
#
# Get list of all child scripts
declare -r scripts=($(ls $scriptsdir))
# Loop and run install scripts
for script in ${scripts[@]}; do
printf "Now running $script\n"
source $scriptsdir/$script
done
## Cleanup and finish
#
# Ensure synced and umount
sync
sudo umount -R /mnt
exit 0

View File

@@ -0,0 +1,27 @@
# Ensure user is in sudo group
for group in $(groups); do
if [[ $group == 'wheel' || $group == 'sudo' ]]; then
declare -ri sudo_ok=1
fi
done
# If user is not in sudo group notify and exit with error
if [[ ! -n $sudo_ok ]]; then
quit_on_err 'The current user is not a member of either the sudo or wheel group, this os-installer configuration requires sudo permissions'
fi
# Ensure all expected osi variables are set
[[ -z ${OSI_LOCALE+x} ]] && quit_on_err 'OSI_LOCALE not set'
[[ -z ${OSI_DEVICE_PATH+x} ]] && quit_on_err 'OSI_DEVICE_PATH not set'
[[ -z ${OSI_DEVICE_IS_PARTITION+x} ]] && quit_on_err 'OSI_DEVICE_OS_PARTITION is not set'
[[ -z ${OSI_DEVICE_EFI_PARTITION+x} ]] && quit_on_err 'OSI_DEVICE_EFI_PARTITION is not set'
[[ -z ${OSI_USE_ENCRYPTION+x} ]] && quit_on_err 'OSI_USE_ENCRYPTION is not set'
[[ -z ${OSI_ENCRYPTION_PIN+x} ]] && quit_on_err 'OSI_ENCRYPT_PIN is not set'
[[ -z ${OSI_USER_NAME+x} ]] && quit_on_err 'OSI_USER_NAME is not set'
[[ -z ${OSI_USER_AUTOLOGIN+x} ]] && quit_on_err 'OSI_USER_AUTOLOGIN is not set'
[[ -z ${OSI_USER_PASSWORD+x} ]] && quit_on_err 'OSI_USER_PASSWORD is not set'
[[ -z ${OSI_FORMATS+x} ]] && quit_on_err 'OSI_FORMATS is not set'
[[ -z ${OSI_TIMEZONE+x} ]] && quit_on_err 'OSI_TIMEZONE is not set'
[[ -z ${OSI_ADDITIONAL_SOFTWARE+x} ]] && quit_on_err 'OSI_ADDITIONAL_SOFTWARE is not set'
[[ -z ${OSI_ADDITIONAL_FEATURES+x} ]] && quit_on_err 'OSI_ADDITIONAL_FEATURES is not set'

View File

@@ -0,0 +1,5 @@
# Write overlay_arkdep
for f in $(ls $osidir/overlay_arkdep/); do
sudo cp -rv $osidir/overlay_arkdep/$f $workdir/arkdep/overlay/
done

View File

@@ -0,0 +1,2 @@
# Add GPG trusted keys to install
sudo cp -v $osidir/bits/trusted-keys $workdir/arkdep/keys/

View File

@@ -0,0 +1,19 @@
# Set custom keymap, very hacky but it gets the job done
declare -r current_keymap=$(gsettings get org.gnome.desktop.input-sources sources)
sudo mkdir -p $workdir/arkdep/overlay/etc/dconf/db/local.d
printf "[org/gnome/desktop/input-sources]\nsources = $current_keymap\n" |
sudo tee $workdir/arkdep/overlay/etc/dconf/db/local.d/keymap ||
quit_on_err 'Failed to set dconf keymap'
# Attempt to set vconsole keymap
data=${current_keymap#*(}
data=${data%%)*}
data=${data#*,}
data=${data//\'}
data=${data%%+*}
sudo localectl set-keymap $data
localctl_exit_code=$?
[[ $localctl_exit_code -ne 0 ]] && printf 'Failed to detect keymap, vconsole will default to US international'
[[ $localctl_exit_code -eq 0 ]] && sudo cp /etc/vconsole.conf $workdir/arkdep/overlay/etc/vconsole.conf

View File

@@ -0,0 +1,23 @@
# The kernel parameters have to be configured differently based upon if the
# user opted for disk encryption or not
if [[ $OSI_USE_ENCRYPTION == 1 ]]; then
# Overwrite default Arkdep systemd-boot template
cat <<- END | sudo tee $workdir/arkdep/templates/systemd-boot
title Arkane GNU/Linux - Arkdep
linux /arkdep/%target%/vmlinuz
initrd /amd-ucode.img
initrd /intel-ucode.img
initrd /arkdep/%target%/initramfs-linux.img
options rd.auto=0 rd.luks.name=$uuid=arkane_root root=/dev/mapper/arkane_root rootflags=subvol=/arkdep/deployments/%target%/rootfs lsm=landlock,lockdown,yama,integrity,apparmor,bpf quiet splash loglevel=3 systemd.show_status=auto rd.udev.log_level=3 rw
END
else
# Overwrite default Arkdep systemd-boot template
cat <<- END | sudo tee $workdir/arkdep/templates/systemd-boot
title Arkane GNU/Linux - Arkdep
linux /arkdep/%target%/vmlinuz
initrd /amd-ucode.img
initrd /intel-ucode.img
initrd /arkdep/%target%/initramfs-linux.img
options root="LABEL=arkane_root" rootflags=subvol=/arkdep/deployments/%target%/rootfs lsm=landlock,lockdown,yama,integrity,apparmor,bpf quiet splash loglevel=3 systemd.show_status=auto rd.udev.log_level=3 rw
END
fi

View File

@@ -0,0 +1,22 @@
# Deploy latest image
sudo ARKDEP_NO_BOOTCTL=1 ARKDEP_ROOT=$workdir arkdep deploy || quit_on_err 'Failed to deploy image with arkdep'
declare -r deployment_version=($(ls $workdir/arkdep/deployments))
# Collect information about the system memory, this is used to determine an apropriate swapfile size
declare -ri memtotal=$(grep MemTotal /proc/meminfo | awk '{print $2}')
# Determine suitable swapfile size
if [[ $memtotal -lt 4500000 ]]; then
# If RAM is less than 4.5GB create a 2GB swapfile
sudo btrfs filesystem mkswapfile --size 2G $workdir/arkdep/shared/swapfile ||
quit_on_err 'Failed to create swapfile'
elif [[ $memtotal -lt 8500000 ]]; then
# If RAM is less than 8.5GB, create a 4GB swapfile
sudo btrfs filesystem mkswapfile --size 4G $workdir/arkdep/shared/swapfile ||
quit_on_err 'Failed to create swapfile'
else
# Else create a 6GB swapfile
sudo btrfs filesystem mkswapfile --size 6G $workdir/arkdep/shared/swapfile ||
quit_on_err 'Failed to create swapfile'
fi

View File

@@ -0,0 +1,9 @@
declare -r deployment=($(ls $workdir/arkdep/deployments/))
sudo dconf compile $workdir/arkdep/overlay/etc/dconf/db/local \
$workdir/arkdep/deployments/${deployment[0]}/rootfs/etc/dconf/db/local.d/ ||
quit_on_err 'Failed to generate local dconf database'
sudo cp $workdir/arkdep/overlay/etc/dconf/db/local \
$workdir/arkdep/deployments/${deployment[0]}/rootfs/etc/dconf/db/local ||
quit_on_err 'Failed to copy dconf local db to deployment'

View File

@@ -0,0 +1,11 @@
sudo umount -R $workdir/boot
# Remove boot folder, it is just a temporary mount point
sudo rm -rf $workdir/boot
sync
sudo umount -R $workdir
# Give it some time to unmount
printf 'Waiting 10 seconds to ensure successful unmount...'
sleep 10

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
set -o pipefail
## Set common variables
#
# Commonly used variables
declare -r workdir='/mnt'
declare -r osidir='/etc/os-installer'
declare -r scriptsdir="$osidir/scripts/install.sh.d"
declare -r rootlabel='arkane_root'
declare -r bootlabel='arkane_boot'
## Set common functions
#
# Quit script with error if called
quit_on_err () {
if [[ -n $1 ]]; then
printf "$1\n"
fi
# Ensure console prints error
sleep 2
exit 1
}
## Execute scripts
#
# Get list of all child scripts
declare -r scripts=($(ls $scriptsdir))
# Loop and run install scripts
for script in ${scripts[@]}; do
printf "Now running $script\n"
source $scriptsdir/$script
done
exit 0

View File

@@ -0,0 +1,23 @@
# Ensure user is in sudo group
for group in $(groups); do
if [[ $group == 'wheel' || $group == 'sudo' ]]; then
declare -ri sudo_ok=1
fi
done
# If user is not in sudo group notify and exit with error
if [[ ! -n $sudo_ok ]]; then
quit_on_err 'The current user is not a member of either the sudo or wheel group, this os-installer configuration requires sudo permissions'
fi
# Ensure all expected osi variables are set
[[ -z ${OSI_LOCALE+x} ]] && quit_on_err 'OSI_LOCALE not set'
[[ -z ${OSI_DEVICE_PATH+x} ]] && quit_on_err 'OSI_DEVICE_PATH not set'
[[ -z ${OSI_DEVICE_IS_PARTITION+x} ]] && quit_on_err 'OSI_DEVICE_IS_PARTITION not set'
[[ -z ${OSI_DEVICE_EFI_PARTITION+x} ]] && quit_on_err 'OSI_DEVICE_EFI_PARTITION not set'
[[ -z ${OSI_USE_ENCRYPTION+x} ]] && quit_on_err 'OSI_USE_ENCRYPTION not set'
[[ -z ${OSI_ENCRYPTION_PIN+x} ]] && quit_on_err 'OSI_ENCRYPTION_PIN not set'
# Check if something is already mounted to $workdir
mountpoint -q $workdir &&
quit_on_err "$workdir is already a mountpoint, unmount this directory and try again"

View File

@@ -0,0 +1,99 @@
# Write partition table to the disk unless manual partitioning is used
if [[ $OSI_DEVICE_IS_PARTITION -eq 0 ]]; then
sudo sfdisk $OSI_DEVICE_PATH < $osidir/bits/part.sfdisk ||
quit_on_err 'Failed to write partition table to disk'
fi
# NVMe drives follow a slightly different naming scheme to other block devices
# this will change `/dev/nvme0n1` to `/dev/nvme0n1p` for easier parsing later
if [[ $OSI_DEVICE_IS_PARTITION -ne 0 ]]; then
declare -r partition_path="${OSI_DEVICE_PATH}"
elif [[ $OSI_DEVICE_PATH == *"nvme"*"n"* ]]; then
declare -r partition_path="${OSI_DEVICE_PATH}p"
elif [[ $OSI_DEVICE_PATH == *"mmcblk"* ]]; then
declare -r partition_path="${OSI_DEVICE_PATH}p"
else
declare -r partition_path="${OSI_DEVICE_PATH}"
fi
# Check if encryption is requested, write filesystems accordingly
if [[ $OSI_USE_ENCRYPTION -eq 1 ]]; then
# If user requested disk encryption
if [[ $OSI_DEVICE_IS_PARTITION -eq 0 ]]; then
# If target is a drive
sudo mkfs.fat -F32 ${partition_path}1 -n $bootlabel || quit_on_err "Failed to create FAT filesystem on ${partition_path}1"
echo $OSI_ENCRYPTION_PIN | sudo cryptsetup -q luksFormat ${partition_path}2 ||
quit_on_err "Failed to create LUKS partition on ${partition_path}2"
echo $OSI_ENCRYPTION_PIN | sudo cryptsetup open ${partition_path}2 $rootlabel - ||
quit_on_err 'Failed to unlock LUKS partition'
sudo mkfs.btrfs -f -L $rootlabel /dev/mapper/$rootlabel ||
quit_on_err 'Failed to create Btrfs partition on LUKS'
sudo mount -o compress=zstd /dev/mapper/$rootlabel $workdir ||
quit_on_err "Failed to mount LUKS/Btrfs root partition to $workdir"
sudo mount --mkdir ${partition_path}1 $workdir/boot ||
quit_on_err 'Failed to mount boot'
else
# If target is a partition
sudo mkfs.fat -F32 $OSI_DEVICE_EFI_PARTITION -n $bootlabel ||
quit_on_err "Failed to create FAT filesystem on $OSI_DEVICE_EFI_PARTITION"
echo $OSI_ENCRYPTION_PIN | sudo cryptsetup -q luksFormat $OSI_DEVICE_PATH ||
quit_on_err "Failed to create LUKS partition on $OSI_DEVICE_PATH"
echo $OSI_ENCRYPTION_PIN | sudo cryptsetup open $OSI_DEVICE_PATH $rootlabel - ||
quit_on_err 'Failed to unlock LUKS partition'
sudo mkfs.btrfs -f -L $rootlabel /dev/mapper/$rootlabel ||
quit_on_err 'Failed to create Btrfs partition on LUKS'
sudo mount -o compress=zstd /dev/mapper/$rootlabel $workdir ||
quit_on_err "Failed to mount LUKS/Btrfs root partition to $workdir"
sudo mount --mkdir $OSI_DEVICE_EFI_PARTITION $workdir/boot ||
quit_on_err 'Failed to mount boot'
fi
else
# If no disk encryption requested
if [[ $OSI_DEVICE_IS_PARTITION -eq 0 ]]; then
# If target is a drive
sudo mkfs.fat -F32 ${partition_path}1 -n $bootlabel ||
quit_on_err "Failed to create FAT filesystem on ${partition_path}1"
sudo mkfs.btrfs -f -L $rootlabel ${partition_path}2 ||
quit_on_err "Failed to create root on ${partition_path}2"
sudo mount -o compress=zstd ${partition_path}2 $workdir ||
quit_on_err "Failed to mount root to $workdir"
sudo mount --mkdir ${partition_path}1 $workdir/boot ||
quit_on_err 'Failed to mount boot'
else
# If target is a partition
sudo mkfs.fat -F32 $OSI_DEVICE_EFI_PARTITION -n $bootlabel ||
quit_on_err "Failed to create FAT filesystem on $OSI_EFI_PARTITION"
sudo mkfs.btrfs -f -L $rootlabel $OSI_DEVICE_PATH ||
quit_on_err "Failed to create root on $OSI_DEVICE_PATH"
sudo mount -o compress=zstd $OSI_DEVICE_PATH $workdir ||
quit_on_err "Failed to mount root to $workdir"
sudo mount --mkdir $OSI_DEVICE_EFI_PARTITION $workdir/boot ||
quit_on_err 'Failed to mount boot'
fi
fi
# Ensure partitions are mounted, quit and error if not
for mountpoint in $workdir $workdir/boot; do
mountpoint -q $mountpoint ||
quit_on_err "No volume mounted to $mountpoint"
done

View File

@@ -0,0 +1,14 @@
# Manually install the systemd-boot bootloader
sudo mkdir -p $workdir/boot/EFI/{BOOT,systemd} $workdir/boot/loader/entries ||
quit_on_err 'Failed to create bootloader directories'
# TODO: Grab this from the image instead?
sudo cp /usr/lib/systemd/boot/efi/systemd-bootx64.efi $workdir/boot/EFI/systemd/ ||
quit_on_err 'Failed to copy systemd-boot bootloader to systemd-bootx64.efi'
sudo cp /usr/lib/systemd/boot/efi/systemd-bootx64.efi $workdir/boot/EFI/BOOT/BOOTx64.EFI ||
quit_on_err 'Failed to copy systemd-boot bootloader to BOOTx64.EFI'
printf 'timeout 5\nconsole-mode max\neditor yes\nauto-entries yes\nauto-firmware yes' |
sudo tee $workdir/boot/loader/loader.conf ||
quit_on_err 'Failed to create loader.conf'

View File

@@ -0,0 +1,3 @@
# Initialize arkdep
sudo ARKDEP_NO_BOOTCTL=1 ARKDEP_ROOT="$workdir" arkdep init ||
quit_on_err 'Failed to init arkep'

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -o pipefail
## Generic checks
#
# Ensure user is in sudo group
for group in $(groups); do
if [[ $group == 'wheel' || $group == 'sudo' ]]; then
declare -ri sudo_ok=1
fi
done
# If user is not in sudo group notify and exit with error
if [[ ! -n $sudo_ok ]]; then
printf 'The current user is not a member of either the sudo or wheel group, this os-installer configuration requires sudo permissions\n'
exit 1
fi
exit 0