Skip to content

Instantly share code, notes, and snippets.

@tpopela
Last active September 1, 2023 10:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tpopela/b9a390a6a15a21b74b1ea3d4b3ee9557 to your computer and use it in GitHub Desktop.
Save tpopela/b9a390a6a15a21b74b1ea3d4b3ee9557 to your computer and use it in GitHub Desktop.
Simple script that unlocks the current OSTree deployment if needed and installs the dnf for debugging purposes
#!/bin/sh
# Run this script, then install the debuginfo packages with:
# sudo dnf debuginfo-install PACKAGE
set -e
tmp=$(mktemp -d)
cleanup () {
rm -rf $tmp
}
trap cleanup EXIT
set -x
source /etc/os-release > /dev/null 2>&1
if [ "$VERSION_ID" = "38" ]; then
curl --silent --show-error --remote-name-all --output-dir $tmp \
https://kojipkgs.fedoraproject.org//packages/microdnf/3.9.0/2.fc38/x86_64/microdnf-3.9.0-2.fc38.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/libpeas/1.34.0/3.fc38/x86_64/libpeas-1.34.0-3.fc38.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/dnf/4.14.0/2.fc38/noarch/dnf-data-4.14.0-2.fc38.noarch.rpm \
https://kojipkgs.fedoraproject.org//packages/libdnf/0.68.0/2.fc38/x86_64/libdnf-0.68.0-2.fc38.x86_64.rpm
elif [ "$VERSION_ID" = "39" ]; then
curl --silent --show-error --remote-name-all --output-dir $tmp \
https://kojipkgs.fedoraproject.org//packages/dnf5/5.1.1/1.fc39/x86_64/dnf5-5.1.1-1.fc39.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/dnf/4.16.2/2.fc39/noarch/dnf-data-4.16.2-2.fc39.noarch.rpm \
https://kojipkgs.fedoraproject.org//packages/dnf5/5.1.1/1.fc39/x86_64/libdnf5-5.1.1-1.fc39.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/dnf5/5.1.1/1.fc39/x86_64/libdnf5-cli-5.1.1-1.fc39.x86_64.rpm
else
echo "Not a supported release"
exit 1
fi
successful=$?
if [ $successful != 0 ] ; then
exit 1
fi
if ! ostree admin status | grep Unlocked > /dev/null 2>&1; then
if ! sudo ostree admin unlock; then
echo "Can't open the current OSTree deployment!"
exit 1
fi
fi
if ! sudo rpm -i "$tmp/*.rpm"; then
echo "Can't install the microdnf!"
exit 1
fi
if ! sudo microdnf --assumeyes install dnf python3-dnf-plugins* gdb; then
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment