Skip to content

Instantly share code, notes, and snippets.

@tpopela
Last active October 22, 2024 08:35
Show Gist options
  • 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" = "41" ]; then
curl --silent --show-error --remote-name-all --output-dir $tmp \
https://kojipkgs.fedoraproject.org//packages/dnf5/5.2.6.2/1.fc41/x86_64/libdnf5-5.2.6.2-1.fc41.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/microdnf/3.10.0/6.fc41/x86_64/microdnf-3.10.0-6.fc41.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/libpeas1/1.36.0/7.eln141/x86_64/libpeas1-1.36.0-7.eln141.x86_64.rpm \
https://kojipkgs.fedoraproject.org//packages/dnf/4.21.1/2.fc41/noarch/dnf-data-4.21.1-2.fc41.noarch.rpm \
https://kojipkgs.fedoraproject.org//packages/libdnf/0.73.3/1.fc41/x86_64/libdnf-0.73.3-1.fc41.x86_64.rpm
elif [ "$VERSION_ID" = "39" ] || [ "$VERSION_ID" = "40" ]; 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