5b7429
#!/bin/sh
5b7429
set -e
5b7429
# https://bugzilla.redhat.com/show_bug.cgi?id=1142153
5b7429
M=META-INF/MANIFEST.MF
5b7429
#P=/usr/lib/jvm/java/jre/lib/security/policy
5b7429
P=$1/lib/security/policy
5b7429
ERRORS=0
5b7429
  for type in unlimited limited ; do
5b7429
for f in local_policy.jar US_export_policy.jar ; do
5b7429
ORIG=$P/$type/$f
5b7429
echo "processing $f ($ORIG)"
5b7429
if [ ! -f  $ORIG ]; then
5b7429
  echo "File not found! $ORIG"
5b7429
  let ERRORS=$ERRORS+1
5b7429
  continue
5b7429
fi
5b7429
d=`mktemp -d`
5b7429
NW=$d/$f
5b7429
  pushd $d
5b7429
    jar  xf   $ORIG
5b7429
    cat $M
5b7429
#    sed -i "s/Created-By.*/Created-By: 1.7.0/g"  $M
5b7429
    sed -i "s/Created-By.*/Created-By: $2/g"  $M
5b7429
    cat $M
5b7429
    find . -exec touch -t 201401010000 {} +
5b7429
    zip -rX  $f *
5b7429
  popd
5b7429
  echo "replacing  $ORIG"
5b7429
  touch -t 201401010000 $ORIG
5b7429
  md5sum    $ORIG
5b7429
  sha256sum $ORIG
5b7429
  echo "by $NW"
5b7429
  md5sum    $NW
5b7429
  sha256sum $NW
5b7429
  touch -t 201401010000 $NW
5b7429
  cp $NW $ORIG
5b7429
  md5sum    $ORIG
5b7429
  sha256sum $ORIG
5b7429
  touch -t 201401010000 $ORIG
5b7429
  rm -rfv $d
5b7429
done
5b7429
  done
5b7429
5b7429
exit $ERRORS