* chore: Remove usage of `yq` in favor of `jq` * fix: Missed bracket in `default-flatpaks` * fix: `get_json_array` complaining about unpopulated arrays * fix(files): Forgot to input `-r` flag for some `jq` calls * fix(gschema-overrides): Use `try` in `get_json_array` * chore(default-flatpaks): Replace `yq` with `jq` in run-time setup binaries * chore: Switch to simplified `jq` syntax without brackets * chore(default-flatpaks): Switch `repo-info` file from `yml` to `json` * fix(default-flatpaks): Some `yq` calls * chore: Revert back to bracket syntax for more reliable `jq` parsing * chore(files): Missed bracket syntax * chore: Approve bot suggestion about quoting Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update modules/files/files.sh Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix(yafti): Populating custom flatpaks It's populated in reverse order compared to the format in recipe, but it works * fix(fonts): Variable substitution is needed * fix: Typo * fix(fonts): Forgot to assign FONTS variable --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
70 lines
2.3 KiB
Bash
70 lines
2.3 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Tell build process to exit if there are any errors.
|
|
set -euo pipefail
|
|
|
|
MODULE_DIRECTORY="${MODULE_DIRECTORY:-"/tmp/modules"}"
|
|
|
|
FIRSTBOOT_DATA="/usr/share/ublue-os/firstboot"
|
|
|
|
mkdir -p "$FIRSTBOOT_DATA/launcher/"
|
|
|
|
# doesn't overwrite user's yafti.yml (ignores error)
|
|
cp -n "$MODULE_DIRECTORY/yafti/yafti.yml" "$FIRSTBOOT_DATA/yafti.yml" || true
|
|
cp -r "$MODULE_DIRECTORY/yafti/launcher/" "$FIRSTBOOT_DATA"
|
|
|
|
FIRSTBOOT_SCRIPT="${FIRSTBOOT_DATA}/launcher/login-profile.sh"
|
|
PROFILED_DIR="/etc/profile.d"
|
|
FIRSTBOOT_LINK="${PROFILED_DIR}/ublue-firstboot.sh"
|
|
|
|
# Fetch ublue COPR
|
|
REPO="https://copr.fedorainfracloud.org/coprs/ublue-os/staging/repo/fedora-${OS_VERSION}/ublue-os-staging-fedora-${OS_VERSION}.repo"
|
|
REPO_URL="${REPO//[$'\t\r\n ']}"
|
|
STAGING_REPO_PATH="/etc/yum.repos.d/ublue-os-staging-fedora-${OS_VERSION}.repo"
|
|
BACKUP_STAGING_REPO_PATH="${STAGING_REPO_PATH}.backup"
|
|
|
|
if [ -f "$STAGING_REPO_PATH" ]; then
|
|
mv "$STAGING_REPO_PATH" "$BACKUP_STAGING_REPO_PATH"
|
|
fi
|
|
|
|
echo "Downloading repo file ${REPO_URL}"
|
|
curl -fLs --create-dirs "${REPO_URL}" -o "${STAGING_REPO_PATH}"
|
|
echo "Downloaded repo file ${REPO_URL}"
|
|
|
|
rpm-ostree install libadwaita yafti
|
|
|
|
# Remove ublue COPR
|
|
rm /etc/yum.repos.d/ublue-os-staging-fedora-*.repo
|
|
|
|
if [ -f "$BACKUP_STAGING_REPO_PATH" ]; then
|
|
mv "$BACKUP_STAGING_REPO_PATH" "$STAGING_REPO_PATH"
|
|
fi
|
|
|
|
# If the profile.d directory doesn't exist, create it
|
|
if [ ! -d "${PROFILED_DIR}" ]; then
|
|
mkdir -p "${PROFILED_DIR}"
|
|
fi
|
|
|
|
# Create symlink to our profile script, which creates the per-user "autorun yafti" links.
|
|
if [ -f "${FIRSTBOOT_SCRIPT}" ]; then
|
|
ln -sf "${FIRSTBOOT_SCRIPT}" "${FIRSTBOOT_LINK}"
|
|
fi
|
|
|
|
YAFTI_FILE="${FIRSTBOOT_DATA}/yafti.yml"
|
|
|
|
get_yaml_array FLATPAKS '.custom-flatpaks[]' "$1"
|
|
if [[ ${#FLATPAKS[@]} -gt 0 ]]; then
|
|
echo "Adding Flatpaks to yafti.yml"
|
|
sed -i -e '/- Boatswain for Streamdeck: com.feaneron.Boatswain/a \
|
|
Custom:\n description: Flatpaks suggested by the image maintainer.\n default: true' "${YAFTI_FILE}"
|
|
|
|
for pkg in "${FLATPAKS[@]}"; do
|
|
echo "Adding to yafti: ${pkg}"
|
|
sed -i '/^[[:space:]]*Custom:/ {
|
|
n; n; n;
|
|
i\
|
|
- REPLACEMEHERE
|
|
}' "${YAFTI_FILE}"
|
|
sed -i "s/ - REPLACEMEHERE/ - ${pkg}/g" "${YAFTI_FILE}"
|
|
done
|
|
fi
|