File: check-zip-names.sh

package info (click to toggle)
fpc 3.2.0%2Bdfsg-12
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, bullseye-backports
  • size: 338,552 kB
  • sloc: pascal: 3,794,737; xml: 191,997; ansic: 9,637; asm: 8,482; java: 5,346; sh: 4,664; yacc: 3,751; makefile: 2,688; lex: 2,538; javascript: 2,375; sql: 929; php: 473; cpp: 145; perl: 134; sed: 132; csh: 34; tcl: 7
file content (60 lines) | stat: -rw-r--r-- 1,560 bytes parent folder | download | duplicates (4)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env bash
#
# The names generated by the batch file win-to-dos-zips.bat
# are not correctly "shortened" by
# make shortnames
# This small script tries to simplify this task
# Requires a Cygwin/Msys installation
# Must to launched at fpcbuild directory level

ziplist=`(cd go32v2-zips; ls *.zip)`

cat go32v2-zips/install.dat | gawk '
BEGIN {
 do_print=0
}
/Source packages/ {do_print=1;}
/targetname=go32v2/ {do_print=1;}
/targetname=i386-win32/ {do_print=0;}
/targetname=i386-os2/ {do_print=0;}
/targetname=emx/ {do_print=0;}
/defaultcfg=/ {do_print=0;}
/.*/ { if (do_print == 1) print $0; } ' > go32v2-zips/install-go32v2.dat

function check ()
{
  file=$1
  origfile=$2
  echo Testing $file
  line=`grep $file go32v2-zips/install-go32v2.dat`
  if [ "X$line" != "X" ] ; then
    echo "Found line is \"$line\""
    shortname=`echo $line | sed -n "s:.*\[\(.*\)\].*:\1:p"`
    echo "ShortName is \"$shortname\""
    if [ "X$shortname" != "X" ] ; then
      if [ "X$shortname" != "X$origfile" ] ; then
        echo "Moving $origfile to $shortname"
        mv go32v2-zips/$origfile go32v2-zips/$shortname
      fi
    fi
  fi
}

for file in $ziplist ; do
  origfile=$file
  check $file $origfile
  file=${origfile/.source/src}
  check $file $origfile
  file=${origfile/u/units-}
  check $file $origfile
  file=${origfile/u/utils-}
  check $file $origfile
done

zipindat=`(cd go32v2-zips; sed -n "s:.*\[\(.*\)\].*:\1:p" install-go32v2.dat)`

for file in $zipindat ; do
  if [ ! -f go32v2-zips/$file ] ; then
    echo "file \"$file\" not found"
  fi
done