carlopmart wrote:
> Hi all,
> 
>   I have do it this question one year ago 
> (https://lists.ubuntu.com/archives/ubuntu-server/2007-July/000535.html), but 
> I 
> need to know if it is resolved under ubuntu hardy lts server release. Can I 
> pass 
> some type of exclude/include list packages to apt to stay sure that this 
> package 
>   has 5 years support??
> 
> many thanks.
> 

Here is a script that I have been working on to solve this.  It is not
yet completely tested, but I guess you could help me find if there is
something wrong with it.

usage: maintenance-check [-f] [release [release...]]

release             Specifies the release to parse from.
                    Defaults to the system release
-f, --filter value  possible values are:
                        n - not officially maintained
                        u - ubuntu desktop
                        k - kubuntu desktop
                        s - ubuntu server

Known issues:
* For releases prior to Hardy, I have yet to modify the seed structure
so that I can distinguish between what's not shipped on cd but supported
and what's not supported at all, so some packages may show as
unsupported while they should.
* Due to the way kernels are updated, the updated kernel packages are
shown as unsupported while they of course are.

Let me know if it helps and if you find issues with it.

Cheers,
Nick
#!/bin/bash
MYCOLUMNS="50,60,70"


usage () {
        cat <<EOT
This commands checks for each installed package on your system what is
the maintenance group it fits in regarding the Canonical maintenance policy.

usage: maintenance-check [-f] [release [release...]]
 
release             Specifies the release to parse from. 
                    Defaults to the system release 
-f, --filter value      possible values are: 
                        n - not officially maintained
                        u - ubuntu desktop
                        k - kubuntu desktop
                        s - ubuntu server

maintenance-check is Copyright (C) 2007 Canonical Ltd. and
written by Nick Barcet <[EMAIL PROTECTED]>
EOT
}

filter=""

TEMP=`getopt -o hf: --long help,filter:,  -- "$@"`
eval set -- "$TEMP"

while true
do
    case "$1" in 
    -h|--help)
        usage
        exit 0
    ;;
    -f|--filter)
        case "$2" in
        n|u|k|s|N|U|K|S)
            filter="$2"
        ;;
        *)
            echo "Error: filter value must be one of n,u,k,s"
            exit 1
        ;;
        esac
        shift 2
    ;;
    --)
        shift
        break
    ;;
    esac
done


getseeds () {
    for j; do
        wget -q -O - "${XSOURCE}.${XRELEASE}/$j$XSUFFIX" | sed 
'1,2d;N;$!P;$!D;$d' | sed 's/|.*$//;s/[ \t]*$//' | sort -u
    done
}

add_inheritance () {
        case " $inherit " in
                *" $1 "*)
                        ;;
                *)
                        inherit="${inherit:+$inherit }$1"
                        ;;
        esac
}

expand_inheritance () {
        for seed in $(grep "^$1:" "$STRUCTURE" | cut -d: -f2); do
                expand_inheritance "$seed"
        done
        add_inheritance "$1"
}

inheritance () {
        inherit=
        expand_inheritance "$1"
        #echo "$inherit"
}

#before feisty, no structure file generated
getlistsold() {
    XSOURCE=$2
    XRELEASE=$1
    XSUFFIX=".seed"
    getseeds $5 > $1.$4.pkgs
    XSUFFIX=""
    getseeds -r $1 -s $2 $5 >> $1.$4.pkgs
    XSUFFIX=".build-depends"
    getseeds $5 >> $1.$4.pkgs
    sort -u -o $1.$4.pkgs $1.$4.pkgs
}

getlists() {
    STRUCTURE=$4.struct
    list=""
    wget -q -O - "$2.$1/structure" > $STRUCTURE
    for seed in $3 ; do
        list="$list $(cat $STRUCTURE | sed -n '/^'$seed': /s/'$seed': //p')"
    done

    newlist=$list
    for item in $list ; do
        inheritance $item
        for new in $inherit; do
            case " $newlist " in
                *" $new "*)
                    ;;
                *)
                    newlist="$newlist $new"
            esac
        done
    done

    getlistsold "$@" "$newlist"
}

parseinstalled() {
    dpkg -l | sed '/ii/! d;/ii  / {s/ii  //;s/ .*$//};'
}

summarize() {
    FILE="$release.installed"

    exec 10<$FILE
    while read line<&10
    do
        theout="${line%\n}\t"
        case "$filter" in
            n|N)
                if !((grep -q $line $1.desktop.pkgs) \
                || (grep -q $line $1.server.pkgs) \
                || (grep -q $line $1.kubuntu.pkgs) ); then 
                    echo -e "${theout}"
                fi
            ;;
            u|U)
                if grep -q $line $1.desktop.pkgs ; then 
                    echo -e "${theout}${umaint}" | expand -t $MYCOLUMNS
                fi
            ;;
            k|K)
                if grep -q $line $1.kubuntu.pkgs ; then 
                    echo -e "${theout}\t\t${kmaint}" | expand -t $MYCOLUMNS
                fi
            ;;
            s|S)
                if grep -q $line $1.server.pkgs ; then 
                    echo -e "${theout}\t${smaint}" | expand -t $MYCOLUMNS
                fi
            ;;
            *)
                if grep -q $line $1.desktop.pkgs ; then 
theout="${theout}${umaint}\t"; else theout="${theout}\t"; fi
                if grep -q $line $1.server.pkgs ; then 
theout="${theout}${smaint}\t"; else theout="${theout}\t"; fi
                if grep -q $line $1.kubuntu.pkgs ; then 
theout="${theout}${kmaint}"; fi
                echo -e "${theout}" | expand -t $MYCOLUMNS
            ;;
        esac

    done
}

dorelease() {
    firt=1
    for release; do
        if (! first=0 ); then 
            echo "\n---"
            first=1
        fi
        case "$release" in
        dapper) #no structure file
            umaint="3y";kmaint="3y";smaint="5y";
            echo "6.06(dapper 
drake)-Maint.til:Ubuntu->2009-11,Server->2011-11,Kubuntu->2009-11"
            echo -e "---\nPackage\tUbuntu\tServer\tKubuntu" | expand -t 
$MYCOLUMNS
            
source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/ubuntu";
            getlistsold "$release" "$source" "server-ship" "server" \
                "boot server standard installer minimal"
            getlistsold "$release" "$source" "ship" "desktop" \
                "boot desktop live installer standard ship-live minimal"
            
source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/kubuntu";
            getlistsold "$release" "$source" "ship" "kubuntu" \
                "boot desktop live installer standard ship-live minimal"
            parseinstalled $release > $release.installed
            summarize $release
        ;;
        edgy) #no structure file 
            umaint="18mo";kmaint="18mo";smaint="18mo";
            echo "6.10(Edgy Eft)-Maint.til: All->2008-04"
            echo -e "---\nPackage\tUbuntu\tServer\tKubuntu" | expand -t 
$MYCOLUMNS
            
source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/ubuntu";
            getlistsold "$release" "$source" "server-ship" "server" \
                "boot server standard installer minimal"
            getlistsold "$release" "$source" "ship" "desktop" \
                "boot desktop live installer standard ship-live minimal"
            
source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/kubuntu";
            getlistsold "$release" "$source" "ship" "kubuntu" \
                "boot desktop live installer standard ship-live minimal"
            parseinstalled $release > $release.installed
            summarize $release
        ;;
        feisty)  #general case, we have a structure file
            umaint="18mo";kmaint="18mo";smaint="18mo";
            echo "7.04(feisty fawn)-Maint.til: All->2008-10"
            echo -e "---\nPackage\tUbuntu\tServer\tKubuntu" | expand -t 
$MYCOLUMNS
            
source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/ubuntu";
            getlists "$release" "$source" "server-ship" "server"
            getlists "$release" "$source" "ship" "desktop"
            
source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/kubuntu";
            getlists "$release" "$source" "ship" "kubuntu"
            parseinstalled $release > $release.installed
            summarize $release
        ;;
        gutsy) #structure file is invalid
            umaint="18mo";kmaint="18mo";smaint="18mo";
            echo "7.10(gusty gibbon)-Maint.til: All->2009-04"
            echo -e "---\nPackage\tUbuntu\tServer\tKubuntu" | expand -t 
$MYCOLUMNS
            
source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/ubuntu";
            getlistsold "$release" "$source" "server-ship" "server" \
                "boot required minimal standard dns-server lamp-server 
openssh-server print-server samba-server postgresql-server mail-server"
            getlistsold "$release" "$source" "ship" "desktop" \
                "boot required minimal standard desktop"
            
source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/kubuntu";
            getlistsold "$release" "$source" "ship" "kubuntu" \
                "boot required minimal standard desktop"
            parseinstalled $release > $release.installed
            summarize $release
        ;;
        hardy) #general case, we have a structure file
            umaint="3y";kmaint="18mo";smaint="5y";
            echo "8.04(hardy 
heron)-Maint.til:Ubuntu->2011-04,Server->2013-04,Kubuntu->2009-10"
            echo -e "---\nPackage\tUbuntu\tServer\tKubuntu" | expand -t 
$MYCOLUMNS
            
source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/ubuntu";
            getlists "$release" "$source" "server-ship supported-common" 
"server"
            getlists "$release" "$source" "ship supported" "desktop"
            
source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/kubuntu";
            getlists "$release" "$source" "ship supported" "kubuntu"
            parseinstalled $release > $release.installed
            summarize $release
        ;;
        *) #general case, we should have a structure file
            umaint="X";kmaint="X";smaint="X";
            echo "unknown release"
            echo -e "---\nPackage\tUbuntu\tServer\tKubuntu" | expand -t 
$MYCOLUMNS
            
source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/ubuntu";
            getlists "$release" "$source" "server-ship supported-common" 
"server"
            getlists "$release" "$source" "ship supported" "desktop"
            
source="http://people.ubuntu.com/~ubuntu-archive/germinate-output/kubuntu";
            getlists "$release" "$source" "ship supported" "kubuntu"
            parseinstalled $release > $release.installed
            summarize $release
        ;;
        esac
    done
}

cat <<EOT

This commands checks for each installed package on your system what are
the maintenance groups it fits in regarding the Canonical maintenance policy.

WARNING: This script only checks packages names, so if you have pulled a
  package version outside the official repositories for a given release,
  it will not be maintained by Canonical.

The release you are testing against is:
EOT
        
WORKINGDIR=`mktemp -d /tmp/maintenance-check-XXXXXXXXXX` || exit 1exit
pushd "$WORKINGDIR" &> /dev/null

if [ $# -lt 1 ]; then   
        dorelease `grep DISTRIB_CODENAME= /etc/lsb-release | sed 
s/DISTRIB_CODENAME=//`
else
        dorelease "$@"
fi

popd &> /dev/null
rm -rf "$WORKINGDIR"
exit 0

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
ubuntu-server mailing list
ubuntu-server@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server
More info: https://wiki.ubuntu.com/ServerTeam

Reply via email to