Skip to content

Instantly share code, notes, and snippets.

@b-
Created August 10, 2025 18:15
Show Gist options
  • Save b-/4cb94432e08b17b937bc0ef637eaac13 to your computer and use it in GitHub Desktop.
Save b-/4cb94432e08b17b937bc0ef637eaac13 to your computer and use it in GitHub Desktop.
one-true-optfix.sh
#!/usr/bin/env bash
set -euxo pipefail
shopt -s nullglob
optdirs=(/opt/*)
if [[ -n "${optdirs[*]}" ]]; then
optfix_dir="/usr/lib/bluebuild-optfix"
mkdir -pv "${optfix_dir}"
echo "Creating symlinks to fix packages that installed to /opt:"
for optdir in "${optdirs[@]}"; do
opt=$(basename "${optdir}")
lib_opt_dir="${optfix_dir}/${opt}"
mv -v "${optdir}" "${lib_opt_dir}"
echo "linking ${optdir} => ${lib_opt_dir}"
echo "L+? ${optdir} - - - - ${lib_opt_dir}" | tee "/usr/lib/tmpfiles.d/bluebuild-optfix-${opt}.conf"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment