| 1 | #!/bin/bash |
|---|
| 2 | #------------------------------------------------------------------------------- |
|---|
| 3 | # This program is borrowed from http://staff.washington.edu/corey/new-patches.cgi |
|---|
| 4 | # The original author: |
|---|
| 5 | # Corey Satten, corey @ cac.washington.edu, 06/26/03, release 1.8 |
|---|
| 6 | # For the latest version visit: http://staff.washington.edu/corey/tools.html |
|---|
| 7 | # |
|---|
| 8 | # Modified by Blake Huang and Steven Shiau to use in DRBL |
|---|
| 9 | # |
|---|
| 10 | # Find all installed packages with patches |
|---|
| 11 | # "$NEWER" is in drbl-functions |
|---|
| 12 | |
|---|
| 13 | # Load DRBL setting and functions |
|---|
| 14 | # Setting |
|---|
| 15 | # Source function library. |
|---|
| 16 | [ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions |
|---|
| 17 | |
|---|
| 18 | # Source DRBL setting |
|---|
| 19 | . /opt/drbl/conf/drbl.conf |
|---|
| 20 | |
|---|
| 21 | # Source the drbl related functions |
|---|
| 22 | . $DRBL_SCRIPT_PATH/sbin/drbl-functions |
|---|
| 23 | |
|---|
| 24 | ( |
|---|
| 25 | # Note! Here we must use gawk, not awk (mawk which exists in Debian) |
|---|
| 26 | gawk "$NEWER"' # omit all but newest of multiple available patches |
|---|
| 27 | { L0=R0; L1=R1; L2=R2 |
|---|
| 28 | R0=$0 |
|---|
| 29 | # For RedHat/Fedora |
|---|
| 30 | # Ex. kernel-smp#2.6.9-1.681_FC3 |
|---|
| 31 | # R1: 2.6.9-1.681_FC3 |
|---|
| 32 | # R2: kernel-smp |
|---|
| 33 | # For MDK: |
|---|
| 34 | # Ex. kernel-smp-2.4.22.37mdk |
|---|
| 35 | # R1: 2.4.22.37mdk |
|---|
| 36 | # R2: kernel-smp |
|---|
| 37 | # For Debian: |
|---|
| 38 | # Ex. kernel-image-2.6.8-2-686 |
|---|
| 39 | # R1: 2.6.8-2-686 |
|---|
| 40 | # R2: kernel-image |
|---|
| 41 | # For Ubuntu: |
|---|
| 42 | # Ex. linux-image-2.6.8-2-686 |
|---|
| 43 | # R1: 2.6.8-2-686 |
|---|
| 44 | # R2: linux-image |
|---|
| 45 | R1=$0; sub(/^(kernel|linux)(|-smp|-image)[#-]/,"",R1) # pkg version |
|---|
| 46 | R2=$0; sub(/[#-]+[0-9]+.*$/,"",R2) # pkg name |
|---|
| 47 | #printf("before newer: %s %s %s %s\n",R1,R2,L1,L2); |
|---|
| 48 | if ((R2 == L2) && newer(R1, L1)) {R0=L0; R1=L1} |
|---|
| 49 | if ((R2 != L2) && L0) {print L0} |
|---|
| 50 | } |
|---|
| 51 | END { print R0 }' |
|---|
| 52 | ) |
|---|