Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.67 KB | None | 0 0
  1. !#/bin/env sh
  2.  
  3. PORTDIR="/portage/tree/dir"
  4. OVERLAY="/nginx/overaly/dir"
  5. PATCHES="/nginx/patches/dir/"
  6.  
  7. die () {
  8.     echo "$1"
  9.     exit "${2:-1}"
  10. }
  11.  
  12. die "Path not set!"
  13.  
  14. for e in "${PORTDIR}"/www-servers/nginx/*.ebuild; do
  15.     name=$(basename "$e")
  16.     target="${OVERLAY}/${name}"
  17.  
  18.     if [ "$e" -nt "$target" ]; then
  19.         prefix=$(qatom "$name" | cut -d' ' -f3-4 | tr ' ' '/')
  20.  
  21.         while ! [ -d "${PATCHES}/$prefix" ]; do
  22.             prefix=$(dirname "$prefix")
  23.         done
  24.  
  25.         cp -f "$e" "$target"
  26.  
  27.         for p in "${PATCHES}/${prefix}"/*.patch; do
  28.             patch "$target" "$p" || die "patch $p -- failed!"
  29.         done
  30.     fi
  31. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement