| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # rpm-check.sh |
| 3 | |
| 4 | # Queries an rpm file for description, listing, |
| 5 | #+ and whether it can be installed. |
| 6 | # Saves output to a file. |
| 7 | # |
| 8 | # This script illustrates using a code block. |
| 9 | |
| 10 | SUCCESS=0 |
| 11 | E_NOARGS=65 |
| 12 | |
| 13 | if [scip-shell system . . `[`. -z "$1" ] |
| 14 | then |
| 15 | echoscip-shell system . . echo. "Usage: `basenamescip-shell system . . basename. $0` rpm-file" |
| 16 | exit $E_NOARGS |
| 17 | fi |
| 18 | |
| 19 | { # Begin code block. |
| 20 | echoscip-shell system . . echo. |
| 21 | echoscip-shell system . . echo. "Archive Description:" |
| 22 | rpm -qpi $1 # Query description. |
| 23 | echoscip-shell system . . echo. |
| 24 | echoscip-shell system . . echo. "Archive Listing:" |
| 25 | rpm -qpl $1 # Query listing. |
| 26 | echoscip-shell system . . echo. |
| 27 | rpm -i --test $1 # Query whether rpm file can be installed. |
| 28 | if [scip-shell system . . `[`. "$?" -eq $SUCCESS ] |
| 29 | then |
| 30 | echoscip-shell system . . echo. "$1 can be installed." |
| 31 | else |
| 32 | echoscip-shell system . . echo. "$1 cannot be installed." |
| 33 | fi |
| 34 | echoscip-shell system . . echo. # End code block. |
| 35 | } > "$1.test" # Redirects output of everything in block to file. |
| 36 | |
| 37 | echoscip-shell system . . echo. "Results of rpm test in file $1.test" |
| 38 | |
| 39 | # See rpm man page for explanation of options. |
| 40 | |
| 41 | exit 0 |