File: getweb.in

package info (click to toggle)
foo2zjs 20050217-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,364 kB
  • ctags: 2,122
  • sloc: ansic: 15,074; xml: 1,751; makefile: 503; sh: 269; perl: 102
file content (183 lines) | stat: -rwxr-xr-x 3,990 bytes parent folder | download
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/bin/sh

WGETOPTS=--passive-ftp

usage() {
cat <<EOF
Usage:
    ./getweb something

    Convenience script to get extra somethings from the web,
    such as ICC color profiles, firmware, PPD files, etc.

    $ ./getweb 2300	# Get Minolta 2300 DL .ICM files
    $ ./getweb 2200	# Get Minolta 2200 DL .ICM files
    $ ./getweb cpwl	# Get Minolta Color PageWorks/Pro L .ICM files

    $ ./getweb 1005	# Get HP LJ1005 firmware file
    $ ./getweb 1000	# Get HP LJ1000 firmware file

    $ ./getweb 2300dl_fw # Get Minolta 2300DL v2.55 firmware (experts only)

    $ ./getweb update	# Get latest version of this software.
EOF
    exit 1
}

#
#       Report an error and exit
#
PROGNAME=$0
error() {
	echo "`basename $PROGNAME`: $1" >&2
	exit 1
}

#
#	Download a .EXE file from the web, unzip it, and extract the
#	files we want
getexe() {
    url="$1"
    exefile="$2"
    what="$3"
    
    wget $WGETOPTS -O $exefile "$url/$exefile" ||
	error "Couldn't download $url/$exefile"
    unzip -o $exefile "$what"
    rm $exefile
}

getone() {
    case "$1" in
    lj1000|1000)
	getexe \
	    ftp://ftp.hp.com/pub/softlib/software1/lj1488/lj-1145-2 \
	    lj1488en.exe \
	    sihp1000.img
	;;
    new1000)
	getexe \
	    ftp://ftp.hp.com/pub/softlib/software1/COL1032/lj-1230-2 \
	    lj1000hostbased-en.exe \
	    sihp1000.img
	;;
    lj1005|1005)
	getexe \
	    ftp://ftp.hp.com/pub/softlib/software2/COL2222/lj-10067-2 \
	    lj1005hostbased-en.exe \
	    sihp1005.img
	;;
    2200dl|2200)
	getexe \
	    ftp://ftp.minolta-qms.com/pub/crc/out_going/win2000 m22dlicc.exe \
	    "*.icm"
	;;
    2300dl|2300)
	getexe \
	    ftp://ftp.minolta-qms.com/pub/crc/out_going/win m23dlicc.exe \
	    "*.icm"
	;;
    2300dl_fw)
	# 2300DL firmware upgrade to v2.55
	BASE="http://crm01.minoltaeurope.com"
	BASE="$BASE/openmind/technic/swfw/mswprtdl.nsf/logdwl"
	FILE="MC2300DL_v255.zip"
	URL="$BASE?openagent&4CE486C20839C75AC1256D9E001EBD1F/\$File/$FILE"
	wget $WGETOPTS "$URL" || error "Couldn't download $URL"
	echo "*** Now use a windows box to unzip and install $FILE ***"
	;;
    cpwl|pageworks)
	getexe \
	    ftp://ftp.minolta-qms.com/pub/crc/out_going/windows cpplxp.exe \
	    "*.IC_"
	for i in C*.IC_
	do
	    base=`basename $i .IC_`
	    mv $base.IC_ $base.ic_
	    ./msexpand $base.ic_
	    rm -f $base.ic_
	done
	;;
    PPD)
	# Snarf PPD files from linuxprinting
	[ -d PPD ] || mkdir PPD
	for i in foomatic-db/printer/*.xml
	do
	    case "$i" in
	    */Gen*)	continue;;
	    esac
	    printer=`basename $i .xml`
	    echo $printer
	    case "$printer" in
	    *1500*|*oak*)	driver=foo2oak;;
	    *)			driver=foo2zjs;;
	    esac
	    URL="http://www.linuxprinting.org/ppd-o-matic.cgi"
	    URL="$URL?driver=$driver&printer=$printer"
	    URL="$URL&.submit=Generate+PPD+file"
	    URL="$URL&show=1&.cgifields=shortgui&.cgifields=show"
	    wget $WGETOPTS -O PPD/$printer.ppd "$URL" ||
		error "Couldn't dowload $URL"
	done
	;;
    ppd)
	# Generate PPD files using local tools
	[ -d PPD ] || mkdir PPD
	for i in foomatic-db/printer/*.xml
	do
	    printer=`basename $i .xml`
	    echo $printer
	    case "$printer" in
	    *1500*|*OAKT*)	driver=foo2oak;;
	    *)			driver=foo2zjs;;
	    esac
	    ENGINE=../foomatic/foomatic-db-engine
	    PERL5LIB=$ENGINE/lib $ENGINE/foomatic-ppdfile \
		-d $driver -p $printer > PPD/$printer.ppd
	done
	;;
    update)
	url=${URLZJS}
	file=foo2zjs.tar.gz
	wget $WGETOPTS -O $file $url/$file ||
		error "Couldn't download $url/$exefile"
	mv getweb getweb.old
	HERE=`pwd`
	cd .. 
	tar zxf $HERE/$file
	cd $HERE
	echo "The tarball is extracted and the current directory is up to date."
	echo -e "Remove the tarball (y/n)? \c"
	read ans
	if [ "$ans" = y ]; then
	    rm -f $file
	fi
	;;
    "")
	usage
	;;
    *)
	error "Don't know how to get extra stuff for printer $1"
	;;
    esac
}

if [ $# = 0 ]; then
    usage
fi

for i in $*
do
    case "$1" in
    all)
	getone 1000
	getone 1005
	getone 2200
	getone 2300
	getone cpwl
	;;
    *)	
	getone $i
	;;
    esac
done