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