This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 11th, 2013  |  syntax: Bash  |  size: 0.74 KB  |  views: 39  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/sh
  2.  
  3. # loffice-freetype.sh: skip downloading external freetype (for use with alien's
  4. # libreoffice.SlackBuild).
  5.  
  6. FILE=libreoffice.SlackBuild
  7. BACKUP=$FILE.orig
  8. FREETYPE_INDEX=$(sed -n 's/^SOURCE\[\([0-9]\{1,\}\)\]=.*freetype.*/\1/p' $FILE)
  9. LAST_INDEX=$(sed -n 's/^SOURCE\[\([0-9]\{1,\}\)\].*/\1/p' $FILE | tail -1)
  10.  
  11. # Create a backup of the SlackBuild:
  12. printf "Backup: "
  13. cp -v $FILE $BACKUP || exit 1
  14.  
  15. # Remove freetype from SOURCE and SRCURL arrays:
  16. sed -i "/^SOURCE\[$FREETYPE_INDEX\]=/,/^SRCURL\[$FREETYPE_INDEX\]=/d" $FILE
  17.  
  18. # Adjust the rest of the index numbers to fill the gap:
  19. for ((i=$FREETYPE_INDEX; i<=$LAST_INDEX; i++)); do
  20.   sed -i "/^SOURCE\[$i\]=/s/$i/$((i-1))/" $FILE
  21.   sed -i "/^SRCURL\[$i\]=/s/$i/$((i-1))/" $FILE
  22. done
clone this paste RAW Paste Data