From 00b2109e6fe6f07cb364422826a0f0e8753225ad Mon Sep 17 00:00:00 2001 From: Denis Benato Date: Wed, 4 Dec 2024 21:03:19 +0100 Subject: [PATCH 1/5] Use the refactored frzr --- build-iso.sh | 10 +- chimeraos/airootfs/root/install.sh | 14 +- chimeraos/airootfs/usr/bin/__frzr-deploy | 391 ---------------------- chimeraos/airootfs/usr/bin/frzr-bootstrap | 89 ----- chimeraos/airootfs/usr/bin/frzr-deploy | 16 - chimeraos/airootfs/usr/bin/frzr-initramfs | 134 -------- chimeraos/airootfs/usr/bin/frzr-release | 10 - chimeraos/airootfs/usr/bin/frzr-tweaks | 24 -- chimeraos/packages.x86_64 | 3 +- chimeraos/profiledef.sh | 6 - 10 files changed, 19 insertions(+), 678 deletions(-) delete mode 100644 chimeraos/airootfs/usr/bin/__frzr-deploy delete mode 100755 chimeraos/airootfs/usr/bin/frzr-bootstrap delete mode 100755 chimeraos/airootfs/usr/bin/frzr-deploy delete mode 100755 chimeraos/airootfs/usr/bin/frzr-initramfs delete mode 100755 chimeraos/airootfs/usr/bin/frzr-release delete mode 100755 chimeraos/airootfs/usr/bin/frzr-tweaks diff --git a/build-iso.sh b/build-iso.sh index 8a6a4e0..a3e062d 100755 --- a/build-iso.sh +++ b/build-iso.sh @@ -22,19 +22,19 @@ mkdir -p "${temp_dir}" # add AUR packages to the build AUR_PACKAGES="\ + frzr-git \ rtl88x2bu-dkms-git \ rtw89-dkms-git \ r8152-dkms \ rtl8812au-dkms-git \ rtl8814au-dkms-git \ rtl8821au-dkms-git \ - rz608-fix-git \ - inputplumber-bin \ + rz608-fix-git " ADDITIONAL_PACKAGES="\ - https://github.com/ChimeraOS/linux-chimeraos/releases/download/v6.10.3-chos1-1/linux-chimeraos-6.10.3.chos1-1-x86_64.pkg.tar.zst \ - https://github.com/ChimeraOS/linux-chimeraos/releases/download/v6.10.3-chos1-1/linux-chimeraos-headers-6.10.3.chos1-1-x86_64.pkg.tar.zst \ + https://github.com/ChimeraOS/linux-chimeraos/releases/download/v6.12.1-chos1-2/linux-chimeraos-6.12.1.chos1-2-x86_64.pkg.tar.zst \ + https://github.com/ChimeraOS/linux-chimeraos/releases/download/v6.12.1-chos1-2/linux-chimeraos-headers-6.12.1.chos1-2-x86_64.pkg.tar.zst \ " # create repo directory if it doesn't exist yet @@ -47,6 +47,8 @@ if [ -n "${BUILD_USER}" ]; then PIKAUR_RUN=(su "${BUILD_USER}" -c "${PIKAUR_CMD}") fi +pacman --noconfirm -S --overwrite '*' --disable-download-timeout ${PACKAGES} + # build packages to the repo pushd /home/${BUILD_USER} "${PIKAUR_RUN[@]}" diff --git a/chimeraos/airootfs/root/install.sh b/chimeraos/airootfs/root/install.sh index 8bcb379..e7da89e 100755 --- a/chimeraos/airootfs/root/install.sh +++ b/chimeraos/airootfs/root/install.sh @@ -237,8 +237,17 @@ Do you wish to proceed?" 15 70); then cancel_install fi +export SHOW_UI=1 +export FRZR_INSTALLER=1 +export MOUNT_PATH="/tmp/frzr_root" +export EFI_MOUNT_PATH="/tmp/frzr_root/efi" +export SWAP_GIB=0 +export SYSTEMD_RELAX_ESP_CHECKS=1 + # perform bootstrap of disk -if ! frzr-bootstrap gamer /dev/${DISK}; then +frzr bootstrap gamer /dev/${DISK} +RESULT=$? +if [ "${RESULT}" != "0" ]; then whiptail --msgbox "System bootstrap step failed." 10 50 cancel_install fi @@ -252,8 +261,7 @@ if [ -d ${SYS_CONN_DIR} ] && [ -n "$(ls -A ${SYS_CONN_DIR})" ]; then ${MOUNT_PATH}${SYS_CONN_DIR}/. fi -export SHOW_UI=1 -frzr-deploy chimeraos/chimeraos:${TARGET} +frzr deploy chimeraos/chimeraos:${TARGET} RESULT=$? MSG="Installation failed." diff --git a/chimeraos/airootfs/usr/bin/__frzr-deploy b/chimeraos/airootfs/usr/bin/__frzr-deploy deleted file mode 100644 index 0b2fa67..0000000 --- a/chimeraos/airootfs/usr/bin/__frzr-deploy +++ /dev/null @@ -1,391 +0,0 @@ -#! /bin/bash - -set -e -set -o pipefail - -get_img_url() { - CHANNEL=$1 - - # Order by creation date in reverse - result=$(jq 'sort_by(.created_at) | reverse') - - # Remove entries which have not been completed uploading - result=$(echo "${result}" | jq 'del(.[] | select(.assets[].state != "uploaded"))') - - # Always check for stable date - if stable_release_date=$(echo "${result}" | jq -er '[ .[] | - select(.prerelease==false) ] | - first | - .created_at' - ); then - # Check for stable url, this is the latest that have prerelease == false - stable_download_url=$(echo "${result}" | jq -r '[ .[] | - select(.prerelease==false) ] | - first | - .assets[] | - select(.browser_download_url | test("img")) | - .browser_download_url' - ) - else - # No stable channel found, pick some (old) values - # For testing/ channel selection - stable_release_date="1970-01-01T00:00:00Z" - stable_download_url="" - fi - - - # Filter channels by release naming conventions - if [[ "$CHANNEL" =~ ^[0-9]+\-?[0-9]*$ ]] ; then - # Check first for explicit version numbers between stable releases - # Useful for downgrading - result=$(echo "${result}" | jq -r "[ .[] | - select(.prerelease==false) | - select(.name|test(\" ${CHANNEL}\$\")) ] | - first | - .assets[] | - select(.browser_download_url | test(\"img\")) | - .browser_download_url" - ) - elif [ "$CHANNEL" == "stable" ]; then - result=$stable_download_url - elif [ "$CHANNEL" == "testing" ]; then - # Testing channel have prerelease = true and no other tags - if testing_release_date=$(echo "${result}" | jq -er '[ .[] | - select(.prerelease==true) | - select(.name|test("\\[.*\\]")|not) ] | - first | - .created_at' - ); then - testing_url=$(echo "${result}" | jq -r '[ .[] | - select(.prerelease==true) | - select(.name|test("\\[.*\\]")|not) ] | - first | - .assets[] | - select(.browser_download_url | test("img")) | - .browser_download_url' - ) - if [ $(date -d $testing_release_date +%s) -le $(date -d $stable_release_date +%s) ]; then - result=$stable_download_url - else - result=$testing_url - fi - else - result=$stable_download_url - fi - else - # Match any release with CHANNEL as a tag (including unstable) - result=$(echo ${result} | jq "[ .[] | select(.prerelease==true) | select(.name|test(\"\\\[${CHANNEL}\\\]\" ; \"i\")) ]") - if unstable_release_date=$(echo "${result}" | jq -er "[ .[] | - select(.prerelease==true) | - select(.name|test(\"\\\[${CHANNEL}\\\]\" ; \"i\")) ] | - first | - .created_at" - ); then - unstable_url=$(echo "${result}" | jq -r "[ .[] | - select(.prerelease==true) | - select(.name|test(\"\\\[${CHANNEL}\\\]\" ; \"i\")) ] | - first | - .assets[] | - select(.browser_download_url | test(\"img\")) | - .browser_download_url" - ) - if [ $(date -d $unstable_release_date +%s) -le $(date -d $stable_release_date +%s) ]; then - result=$stable_download_url - else - result=$unstable_url - fi - else - result=$stable_download_url - fi - fi - - echo $result -} - -get_boot_cfg() { - local version=${1} - local amd_ucode=${2} - local intel_ucode=${3} - local additional_arguments=${4} - -echo "title ${version} -linux /${version}/vmlinuz-linux -${amd_ucode} -${intel_ucode} -initrd /${version}/initramfs-linux.img -options root=LABEL=frzr_root rw rootflags=subvol=deployments/${version} quiet splash loglevel=3 rd.systemd.show_status=auto rd.udev.log_priority=3 ${additional_arguments}" - -} - -get_deployment_to_delete() { - local current_version=${1} - local boot_cfg_path=${2} - local deployment_path=${3} - - local TO_BOOT=`get_next_boot_deployment ${current_version} ${boot_cfg_path}` - - ls -1 ${deployment_path} | grep -v ${current_version} | grep -v ${TO_BOOT} | head -1 || echo -} - -get_next_boot_deployment() { - local current_version=${1} - local boot_cfg_path=${2} - - local TO_BOOT='this-is-not-a-valid-version-string' - if [ -f "${boot_cfg_path}" ] && grep "^title" "${boot_cfg_path}" > /dev/null; then - TO_BOOT=`grep ^title ${boot_cfg_path} | sed 's/title //'` - fi - - echo ${TO_BOOT} -} - -clean_progress() { - local scale=$1 - local postfix=$2 - local last_value=$scale - while IFS= read -r line; do - value=$(( ${line}*${scale}/100 )) - if [ "$last_value" != "$value" ]; then - echo ${value}${postfix} - last_value=$value - fi - done -} - - -main() { - if [ $EUID -ne 0 ]; then - echo "$(basename $0) must be run as root" - exit 1 - fi - - FRZR_CHECK_UPDATE=0 - FRZR_STEAM_PROGRESS=0 - FRZR_SOURCE="" - FRZR_PARAMS="" - - while (( "$#" )); do - case $1 in - --check) - FRZR_CHECK_UPDATE=1 - shift - ;; - --steam-progress) - FRZR_STEAM_PROGRESS=1 - shift - ;; - -*|--*) - echo "Unknown argument $1" - exit 1 - ;; - *) # preserve positional arguments - FRZR_PARAMS="${FRZR_PARAMS}$1 " # Use trailing space for the match below - shift - ;; - esac - done - - if [ ! -d /sys/firmware/efi/efivars ]; then - echo "Legacy BIOS installs are not supported. Aborting." - exit 1 - fi - - # keep only the first param as source - FRZR_SOURCE="${FRZR_PARAMS%% *}" - - MOUNT_PATH=/frzr_root - - if ! mountpoint -q ${MOUNT_PATH}; then - MOUNT_PATH=/tmp/frzr_root - fi - - if ! mountpoint -q ${MOUNT_PATH}; then - mkdir -p ${MOUNT_PATH} - mount -L frzr_root ${MOUNT_PATH} - sleep 5 - fi - - if ! mountpoint -q ${MOUNT_PATH}/boot && ls -1 /dev/disk/by-label | grep frzr_efi > /dev/null; then - mkdir -p ${MOUNT_PATH}/boot - mount -L frzr_efi ${MOUNT_PATH}/boot - sleep 5 - fi - - DEPLOY_PATH=${MOUNT_PATH}/deployments - mkdir -p ${DEPLOY_PATH} - - BOOT_CFG="${MOUNT_PATH}/boot/loader/entries/frzr.conf" - mkdir -p ${MOUNT_PATH}/boot/loader/entries - - # delete deployments under these conditions: - # - we are currently running inside a frzr deployment (i.e. not during install) - # - the deployment is not currently running - # - the deployment is not configured to be run on next boot - if frzr-release > /dev/null; then - CURRENT=`frzr-release` - TO_DELETE=`get_deployment_to_delete ${CURRENT} ${BOOT_CFG} ${DEPLOY_PATH}` - - if [ ! -z ${TO_DELETE} ]; then - echo "deleting ${TO_DELETE}..." - btrfs subvolume delete ${DEPLOY_PATH}/${TO_DELETE} || true - rm -rf ${MOUNT_PATH}/boot/${TO_DELETE} - fi - fi - - if [ ! -z "$FRZR_SOURCE" ] && [ "$FRZR_SOURCE" != " " ] && [ $FRZR_CHECK_UPDATE -eq 0 ] && [ $FRZR_STEAM_PROGRESS -eq 0 ]; then - echo "$FRZR_SOURCE" > "${MOUNT_PATH}/source" - fi - - if [ -e "${MOUNT_PATH}/source" ]; then - SOURCE=`cat "${MOUNT_PATH}/source" | head -1` - else - echo "WARNING: source wasn't specified" - fi - - if [ "${local_install}" == true ]; then - mkdir tmp_source - mount -o rw -L FRZR_UPDATE /root/tmp_source - FILE_NAME=$(basename /root/tmp_source/*.img.tar.xz*) - NAME=$(echo "${FILE_NAME}" | cut -f 1 -d '.') - SUBVOL="${DEPLOY_PATH}/${NAME}" - IMG_FILE="/root/tmp_source/${FILE_NAME}" - elif [[ "$FRZR_SOURCE" == *".img.tar.xz" ]]; then - FILE_NAME=$(basename ${FRZR_SOURCE}) - NAME=$(echo "${FILE_NAME}" | cut -f 1 -d '.') - SUBVOL="${DEPLOY_PATH}/${NAME}" - IMG_FILE=${FRZR_SOURCE} - elif [[ "$FRZR_SOURCE" == *".img" ]]; then - FILE_NAME=$(basename ${FRZR_SOURCE}) - NAME=$(echo "${FILE_NAME}" | cut -f 1 -d '.') - SUBVOL="${DEPLOY_PATH}/${NAME}" - IMG_FILE=${FRZR_SOURCE} - else - REPO=$(echo "${SOURCE}" | cut -f 1 -d ':') - CHANNEL=$(echo "${SOURCE}" | cut -f 2 -d ':') - - RELEASES_URL="https://api.github.com/repos/${REPO}/releases" - - IMG_URL=$(curl --http1.1 -L -s "${RELEASES_URL}" | get_img_url "${CHANNEL}") - - if [ -z "$IMG_URL" ] || [ "$IMG_URL" == "null" ]; then - echo "No matching source found" - if curl --http1.1 -L -s "${RELEASES_URL}" | grep "rate limit" > /dev/null; then - echo "GitHub API rate limit exceeded" - exit 29 - fi - exit 1 - fi - - FILE_NAME=$(basename ${IMG_URL}) - NAME=$(echo "${FILE_NAME}" | cut -f 1 -d '.') - BASE_URL=$(dirname "${IMG_URL}") - CHECKSUM=$(curl --http1.1 -L -s "${BASE_URL}/sha256sum.txt" | cut -f -1 -d ' ') - SUBVOL="${DEPLOY_PATH}/${NAME}" - IMG_FILE="${MOUNT_PATH}/${FILE_NAME}" - - if [ -e ${SUBVOL} ]; then - echo "${NAME} already installed; aborting" - exit 7 # let Steam know there is no update available - fi - - if [ $FRZR_CHECK_UPDATE -eq 1 ]; then - echo "Update available: ${NAME}" - exit 0 # let Steam know there is an update available - fi - - if [ $FRZR_STEAM_PROGRESS -eq 1 ]; then - curl --http1.1 -# -L -o "${IMG_FILE}" -C - "${IMG_URL}" 2>&1 | \ - stdbuf -oL tr '\r' '\n' | grep --line-buffered -oP '[0-9]*+(?=.[0-9])' | clean_progress 91 % - elif [ -z ${SHOW_UI} ]; then - echo "downloading ${NAME}..." - curl --http1.1 -L -o "${IMG_FILE}" -C - "${IMG_URL}" - else - curl --http1.1 -# -L -o "${IMG_FILE}" -C - "${IMG_URL}" 2>&1 | \ - stdbuf -oL tr '\r' '\n' | grep --line-buffered -oP '[0-9]*+(?=.[0-9])' | clean_progress 100 | \ - whiptail --gauge "Downloading system image (${NAME})" 10 50 0 - fi - - CHECKSUM2=`sha256sum "${IMG_FILE}" | cut -d' ' -f 1` - if [ "$CHECKSUM" != "$CHECKSUM2" ]; then - rm -f "${IMG_FILE}" - echo "checksum does not match; aborting" - exit 1 - fi - fi - - if [ -z ${SHOW_UI} ]; then - echo "installing ${NAME}..." - else - whiptail --infobox "Extracting and installing system image (${NAME}). This may take some time." 10 50 - fi - - if [[ "${IMG_FILE##*.}" == "img" ]]; then - btrfs receive --quiet ${DEPLOY_PATH} < ${IMG_FILE} - else - tar xfO ${IMG_FILE} | btrfs receive --quiet ${DEPLOY_PATH} - fi - - mkdir -p ${MOUNT_PATH}/boot/${NAME} - cp ${SUBVOL}/boot/vmlinuz-linux ${MOUNT_PATH}/boot/${NAME} - cp ${SUBVOL}/boot/initramfs-linux.img ${MOUNT_PATH}/boot/${NAME} - - AMD_UCODE="" - if [ -e ${SUBVOL}/boot/amd-ucode.img ] ; then - cp ${SUBVOL}/boot/amd-ucode.img ${MOUNT_PATH}/boot/${NAME} - AMD_UCODE="initrd /${NAME}/amd-ucode.img" - fi - - INTEL_UCODE="" - if [ -e ${SUBVOL}/boot/intel-ucode.img ] ; then - cp ${SUBVOL}/boot/intel-ucode.img ${MOUNT_PATH}/boot/${NAME} - INTEL_UCODE="initrd /${NAME}/intel-ucode.img" - fi - - ADDITIONAL_ARGUMENTS="" - if [ -e ${SUBVOL}/usr/lib/frzr.d/bootconfig.conf ] ; then - ADDITIONAL_ARGUMENTS="$ADDITIONAL_ARGUMENTS $(cat ${SUBVOL}/usr/lib/frzr.d/bootconfig.conf)" - fi - - get_boot_cfg "${NAME}" "${AMD_UCODE}" "${INTEL_UCODE}" "${ADDITIONAL_ARGUMENTS}" > ${BOOT_CFG} - echo "default frzr.conf" > ${MOUNT_PATH}/boot/loader/loader.conf - - # Check if there are migrations available - if compgen -G "${SUBVOL}"/usr/lib/frzr.d/*.migration > /dev/null ; then - for m in "${SUBVOL}"/usr/lib/frzr.d/*.migration ; - do - unset -f post_install - . $m - if [ "$(type -t post_install)" == function ] ; then - post_install "${MOUNT_PATH}" "${SUBVOL}" "${NAME}" - fi - unset -f post_install - done - fi - - # Export variables to be used by child processes for frzr-tweaks and frzr-initramfs - export MOUNT_PATH - export SUBVOL - export NAME - - # Check if the FIRMWARE_OVERRIDE variable is set by the install media, if so enable firmware overrides - if [ -n "${FIRMWARE_OVERRIDE}" ]; then - echo "export USE_FIRMWARE_OVERRIDES=1" > ${MOUNT_PATH}/etc/device-quirks.conf - fi - - # Run frzr-tweaks to execute the device-quirks to be supplied by the deployed images - frzr-tweaks - - # Run frzr-initramfs to create mkinicpio.conf and build an initramfs - frzr-initramfs - - rm -f ${MOUNT_PATH}/*.img.* - - rm -rf /var/lib/pacman # undo frzr-unlock - - echo "deployment complete; restart to boot into ${NAME}" -} - - -if [ "$0" = "$BASH_SOURCE" ] ; then - main "$@" -fi diff --git a/chimeraos/airootfs/usr/bin/frzr-bootstrap b/chimeraos/airootfs/usr/bin/frzr-bootstrap deleted file mode 100755 index e498912..0000000 --- a/chimeraos/airootfs/usr/bin/frzr-bootstrap +++ /dev/null @@ -1,89 +0,0 @@ -#! /bin/bash - -set -e - -if [ $EUID -ne 0 ]; then - echo "$(basename $0) must be run as root" - exit 1 -fi - -MOUNT_PATH=/tmp/frzr_root - -if [ -n "$1" ]; then - USERNAME=$1 -else - echo "No user specified" - exit 1 -fi - -if [ -n "$2" ]; then - DISK=$2 -else - echo "No disk specified to bootstrap" - exit 1 -fi - -REPAIR=false -if (lsblk -o label ${DISK} | grep -q frzr_efi); then - echo "Existing installation found" - - if (whiptail --yesno --yes-button "Repair" --no-button "Clean" "WARNING: $DISK appears to already have a system installed. Would you like to repair it or do a clean install?\n\nNOTE: A clean install will delete everything on the disk, but a repair install will preserve your user data." 13 70); then - REPAIR=true - fi -fi - - -########## Doing a repair install - -if [ "${REPAIR}" == true ]; then - - mkdir -p ${MOUNT_PATH} - INSTALL_MOUNT=$(fdisk -o Device --list ${DISK} | grep "^${DISK}.*2$") - BOOT_EFI=$(fdisk -o Device --list ${DISK} | grep "^${DISK}.*1$") - mount ${INSTALL_MOUNT} ${MOUNT_PATH} - mount -t vfat ${BOOT_EFI} ${MOUNT_PATH}/boot/ - rm -rf ${MOUNT_PATH}/boot/* - bootctl --esp-path=${MOUNT_PATH}/boot/ install - - echo "deleting subvolume..." - btrfs subvolume delete ${MOUNT_PATH}/deployments/* || true - - rm -rf ${MOUNT_PATH}/etc/* - - exit 0 -fi - - - -mkdir -p ${MOUNT_PATH} - -# create partition table and create and mount the btrfs filesystem -parted --script ${DISK} \ - mklabel gpt \ - mkpart primary fat32 1MiB 512MiB \ - set 1 esp on \ - mkpart primary 512MiB 100% - -PART1=$(fdisk -o Device --list ${DISK} | grep "^${DISK}.*1$") -PART2=$(fdisk -o Device --list ${DISK} | grep "^${DISK}.*2$") - -mkfs.btrfs -L frzr_root -f ${PART2} -mount -t btrfs -o nodatacow ${PART2} ${MOUNT_PATH} - -btrfs subvolume create ${MOUNT_PATH}/var -btrfs subvolume create ${MOUNT_PATH}/home - -mkdir -p ${MOUNT_PATH}/home/${USERNAME} -chown 1000:1000 ${MOUNT_PATH}/home/${USERNAME} - -mkdir ${MOUNT_PATH}/boot -mkdir -p ${MOUNT_PATH}/etc -mkdir -p ${MOUNT_PATH}/.etc - - -# setup boot partition & install bootloader -mkfs.vfat ${PART1} -dosfslabel ${PART1} frzr_efi -mount -t vfat ${PART1} ${MOUNT_PATH}/boot/ -bootctl --esp-path=${MOUNT_PATH}/boot/ install -parted ${DISK} set 1 boot on diff --git a/chimeraos/airootfs/usr/bin/frzr-deploy b/chimeraos/airootfs/usr/bin/frzr-deploy deleted file mode 100755 index 88f4efc..0000000 --- a/chimeraos/airootfs/usr/bin/frzr-deploy +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/bash - -if [ $EUID -ne 0 ]; then - echo "$(basename $0) must be run as root" - exit 1 -fi - - -flock -E 255 -n /tmp/frzr.lock ${BASH_SOURCE%/*}/__frzr-deploy $@ -RESULT=$? - -if [ $RESULT == 255 ]; then - echo "$(basename $0) is already running" -fi - -exit $RESULT diff --git a/chimeraos/airootfs/usr/bin/frzr-initramfs b/chimeraos/airootfs/usr/bin/frzr-initramfs deleted file mode 100755 index e294ab8..0000000 --- a/chimeraos/airootfs/usr/bin/frzr-initramfs +++ /dev/null @@ -1,134 +0,0 @@ -#! /bin/bash - -if [ $EUID -ne 0 ]; then - echo "$(basename $0) must be run as root" - exit 1 -fi - -# Check if script is being ran frmo the install media -if [ -d /tmp/frzr_root ]; then - - if [ -d "${SUBVOL}" ]; then - - cd ${SUBVOL} - # Mount necessary file systems - mount -t proc /proc proc/ - mount -t sysfs /sys sys/ - mount --rbind /dev dev/ - - # Set R/W permissions - btrfs property set -fts ${SUBVOL} ro false - chroot ${SUBVOL} /bin/bash < /etc/mkinitcpio.d/\${NAME%%-*}.preset - -### Rebuild Initramfs with custom preset -mkinitcpio -p \${NAME%%-*} -EOF - # Set back to R/O permissions - btrfs property set -fts ${SUBVOL} ro true - # unmount filesystems - umount -l ${SUBVOL}/proc - umount -l ${SUBVOL}/sys - mount --make-rslave ${SUBVOL}/dev - umount -l ${SUBVOL}/dev - else - echo "No deployment directory found" - exit 1 - fi -else - echo "We don't appear to be running from an arch install media" -fi - - -# Build initramfs from within a deployed system -if [ -d /frzr_root ]; then - - if [ -n "$SUBVOL" ]; then - ### Grabbing name of the new deployed system - ID=$(grep '^ID=' "$SUBVOL/etc/os-release" | awk -F= '{ print $2 }' | sed 's/"//g') - VERSIONID=$(grep '^VERSION_ID=' "$SUBVOL/etc/os-release" | awk -F= '{ print $2 }' | sed 's/"//g') - BUILDID=$(grep '^BUILD_ID=' "$SUBVOL/etc/os-release" | awk -F= '{ print $2 }' | sed 's/"//g') - else - ### Grabbing name of the currently deployed system - ID=$(grep '^ID=' /etc/os-release | awk -F= '{ print $2 }' | sed 's/"//g') - VERSIONID=$(grep '^VERSION_ID=' /etc/os-release | awk -F= '{ print $2 }' | sed 's/"//g') - BUILDID=$(grep '^BUILD_ID=' /etc/os-release | awk -F= '{ print $2 }' | sed 's/"//g') - fi - - BUILD="$ID"-"$VERSIONID"_"$BUILDID" - DEPLOYMENT_PATH="/frzr_root/deployments/$BUILD" - - # Get locked state - RELOCK=0 - LOCK_STATE=$(btrfs property get -fts "$DEPLOYMENT_PATH") - if [[ $LOCK_STATE == *"ro=true"* ]]; then - btrfs property set -fts ${DEPLOYMENT_PATH} ro false - RELOCK=1 - else - echo "Filesystem appears to be unlocked" - fi - - echo "Generating configuration for $BUILD" - - ### Rebuild Initramfs with custom preset - - if [ -n "$SUBVOL" ]; then - cd ${SUBVOL} - # Mount necessary file systems - mount -t proc /proc proc/ - mount -t sysfs /sys sys/ - mount --rbind /dev dev/ - - # We have to chroot for new images or else the kernel version can cause initramfs building to fail - chroot ${SUBVOL} /bin/bash < /etc/mkinitcpio.d/\${NAME%%-*}.preset - -### Rebuild Initramfs with custom preset -mkinitcpio -p \${NAME%%-*} -EOF - umount -l ${SUBVOL}/proc - umount -l ${SUBVOL}/sys - mount --make-rslave ${SUBVOL}/dev - umount -l ${SUBVOL}/dev - else - echo ' -ALL_config="/etc/mkinitcpio.conf" -ALL_kver="/boot/'$BUILD'/vmlinuz-linux" -ALL_microcode=(/boot/'$BUILD'/*-ucode.img) - -PRESETS="default" - -default_image="/boot/'$BUILD'/initramfs-linux.img" -' > /etc/mkinitcpio.d/$ID.preset - # If we are not doing a deployment then this will be used for local installs to rebuild initramfs - mkinitcpio -p $ID - fi - - if [[ $RELOCK == 1 ]]; then - btrfs property set -fts ${DEPLOYMENT_PATH} ro true - else - # Move rebuilt images to the unlocked location if system was unlocked prior - cp /boot/$BUILD/* /boot - fi -fi diff --git a/chimeraos/airootfs/usr/bin/frzr-release b/chimeraos/airootfs/usr/bin/frzr-release deleted file mode 100755 index aa7abb6..0000000 --- a/chimeraos/airootfs/usr/bin/frzr-release +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/bash - -set -e - -if [ ! -e /build_info ]; then - echo "Not currently running a frzr deployment" - exit 1 -fi - -cat /build_info | head -1 diff --git a/chimeraos/airootfs/usr/bin/frzr-tweaks b/chimeraos/airootfs/usr/bin/frzr-tweaks deleted file mode 100755 index becaf0d..0000000 --- a/chimeraos/airootfs/usr/bin/frzr-tweaks +++ /dev/null @@ -1,24 +0,0 @@ -#! /bin/bash - -if [ $EUID -ne 0 ]; then - echo "$(basename $0) must be run as root" - exit 1 -fi - -# Check if device quirks exist in the new image when frzr-deploy is used -if [ -v SUBVOL ]; then - echo "Checking newly deployed system for device-quirks" - if [ -e "${SUBVOL}/usr/share/device-quirks/id-device" ]; then - ${SUBVOL}/usr/share/device-quirks/id-device - else - echo "Device-quirks package was not found, skipping..." - fi -else -# Check if device quirks exist when frzr-tweaks is ran directly - echo "Checking for device-quirks" - if [ -e "/usr/share/device-quirks/id-device" ]; then - /usr/share/device-quirks/id-device - else - echo "Device-quirks packages was not found, skipping..." - fi -fi diff --git a/chimeraos/packages.x86_64 b/chimeraos/packages.x86_64 index d866a31..f2fc4c3 100644 --- a/chimeraos/packages.x86_64 +++ b/chimeraos/packages.x86_64 @@ -13,7 +13,7 @@ diffutils dosfstools efibootmgr git -inputplumber-bin +inputplumber intel-ucode jq libnewt @@ -31,3 +31,4 @@ usbutils wget zsh networkmanager +frzr-git \ No newline at end of file diff --git a/chimeraos/profiledef.sh b/chimeraos/profiledef.sh index 7b6af53..96a66ec 100644 --- a/chimeraos/profiledef.sh +++ b/chimeraos/profiledef.sh @@ -19,12 +19,6 @@ file_permissions=( ["/root/install.sh"]="0:0:755" ["/root/probe.sh"]="0:0:755" ["/root/.automated_script.sh"]="0:0:755" - ["/usr/bin/__frzr-deploy"]="0:0:755" - ["/usr/bin/frzr-bootstrap"]="0:0:755" - ["/usr/bin/frzr-deploy"]="0:0:755" - ["/usr/bin/frzr-initramfs"]="0:0:755" - ["/usr/bin/frzr-release"]="0:0:755" - ["/usr/bin/frzr-tweaks"]="0:0:755" ["/usr/local/bin/choose-mirror"]="0:0:755" ["/usr/local/bin/Installation_guide"]="0:0:755" ["/usr/local/bin/livecd-sound"]="0:0:755" From c4742d86b947722c7174bea0c46ff745ab9e3aca Mon Sep 17 00:00:00 2001 From: Denis Benato Date: Thu, 5 Dec 2024 14:04:31 +0100 Subject: [PATCH 2/5] Change hostname to include installer --- chimeraos/airootfs/etc/hostname | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimeraos/airootfs/etc/hostname b/chimeraos/airootfs/etc/hostname index da8a6bc..f5e6084 100644 --- a/chimeraos/airootfs/etc/hostname +++ b/chimeraos/airootfs/etc/hostname @@ -1,3 +1,3 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -chimeraos +chimeraos-installer From 4e9a46bf7b0afc16ada0d9c5b276c2e4cab5675c Mon Sep 17 00:00:00 2001 From: Denis Benato Date: Thu, 5 Dec 2024 14:04:44 +0100 Subject: [PATCH 3/5] Change locale --- chimeraos/airootfs/etc/locale.conf | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/chimeraos/airootfs/etc/locale.conf b/chimeraos/airootfs/etc/locale.conf index 9bf7aef..f9c983c 100644 --- a/chimeraos/airootfs/etc/locale.conf +++ b/chimeraos/airootfs/etc/locale.conf @@ -1,4 +1 @@ -# -# SPDX-License-Identifier: GPL-3.0-or-later - -LANG=en_US.UTF-8 +LANG=C.UTF-8 From e2b93aac3528abaf231ee7a3e92979e00532bf25 Mon Sep 17 00:00:00 2001 From: Denis Benato Date: Thu, 5 Dec 2024 14:16:47 +0100 Subject: [PATCH 4/5] Compress the initramfs as much as possible --- chimeraos/airootfs/etc/mkinitcpio.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/chimeraos/airootfs/etc/mkinitcpio.conf b/chimeraos/airootfs/etc/mkinitcpio.conf index 6812dc4..5f97bf8 100644 --- a/chimeraos/airootfs/etc/mkinitcpio.conf +++ b/chimeraos/airootfs/etc/mkinitcpio.conf @@ -68,3 +68,4 @@ COMPRESSION="xz" # COMPRESSION_OPTIONS # Additional options for the compressor #COMPRESSION_OPTIONS=() +COMPRESSION_OPTIONS=(-T0 -9e --memlimit=7000MiB) From 68c838c244e7354bbfa393097b16d4b6c64d267b Mon Sep 17 00:00:00 2001 From: Denis Benato Date: Thu, 5 Dec 2024 14:19:25 +0100 Subject: [PATCH 5/5] Copy the image to RAM Certain handhelds only have one USB port and the installer requires at least a keyboard: ensure the USB can be removed safely without crashing the installer. A PC with not enough RAM to hold the ISO installer (about 1GB) is not supported by chimeraos and the deployment file is written on the installation disk. --- chimeraos/efiboot/loader/entries/archiso-x86_64-linux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chimeraos/efiboot/loader/entries/archiso-x86_64-linux.conf b/chimeraos/efiboot/loader/entries/archiso-x86_64-linux.conf index a521898..cc2a4cf 100644 --- a/chimeraos/efiboot/loader/entries/archiso-x86_64-linux.conf +++ b/chimeraos/efiboot/loader/entries/archiso-x86_64-linux.conf @@ -4,4 +4,4 @@ title Install ChimeraOS linux /%INSTALL_DIR%/boot/x86_64/vmlinuz-linux-chimeraos initrd /%INSTALL_DIR%/boot/x86_64/initramfs-linux-chimeraos.img -options archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% nomodeset splash quiet nowatchdog +options archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% copytoram=y nomodeset splash quiet nowatchdog