diff --git a/modules/.gitkeep b/modules/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/modules/rpm-ostree/rpm-ostree.sh b/modules/safe-rpm-ostree/safe-rpm-ostree.sh similarity index 85% rename from modules/rpm-ostree/rpm-ostree.sh rename to modules/safe-rpm-ostree/safe-rpm-ostree.sh index 92236e4..5ff459b 100644 --- a/modules/rpm-ostree/rpm-ostree.sh +++ b/modules/safe-rpm-ostree/safe-rpm-ostree.sh @@ -42,16 +42,32 @@ fi # Create symlinks to fix packages that create directories in /opt get_json_array OPTFIX 'try .["optfix"][]' "$1" if [[ ${#OPTFIX[@]} -gt 0 ]]; then + LIB_EXEC_DIR="/usr/libexec/bluebuild" + SYSTEMD_DIR="/etc/systemd/system" + MODULE_DIR="/tmp/modules/rpm-ostree" + + if ! [ -x "${LIB_EXEC_DIR}/optfix.sh" ]; then + mkdir -p "${LIB_EXEC_DIR}" + cp "${MODULE_DIR}/optfix.sh" "${LIB_EXEC_DIR}/" + chmod +x "${LIB_EXEC_DIR}/optfix.sh" + fi + + if ! [ -f "${SYSTEMD_DIR}/bluebuild-optfix.service" ]; then + cp "${MODULE_DIR}/bluebuild-optfix.service" "${SYSTEMD_DIR}/" + systemctl enable bluebuild-optfix.service + fi + echo "Creating symlinks to fix packages that install to /opt" # Create symlink for /opt to /var/opt since it is not created in the image yet mkdir -p "/var/opt" - ln -s "/var/opt" "/opt" + ln -fs "/var/opt" "/opt" + # Create symlinks for each directory specified in recipe.yml for OPTPKG in "${OPTFIX[@]}"; do OPTPKG="${OPTPKG%\"}" OPTPKG="${OPTPKG#\"}" mkdir -p "/usr/lib/opt/${OPTPKG}" - ln -s "../../usr/lib/opt/${OPTPKG}" "/var/opt/${OPTPKG}" + ln -fs "/usr/lib/opt/${OPTPKG}" "/var/opt/${OPTPKG}" echo "Created symlinks for ${OPTPKG}" done fi @@ -73,8 +89,9 @@ if [[ ${#INSTALL_PKGS[@]} -gt 0 ]]; then HTTPS_INSTALL=true HTTPS_PKGS+=("${INSTALL_PKGS[$i]}") elif [[ ! "${PKG}" =~ ^https?:\/\/.* ]] && [[ -f "${CONFIG_DIRECTORY}/rpm-ostree/${PKG}" ]]; then + INSTALL_PKGS[$i]="${CONFIG_DIRECTORY}/rpm-ostree/${PKG}" LOCAL_INSTALL=true - LOCAL_PKGS+=("${CONFIG_DIRECTORY}/rpm-ostree/${PKG}") + LOCAL_PKGS+=("${INSTALL_PKGS[$i]}") else CLASSIC_INSTALL=true CLASSIC_PKGS+=("${PKG}") @@ -124,12 +141,21 @@ if [[ ${#INSTALL_PKGS[@]} -gt 0 && ${#INSTALLED_REMOVE_PACKAGES[@]} -gt 0 ]]; th elif ${CLASSIC_INSTALL} && ${HTTPS_INSTALL} && ! ${LOCAL_INSTALL}; then rpm-ostree override remove "${INSTALLED_REMOVE_PACKAGES[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}") rpm-ostree install "${HTTPS_PKGS[@]}" - elif ${CLASSIC_INSTALL} && ! ${HTTPS_INSTALL} && ! ${LOCAL_INSTALL}; then + elif ${CLASSIC_INSTALL} && ! ${HTTPS_INSTALL} && ${LOCAL_INSTALL}; then rpm-ostree override remove "${INSTALLED_REMOVE_PACKAGES[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}") rpm-ostree install "${LOCAL_PKGS[@]}" elif ${CLASSIC_INSTALL} && ${HTTPS_INSTALL} && ${LOCAL_INSTALL}; then rpm-ostree override remove "${INSTALLED_REMOVE_PACKAGES[@]}" $(printf -- "--install=%s " "${CLASSIC_PKGS[@]}") rpm-ostree install "${HTTPS_PKGS[@]}" "${LOCAL_PKGS[@]}" + elif ! ${CLASSIC_INSTALL} && ! ${HTTPS_INSTALL} && ${LOCAL_INSTALL}; then + rpm-ostree override remove "${INSTALLED_REMOVE_PACKAGES[@]}" + rpm-ostree install "${LOCAL_PKGS[@]}" + elif ! ${CLASSIC_INSTALL} && ${HTTPS_INSTALL} && ! ${LOCAL_INSTALL}; then + rpm-ostree override remove "${INSTALLED_REMOVE_PACKAGES[@]}" + rpm-ostree install "${HTTPS_PKGS[@]}" + elif ! ${CLASSIC_INSTALL} && ${HTTPS_INSTALL} && ${LOCAL_INSTALL}; then + rpm-ostree override remove "${INSTALLED_REMOVE_PACKAGES[@]}" + rpm-ostree install "${HTTPS_PKGS[@]}" "${LOCAL_PKGS[@]}" fi elif [[ ${#INSTALL_PKGS[@]} -gt 0 ]]; then echo "Installing RPMs" diff --git a/recipes/bazzite-dx.yml b/recipes/bazzite-dx.yml index bd7dd3d..c8267c6 100755 --- a/recipes/bazzite-dx.yml +++ b/recipes/bazzite-dx.yml @@ -43,7 +43,8 @@ modules: - from-file: common_recipe.yml # Install KDE Packages - - type: rpm-ostree + - type: safe-rpm-ostree + source: local install: - kde-runtime-docs - kdenetwork-filesharing diff --git a/recipes/bazzite-gnome-dx.yml b/recipes/bazzite-gnome-dx.yml index f2a2921..3f87be9 100755 --- a/recipes/bazzite-gnome-dx.yml +++ b/recipes/bazzite-gnome-dx.yml @@ -40,7 +40,8 @@ modules: - from-file: common_recipe.yml # Install GNOME packages - - type: rpm-ostree + - type: safe-rpm-ostree + source: local install: - cryfs - gnome-shell-extension-appindicator @@ -61,7 +62,7 @@ modules: - yaru-theme - zenity remove: - # - gnome-extensions-app + - gnome-extensions-app - gnome-software-rpm-ostree - gnome-tour - gnome-terminal-nautilus diff --git a/recipes/common_recipe.yml b/recipes/common_recipe.yml index 56c5a01..7380465 100755 --- a/recipes/common_recipe.yml +++ b/recipes/common_recipe.yml @@ -16,7 +16,8 @@ modules: - copr-repos.sh # Install packages from Bluefin and Bluefin DX - - type: rpm-ostree + - type: safe-rpm-ostree + source: local repos: - https://copr.fedorainfracloud.org/coprs/ublue-os/staging/repo/fedora-%OS_VERSION%/ublue-os-staging-fedora-%OS_VERSION%.repo - https://copr.fedorainfracloud.org/coprs/che/nerd-fonts/repo/fedora-%OS_VERSION%/che-nerd-fonts-fedora-%OS_VERSION%.repo