Ignore:
File:
1 edited

Legend:

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

    rc7ef534 rd8a9d8b  
    1616# Get the # of Patches
    1717#
    18 cd /usr/src
     18install -d ~/tmp
     19cd ~/tmp
    1920wget ftp://ftp.cwru.edu/pub/bash/bash-${VERSION}-patches/ --no-remove-listing
    2021VERSION2=$(echo ${VERSION} | sed -e 's/\.//g')
     
    3334# Set Patch Number
    3435#
    35 cd /usr/src
     36cd ~/tmp
    3637wget http://svn.cross-lfs.org/svn/repos/cross-lfs/trunk/patches/ --no-remove-listing
    3738PATCH_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)
     
    4142# Cleanup Directory
    4243#
     44cd ~/tmp
    4345rm -rf bash-${VERSION} bash-${VERSION}.orig
    4446tar xvf bash-${VERSION}.tar.gz
    4547cp -ar bash-${VERSION} bash-${VERSION}.orig
    46 cd bash-${VERSION}
    47 CURRENTDIR=$(pwd -P)
    4848
    4949# Download and Apply Patches
    5050#
     51install -d ~/tmp/bash-${VERSION}-patches
     52cd ~/tmp/bash-${VERSION}
     53CURRENTDIR=$(pwd -P)
    5154PATCHURL=ftp://ftp.cwru.edu/pub/bash/bash-${VERSION}-patches
    52 mkdir /tmp/bash-${VERSION}
    5355COUNT=1
    5456while [ ${COUNT} -le ${FILES} ]; do
    55   cd /tmp/bash-${VERSION}           
     57  cd ~/tmp/bash-${VERSION}           
    5658  DLCOUNT="${COUNT}"
    5759  SKIPME=no
     
    7173  if [ "${SKIPME}" != "yes" ]; then
    7274    if ! [ -e ${VERSION}.${DLCOUNT} ]; then
     75      cd ~/tmp/bash-${VERSION}-patches
    7376      wget --quiet ${PATCHURL}/bash${VERSION2}-${DLCOUNT}
    7477    fi
    7578    cd ${CURRENTDIR}
    76     patch --dry-run -s -f -Np0 -i /tmp/bash-${VERSION}/bash${VERSION2}-${DLCOUNT}
     79    patch --dry-run -s -f -Np0 -i ~/tmp/bash-${VERSION}-patches/bash${VERSION2}-${DLCOUNT}
    7780    if [ "$?" = "0" ]; then
    7881      echo "Patch bash${VERSION2}-${DLCOUNT} applied"
    79       patch -s -Np0 -i /tmp/bash-${VERSION}/bash${VERSION2}-${DLCOUNT}
     82      patch -s -Np0 -i ~/tmp/bash-${VERSION}-patches/bash${VERSION2}-${DLCOUNT}
    8083    else
    8184     echo "Patch bash${VERSION2}-${DLCOUNT} not applied"
    82      rm -f /tmp/bash-${VERSION}/bash${VERSION2}-${DLCOUNT}
     85     rm -f ~/tmp/bash-${VERSION}-patches/bash${VERSION2}-${DLCOUNT}
    8386     SKIPPED="${SKIPPED} ${DLCOUNT}"
    8487    fi
     
    8992# Cleanup Directory
    9093#
    91 
     94cd ~/tmp/bash-${VERSION}
    9295for dir in $(find * -type d); do
    93   cd /usr/src/bash-${VERSION}/${dir}
     96  cd ~/tmp/bash-${VERSION}/${dir}
    9497  for file in $(find . -name '*~'); do
    9598    rm -f ${file}
     
    99102  done
    100103done
    101 cd /usr/src/bash-${VERSION}
     104cd ~/tmp/bash-${VERSION}
    102105rm -f *~ *.orig
    103106
    104107# Create Patch
    105108#
    106 cd /usr/src
    107 echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    108 echo "Date: `date +%m-%d-%Y`" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    109 echo "Initial Package Version: ${VERSION}" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    110 echo "Origin: Upstream" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    111 echo "Upstream Status: Applied" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    112 echo "Description: Contains all upstream patches up to ${VERSION}-${FILES}" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     109cd ~/tmp
     110install -d ~/patches
     111echo "Submitted By: Jim Gifford (jim at cross-lfs dot org)" > ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     112echo "Date: `date +%m-%d-%Y`" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     113echo "Initial Package Version: ${VERSION}" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     114echo "Origin: Upstream" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     115echo "Upstream Status: Applied" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     116echo "Description: Contains all upstream patches up to ${VERSION}-${FILES}" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    113117if [ -n "${SKIPPED}" ]; then
    114   echo "             The following patches were skipped" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    115   echo "            ${SKIPPED}" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     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
    116120fi
    117 echo "" >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    118 diff -Naur bash-${VERSION}.orig bash-${VERSION} >> bash-${VERSION}-branch_update-${PATCH_NUM}.patch
    119 echo "Created /usr/src/bash-${VERSION}-branch_update-${PATCH_NUM}.patch."
     121echo "" >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     122diff -Naur bash-${VERSION}.orig bash-${VERSION} >> ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch
     123echo "Created ~/patches/bash-${VERSION}-branch_update-${PATCH_NUM}.patch."
     124
     125# Cleanup Directory
     126#
     127cd ~/tmp
     128rm -rf bash-${VERSION} bash-${VERSION}.orig
Note: See TracChangeset for help on using the changeset viewer.