File: mangle-source.sh

package info (click to toggle)
vice 1.19-1etch1
  • links: PTS
  • area: contrib
  • in suites: etch
  • size: 27,132 kB
  • ctags: 33,406
  • sloc: ansic: 257,145; cpp: 13,395; sh: 3,674; makefile: 3,380; perl: 1,801; yacc: 622; lex: 258; asm: 4
file content (32 lines) | stat: -rw-r--r-- 600 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#! /bin/sh
MANGLEDIR=`pwd`/mangle.tmp
MODULO=2048

set -e

[ $# -eq 1 ] || { echo specify pristine tar-ball as argument; exit 1; }

[ -r $1 ] || { echo tar-ball $1 is not readable; exit 2; }

rm -fr $MANGLEDIR
mkdir $MANGLEDIR

gzip -d <"$1" | {
  cd $MANGLEDIR
  tar xf -

  find vice*/data/* -type f -exec wc -c '{}' ';' | while read SIZE FILE; do
    if [ $SIZE -eq $[ ( $SIZE / $MODULO ) * $MODULO ] ]; then
      echo mangling $FILE $SIZE 1>&2
      echo dummy > $FILE
    fi
  done

  tar cf - * 
} | gzip -c9 >"$1.mangled"

rm -fr $MANGLEDIR

echo Complete with:  mv "$1.mangled" "$1"

exit 0