Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/patch/bash-patch.sh

    rd8a9d8b rc7ef534  
    1616# Get the # of Patches
    1717#
    18 install -d ~/tmp
    19 cd ~/tmp
     18cd /usr/src
    2019wget ftp://ftp.cwru.edu/pub/bash/bash-${VERSION}-patches/ --no-remove-listing
    2120VERSION2=$(echo ${VERSION} | sed -e 's/\.//g')
     
    3433# Set Patch Number
    3534#
    36 cd ~/tmp
     35cd /usr/src
    3736wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
    3837PATCH_NUM=$(cat index.html | grep bash | grep "${VERSION}" | grep branch_update | cut -f2 -d'"' | cut -f1 -d'"'| cut -f4 -d- | cut -f1 -d. | tail -n 1)
     
    4241# Cleanup Directory
    4342#
    44 cd ~/tmp
    4543rm -rf bash-${VERSION} bash-${VERSION}.orig
    4644tar xvf bash-${VERSION}.tar.gz
    4745cp -ar bash-${VERSION} bash-${VERSION}.orig
     46cd bash-${VERSION}
     47CURRENTDIR=$(pwd -P)
    4848
    4949# Download and Apply Patches
    5050#
    51 install -d ~/tmp/bash-${VERSION}-patches
    52 cd ~/tmp/bash-${VERSION}
    53 CURRENTDIR=$(pwd -P)
    5451PATCHURL=ftp://ftp.cwru.edu/pub/bash/bash-${VERSION}-patches
     52mkdir /tmp/bash-${VERSION}
    5553COUNT=1
    5654while [ ${COUNT} -le ${FILES} ]; do
    57   cd ~/tmp/bash-${VERSION}           
     55  cd /tmp/bash-${VERSION}           
    5856  DLCOUNT="${COUNT}"
    5957  SKIPME=no
     
    7371  if [ "${SKIPME}" != "yes" ]; then
    7472    if ! [ -e ${VERSION}.${DLCOUNT} ]; then
    75       cd ~/tmp/bash-${VERSION}-patches
    7673      wget --quiet ${PATCHURL}/bash${VERSION2}-${DLCOUNT}
    7774    fi
    7875    cd ${CURRENTDIR}
    79     patch --dry-run -s -f -Np0 -i ~/tmp/bash-${VERSION}-patches/bash${VERSION2}-${DLCOUNT}
     76    patch --dry-run -s -f -Np0 -i /tmp/bash-${VERSION}/bash${VERSION2}-${DLCOUNT}
    8077    if [ "$?" = "0" ]; then
    8178      echo "Patch bash${VERSION2}-${DLCOUNT} applied"
    82       patch -s -Np0 -i ~/tmp/bash-${VERSION}-patches/bash${VERSION2}-${DLCOUNT}
     79      patch -s -Np0 -i /tmp/bash-${VERSION}/bash${VERSION2}-${DLCOUNT}
    8380    else
    8481     echo "Patch bash${VERSION2}-${DLCOUNT} not applied"
    85      rm -f ~/tmp/bash-${VERSION}-patches/bash${VERSION2}-${DLCOUNT}
     82     rm -f /tmp/bash-${VERSION}/bash${VERSION2}-${DLCOUNT}
    8683     SKIPPED="${SKIPPED} ${DLCOUNT}"
    8784    fi
     
    9289# Cleanup Directory
    9390#
    94 cd ~/tmp/bash-${VERSION}
     91
    9592for dir in $(find * -type d); do
    96   cd ~/tmp/bash-${VERSION}/${dir}
     93  cd /usr/src/bash-${VERSION}/${dir}
    9794  for file in $(find . -name '*~'); do
    9895    rm -f ${file}
     
    10299  done
    103100done
    104 cd ~/tmp/bash-${VERSION}
     101cd /usr/src/bash-${VERSION}
    105102rm -f *~ *.orig
    106103
    107104# Create Patch
    108105#
    109 cd ~/tmp
    110 install -d ~/patches
    111 echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    112 echo "Date: `date +%m-%d-%Y`" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    113 echo "Initial Package Version: ${VERSION}" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    114 echo "Origin: Upstream" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    115 echo "Upstream Status: Applied" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    116 echo "Description: Contains all upstream patches up to ${VERSION}-${FILES}" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     106cd /usr/src
     107echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     108echo "Date: `date +%m-%d-%Y`" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     109echo "Initial Package Version: ${VERSION}" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     110echo "Origin: Upstream" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     111echo "Upstream Status: Applied" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     112echo "Description: Contains all upstream patches up to ${VERSION}-${FILES}" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    117113if [ -n "${SKIPPED}" ]; then
    118   echo "             The following patches were skipped" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    119   echo "            ${SKIPPED}" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     114  echo "             The following patches were skipped" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     115  echo "            ${SKIPPED}" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    120116fi
    121 echo "" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    122 diff -Naur bash-${VERSION}.orig bash-${VERSION} >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    123 echo "Created ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch."
    124 
    125 # Cleanup Directory
    126 #
    127 cd ~/tmp
    128 rm -rf bash-${VERSION} bash-${VERSION}.orig
     117echo "" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     118diff -Naur bash-${VERSION}.orig bash-${VERSION} >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     119echo "Created /usr/src/bash-${VERSION}-branch_update-${PATCH_NUM}.patch."
Note: See TracChangeset for help on using the changeset viewer.