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