Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:vlefebvre:unified:images
openSUSE-Tumbleweed-UKI
disk.sh
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File disk.sh of Package openSUSE-Tumbleweed-UKI
#!/bin/bash set -euxo pipefail # ============================================================================= # Put typecode to 8304 needed by the discovery tool by systemd (gpt-auto-root) # ============================================================================= root_dev=$(basename "$(findmnt / -n --output SOURCE | cut -d '[' -f1)") dev_path="/dev/${root_dev%*p?}" root_part=${root_dev: -1} echo "Change the partition n°${root_part} type of ${dev_path} in 8304" sgdisk -t "$root_part:8304" "$dev_path" # ============================================================================= # ============================================================================= # Install the UKI in the boot partition and add boot menu entry # ============================================================================= chroot_uname=$(find /lib/modules/*/vmlinuz | head -n 1 \ | sed -e 's|/lib/modules/\(.*\)/vmlinuz|\1|g') efi_dir="/boot/efi/EFI/opensuse" kernel_module_dir="/usr/lib/modules/$chroot_uname" efi_file=$(basename "$kernel_module_dir"/uki-default-*.efi) if [ -e "$efi_file" ]; then kernel_module_dir="/lib/modules/$chroot_uname" efi_file=$(basename "$kernel_module_dir"/uki-default-*.efi) fi if [ -e "$efi_file" ]; then echo "No efi file installed" exit 1 fi # Install UKI in efi partition if [[ ! -d "$efi_dir" ]]; then mkdir -p "$efi_dir" fi cp "${kernel_module_dir}/${efi_file}" "${efi_dir}/${efi_file}" # ============================================================================= # ============================================================================= # Add the menu entry # ============================================================================= arch="$(uname -m)" case "$arch" in aarch64) arch=aa64 ;; x86_64) arch=x64 ;; *) echo "Unknown arch $arch"; exit 1 ;; esac if [ $(command -v sdbootutil) ] && [ "$(sdbootutil --arch $arch bootloader)" == "systemd-boot" ]; then # Do sdboot stuff echo "#####DISK - sdboot" #rootuuid=$(findmnt / -n --output uuid) #sed -i -e "s,\$, root=UUID=$rootuuid," /etc/kernel/cmdline uki-tool sdboot \ --add \ -k ${chroot_uname} \ --uki ${efi_file} \ --arch ${arch} \ --efi EFI/opensuse \ --default else echo "#####DISK - grub2" chmod -x /etc/grub.d/10_linux uki-tool grub2 \ --add \ -k ${chroot_uname} \ --uki ${kernel_module_dir}/${efi_file} \ --efi EFI/opensuse \ --default fi # =============================================================================
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor