LP1847800 Admin grid filter display, default fields, IDL repairs
[working/Evergreen.git] / Open-ILS / updates / check
1 #!/bin/bash
2 echo "Content-Type: text/xml"
3 cat <<HEAD
4
5 <?xml version="1.0"?>
6 <updates>
7 HEAD
8 UPDATE_LOC=$(dirname $PWD)
9 PATH_INFO=${PATH_INFO#/}
10 CHANNEL=${PATH_INFO%%/*}
11 PATH_INFO=${PATH_INFO#*/}
12 VERSION=${PATH_INFO%%/*}
13 if [ ! -f "$UPDATE_LOC/patch/$CHANNEL/VERSION" ]; then
14         CHANNEL=""
15 else
16         CHANNEL="$CHANNEL/"
17 fi
18 if [ -f "$UPDATE_LOC/patch/${CHANNEL}VERSION" ]; then
19         URLBASE="http://$HTTP_HOST$(dirname $SCRIPT_NAME)/${CHANNEL}"
20         CURVERSION=$(cat $UPDATE_LOC/patch/${CHANNEL}VERSION)
21         [ -f "$UPDATE_LOC/patch/${CHANNEL}DETAILS" ] && DETAILSURL=$(cat $UPDATE_LOC/${CHANNEL}DETAILS)
22         [ -n "$DETAILSURL" ] && DETAILSURL=" detailsURL=\"$DETAILSURL\""
23         if [ -n "$CURVERSION" -a "$VERSION" != "$CURVERSION" ]; then
24                 if [ -f "$UPDATE_LOC/pub/${CHANNEL}$CURVERSION.mar" -a -f "$UPDATE_LOC/patch/${CHANNEL}$CURVERSION.patchline" ]; then
25                         echo "<update type=\"minor\" version=\"$CURVERSION\" extensionVersion=\"$CURVERSION\"$DETAILSURL>"
26                         sed -e "s|URL=\"|URL=\"$URLBASE|" "$UPDATE_LOC/patch/${CHANNEL}$CURVERSION.patchline"
27                         if [ -f "$UPDATE_LOC/pub/${CHANNEL}$VERSION-$CURVERSION.mar" -a -f "$UPDATE_LOC/patch/${CHANNEL}$VERSION-$CURVERSION.patchline" ]; then
28                                 sed -e "s|URL=\"|URL=\"$URLBASE|" "$UPDATE_LOC/patch/${CHANNEL}$VERSION-$CURVERSION.patchline"
29                         fi
30                         echo "</update>"
31                 fi
32         fi
33 fi
34 cat <<FOOTER
35 </updates>
36 FOOTER