Last active
August 13, 2024 06:13
-
-
Save harish2704/fdea058e86f1a1e1b806700b061ade2e to your computer and use it in GitHub Desktop.
Print URLs of rpm package instead of downloading while using zypper package manager ( OpenSUSE )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: | |
# zypper-print-urls.sh pkg1 pk2 pkg3 ... | |
# This script actualy create a solver state and | |
# then derives urls from the sovler state. | |
solverDir=$(zypper install --debug-solver $@ | grep 'successfully at' | sed 's#Solver test case generated successfully at \(.*\).#\1#' ) | |
cat $solverDir/y2log | grep 'SATSolutionToPool install returns ' | awk -F '[)(]' '{ match( $7, /[^.]*$/,m); print $8"/"m[0]"/"$7".rpm"}' | sed $( zypper repos -E -n -u |awk -F ' +\\| +| +$' '{ if (f){ $1=$1; print "-e s#"$2"/#"$7"#g";}} /---/{f=1}' ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment