updated the installer so that it should actually work
Some checks failed
Build / build (push) Failing after 5m23s
Some checks failed
Build / build (push) Failing after 5m23s
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# Add GPG trusted keys to install
|
||||
sudo cp -v $osidir/bits/trusted-keys $workdir/arkdep/keys/
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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'
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user