3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5
# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
7
# The contents of this file are subject to the terms of either the GNU General Public
8
# License Version 2 only ("GPL") or the Common Development and Distribution
9
# License("CDDL") (collectively, the "License"). You may not use this file except in
10
# compliance with the License. You can obtain a copy of the License at
11
# http://www.netbeans.org/cddl-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
12
# License for the specific language governing permissions and limitations under the
13
# License. When distributing the software, include this License Header Notice in
14
# each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP. Sun
15
# designates this particular file as subject to the "Classpath" exception as provided
16
# by Sun in the GPL Version 2 section of the License file that accompanied this code.
17
# If applicable, add the following below the License Header, with the fields enclosed
18
# by brackets [] replaced by your own identifying information:
19
# "Portions Copyrighted [year] [name of copyright owner]"
23
# The Original Software is NetBeans. The Initial Developer of the Original Software
24
# is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
27
# If you wish your version of this file to be governed by only the CDDL or only the
28
# GPL Version 2, indicate your decision by adding "[Contributor] elects to include
29
# this software in this distribution under the [CDDL or GPL Version 2] license." If
30
# you do not indicate a single choice of license, a recipient has the option to
31
# distribute your version of this file under either the CDDL, the GPL Version 2 or
32
# to extend the choice of license to its licensees as provided above. However, if you
33
# add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
34
# option applies only if the new code is made subject to such option by the copyright
39
output_file=./js/files.js
40
type digest >> /dev/null 2>&1
41
if [ 0 -eq $? ] ; then
45
type md5sum >> /dev/null 2>&1
46
if [ 0 -eq $? ] ; then
49
type gmd5sum >> /dev/null 2>&1
50
if [ 0 -eq $? ] ; then
53
type md5 >> /dev/null 2>&1
54
if [ 0 -eq $? ] ; then
60
if [ -z "$alg" ] ; then
61
echo "Cannot find MD5 calculating programm"
64
echo "...getting MD5 with the help of $alg"
68
while [ $# != 0 ] ; do
69
echo "Target directory : $1"
70
for nextfile in `ls -1 "$1"` ; do
71
nextfile="$1"/"$nextfile"
72
if [ -f "$nextfile" ] ; then
73
if [ 0 -eq $counter ] ; then
74
mkdir -p `dirname "$output_file"`
76
echo "file_names = new Array();" >> "$output_file"
77
echo "file_sizes = new Array();" >> "$output_file"
78
echo "file_md5s = new Array();" >> "$output_file"
80
name=`basename "$nextfile"`
82
echo "... file : `basename $nextfile`"
83
size=`ls -l "$nextfile" | awk ' { print $5 }' 2>/dev/null`
84
echo "... size : $size"
85
md5=`$alg "$nextfile" | sed "s/ .*//g"`
87
echo "file_names["$counter"]=\"$name\";" >> "$output_file"
88
echo "file_sizes["$counter"]=$size;" >> "$output_file"
89
echo "file_md5s["$counter"]=\"$md5\";" >> "$output_file"
90
counter=`expr $counter + 1`