blob: 979320fca189e44d3a794c13534c77041e5796ae (
plain)
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
|
#!/bin/bash
check_cups() {
echo ""
echo ""
echo ""
echo "==============================================================================="
echo "== Check cups is started : =="
echo "== systemctl status org.cups.cupsd.service =="
echo "== =="
echo "== If not, start cups : =="
echo "== sudo systemctl start org.cups.cupsd.service =="
echo "== For start cups at boot : =="
echo "== sudo systemctl enable org.cups.cupsd.service =="
echo "== =="
echo "== Install your printer with cups : http://localhost:631 =="
echo "== Select ppd file in =="
echo "== /usr/share/cups/model/Lexmark =="
echo "== /usr/share/ppd/Lexmark =="
echo "==============================================================================="
}
post_install() {
echo 'Executing post install scripts ...'
ABS_ROOT=/usr/local/lexmark/legacy
REL_ROOT=/usr/local/lexmark/legacy
OEM=lexmark
release=`cat /etc/*release | grep Ubuntu`
if [ "$release" != "" ]; then
if [ -f $ABS_ROOT/bin/.scripts/apparmor.pl ]; then
perl $ABS_ROOT/bin/.scripts/apparmor.pl
apparmor_parser -r /etc/apparmor.d/usr.sbin.cupsd
fi
fi
echo 'update the demon script'
_ESC=`echo $ABS_ROOT | sed 's/\//\\\\\//g'`
if [ -f ${ABS_ROOT}/bin/.scripts/demon ]; then
cat ${ABS_ROOT}/bin/.scripts/demon | sed -e "s/__OEM__/${OEM}/" | sed -e "s/__ABS_ROOT__/${_ESC}/" > ${ABS_ROOT}/bin/.scripts/demon_tmp
mv ${ABS_ROOT}/bin/.scripts/demon_tmp ${ABS_ROOT}/bin/.scripts/demon
fi
script=''
#this is for fedora & suse
if [ -d /etc/X11/xinit/xinitrc.d ]; then
if [ ! -f /etc/X11/xinit/xinitrc.d/99demon2 ]; then
cp ${ABS_ROOT}/bin/.scripts/demon /etc/X11/xinit/xinitrc.d/99demon2
chmod 555 /etc/X11/xinit/xinitrc.d/99demon2
script='/etc/X11/xinit/xinitrc.d/99demon2'
fi
fi
#this is for ubuntu
if [ -d /etc/X11/Xsession.d ]; then
if [ ! -f /etc/X11/Xsession.d/99demon2 ]; then
cp ${ABS_ROOT}/bin/.scripts/demon /etc/X11/Xsession.d/99demon2
chmod 555 /etc/X11/Xsession.d/99demon2
script='/etc/X11/Xsession.d/99demon2'
fi
fi
echo 'create the pid file'
if [ ! -d /var/run/${OEM} ]; then
mkdir /var/run/${OEM}
fi
if [ -f /var/run/${OEM}/demond2.pid ]; then
chmod 666 /var/run/${OEM}/demond2.pid
else
echo > /var/run/${OEM}/demond2.pid
chmod 666 /var/run/${OEM}/demond2.pid
fi
echo 'terminate previous running instance/s of device monitor'
killall -9 demond > /dev/null 2>&1
#get the username used to logged in to the
#system by checking the USER environment variables
user1=$USER
user2=$SUDO_USER
user3=$USERNAME
username="root"
# if [ "$user1" != "root" ]; then
# username=$user1;
# elif [ "$user2" != "root" ]; then
# username=$user2;
# elif [ "$user3" != "root" ]; then
# username=$user3;
# fi
echo 'run device monitor'
#TODO: investigate other ways to run daemon
#/bin/sh ${script}
if [ $username == "root" ]; then
#/bin/sh /usr/local/lexmark/legacy/bin/.scripts/demon
/bin/sh $script
else
sudo -u $username /usr/local/lexmark/legacy/bin/.scripts/demon
if [ $? -ne 0 ]; then
#/bin/sh /usr/local/lexmark/legacy/bin/.scripts/demon
/bin/sh $script
fi
fi;
echo 'add symbolic link to /usr/lib for 2008 HPEs'
if [ ! -d ${REL_ROOT} ]; then
ln -s ${ABS_ROOT} ${REL_ROOT}
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrf08flib ]; then
ln -s ${REL_ROOT}/lib/liblxkrf08flib.so ${REL_ROOT}/lib/liblxkrf08flib
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrf08flib ]; then
ln -s ${REL_ROOT}/lib/liblxkrf08flib.so /usr/lib/liblxkrf08flib
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrf08flib ]; then
ln -s ${REL_ROOT}/lib/liblxkrf08flib.so /usr/lib/liblxkrf08flib.so
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrf08hpec ]; then
ln -s ${REL_ROOT}/lib/liblxkrf08hpec.so ${REL_ROOT}/lib/liblxkrf08hpec
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrf08hpec ]; then
ln -s ${REL_ROOT}/lib/liblxkrf08hpec.so /usr/lib/liblxkrf08hpec
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrf08hpec ]; then
ln -s ${REL_ROOT}/lib/liblxkrf08hpec.so /usr/lib/liblxkrf08hpec.so
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrf08hpeh ]; then
ln -s ${REL_ROOT}/lib/liblxkrf08hpeh.so ${REL_ROOT}/lib/liblxkrf08hpeh
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrf08hpeh ]; then
ln -s ${REL_ROOT}/lib/liblxkrf08hpeh.so /usr/lib/liblxkrf08hpeh
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrf08hpeh ]; then
ln -s ${REL_ROOT}/lib/liblxkrf08hpeh.so /usr/lib/liblxkrf08hpeh.so
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrf08hpep ]; then
ln -s ${REL_ROOT}/lib/liblxkrf08hpep.so ${REL_ROOT}/lib/liblxkrf08hpep
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrf08hpep ]; then
ln -s ${REL_ROOT}/lib/liblxkrf08hpep.so /usr/lib/liblxkrf08hpep
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrf08hpep ]; then
ln -s ${REL_ROOT}/lib/liblxkrf08hpep.so /usr/lib/liblxkrf08hpep.so
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrs08flib ]; then
ln -s ${REL_ROOT}/lib/liblxkrs08flib.so ${REL_ROOT}/lib/liblxkrs08flib
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrs08flib ]; then
ln -s ${REL_ROOT}/lib/liblxkrs08flib.so /usr/lib/liblxkrs08flib
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrs08flib ]; then
ln -s ${REL_ROOT}/lib/liblxkrs08flib.so /usr/lib/liblxkrs08flib.so
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrs08hpec ]; then
ln -s ${REL_ROOT}/lib/liblxkrs08hpec.so ${REL_ROOT}/lib/liblxkrs08hpec
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrs08hpec ]; then
ln -s ${REL_ROOT}/lib/liblxkrs08hpec.so /usr/lib/liblxkrs08hpec
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrs08hpec ]; then
ln -s ${REL_ROOT}/lib/liblxkrs08hpec.so /usr/lib/liblxkrs08hpec.so
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrs08hpeh ]; then
ln -s ${REL_ROOT}/lib/liblxkrs08hpeh.so ${REL_ROOT}/lib/liblxkrs08hpeh
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrs08hpeh ]; then
ln -s ${REL_ROOT}/lib/liblxkrs08hpeh.so /usr/lib/liblxkrs08hpeh
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrs08hpeh ]; then
ln -s ${REL_ROOT}/lib/liblxkrs08hpeh.so /usr/lib/liblxkrs08hpeh.so
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrs08hpep ]; then
ln -s ${REL_ROOT}/lib/liblxkrs08hpep.so ${REL_ROOT}/lib/liblxkrs08hpep
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrs08hpep ]; then
ln -s ${REL_ROOT}/lib/liblxkrs08hpep.so /usr/lib/liblxkrs08hpep
fi
if [ ! -f ${REL_ROOT}/lib/liblxkrs08hpep ]; then
ln -s ${REL_ROOT}/lib/liblxkrs08hpep.so /usr/lib/liblxkrs08hpep.so
fi
if [ ! -f ${REL_ROOT}/lib/liblxkyf08flib ]; then
ln -s ${REL_ROOT}/lib/liblxkyf08flib.so ${REL_ROOT}/lib/liblxkyf08flib
fi
if [ ! -f ${REL_ROOT}/lib/liblxkyf08flib ]; then
ln -s ${REL_ROOT}/lib/liblxkyf08flib.so /usr/lib/liblxkyf08flib
fi
if [ ! -f ${REL_ROOT}/lib/liblxkyf08flib ]; then
ln -s ${REL_ROOT}/lib/liblxkyf08flib.so /usr/lib/liblxkyf08flib.so
fi
if [ ! -f ${REL_ROOT}/lib/liblxkyf08hpec ]; then
ln -s ${REL_ROOT}/lib/liblxkyf08hpec.so ${REL_ROOT}/lib/liblxkyf08hpec
fi
if [ ! -f ${REL_ROOT}/lib/liblxkyf08hpec ]; then
ln -s ${REL_ROOT}/lib/liblxkyf08hpec.so /usr/lib/liblxkyf08hpec
fi
if [ ! -f ${REL_ROOT}/lib/liblxkyf08hpec ]; then
ln -s ${REL_ROOT}/lib/liblxkyf08hpec.so /usr/lib/liblxkyf08hpec.so
fi
if [ ! -f ${REL_ROOT}/lib/liblxkyf08hpeh ]; then
ln -s ${REL_ROOT}/lib/liblxkyf08hpeh.so ${REL_ROOT}/lib/liblxkyf08hpeh
fi
if [ ! -f ${REL_ROOT}/lib/liblxkyf08hpeh ]; then
ln -s ${REL_ROOT}/lib/liblxkyf08hpeh.so /usr/lib/liblxkyf08hpeh
fi
if [ ! -f ${REL_ROOT}/lib/liblxkyf08hpeh ]; then
ln -s ${REL_ROOT}/lib/liblxkyf08hpeh.so /usr/lib/liblxkyf08hpeh.so
fi
if [ ! -f ${REL_ROOT}/lib/liblxkyf08hpep ]; then
ln -s ${REL_ROOT}/lib/liblxkyf08hpep.so ${REL_ROOT}/lib/liblxkyf08hpep
fi
if [ ! -f ${REL_ROOT}/lib/liblxkyf08hpep ]; then
ln -s ${REL_ROOT}/lib/liblxkyf08hpep.so /usr/lib/liblxkyf08hpep
fi
if [ ! -f ${REL_ROOT}/lib/liblxkyf08hpep ]; then
ln -s ${REL_ROOT}/lib/liblxkyf08hpep.so /usr/lib/liblxkyf08hpep.so
fi
if [ ! -f ${REL_ROOT}/lib/liblxknf09hpec ]; then
ln -s ${REL_ROOT}/lib/liblxknf09hpec.so ${REL_ROOT}/lib/liblxknf09hpec
fi
if [ ! -f ${REL_ROOT}/lib/liblxkns09hpec ]; then
ln -s ${REL_ROOT}/lib/liblxkns09hpec.so ${REL_ROOT}/lib/liblxkns09hpec
fi
if [ ! -f ${REL_ROOT}/lib/liblxknf10hpec ]; then
ln -s ${REL_ROOT}/lib/liblxknf10hpec.so ${REL_ROOT}/lib/liblxknf10hpec
fi
if [ ! -f ${REL_ROOT}/lib/liblxkns10hpec ]; then
ln -s ${REL_ROOT}/lib/liblxkns10hpec.so ${REL_ROOT}/lib/liblxkns10hpec
fi
if [ ! -d ${REL_ROOT} ]; then
ln -s ${ABS_ROOT} ${REL_ROOT}
fi
BIN_FILENAME=lxhcp
CUPS_BACKEND_ROOT="/usr/lib/cups/backend"
CUPS_BACKEND_ROOT_64="/usr/lib64/cups/backend"
MACHINE_TYPE_A=`uname -m`
MACHINE_TYPE_B=`uname -i`
CUPS_BACKEND_PATH=$CUPS_BACKEND_ROOT
if [ ${MACHINE_TYPE_A} = 'x86_64' -o ${MACHINE_TYPE_B} = 'x86_64' ]; then
if [ -d "$CUPS_BACKEND_ROOT_64" ]; then
CUPS_BACKEND_PATH=$CUPS_BACKEND_ROOT_64
else
CUPS_BACKEND_PATH=$CUPS_BACKEND_ROOT
fi
fi
if [ -f ${CUPS_BACKEND_PATH}/${BIN_FILENAME} ]; then
ver1=`${CUPS_BACKEND_PATH}/${BIN_FILENAME} -v`
ver2=`${ABS_ROOT}/bin/${BIN_FILENAME} -v`
major1=`echo $ver1 | awk -F. '{print $1}'`
major2=`echo $ver2 | awk -F. '{print $1}'`
minor1=`echo $ver1 | awk -F. '{print $2}'`
minor2=`echo $ver2 | awk -F. '{print $2}'`
if [ $major2 -gt $major1 ]; then
echo "Installing ${BIN_FILENAME} backend ..."
cp ${ABS_ROOT}/bin/${BIN_FILENAME} ${CUPS_BACKEND_PATH}/${BIN_FILENAME}
elif [ $major2 -eq $major1 ]; then
if [ $minor2 -gt $minor1 ]; then
echo "Installing ${BIN_FILENAME} backend ...";
cp ${ABS_ROOT}/bin/${BIN_FILENAME} ${CUPS_BACKEND_PATH}/${BIN_FILENAME}
fi
fi
else
echo "Installing ${BIN_FILENAME} backend ...";
cp ${ABS_ROOT}/bin/${BIN_FILENAME} ${CUPS_BACKEND_PATH}/${BIN_FILENAME}
fi
if [ ! -d ${REL_ROOT} ]; then
ln -s ${ABS_ROOT} ${REL_ROOT}
fi
SCAN_LIB="/usr/lib/sane"
SCAN_LIB_64="/usr/lib64/sane"
MACHINE_TYPE_A=`uname -m`
MACHINE_TYPE_B=`uname -i`
echo 'Install scanner ...'
if [ ${MACHINE_TYPE_A} = 'x86_64' -o ${MACHINE_TYPE_B} = 'x86_64' ]; then
if [ -d ${SCAN_LIB_64} ]; then
if [ ! -f ${SCAN_LIB_64}/libsane-LexmarkLegacy_1_0_0.so.1.0.18 ]; then
ln -s ${REL_ROOT}/lib/libsane-LexmarkLegacy_1_0_0.so.1.0.18 ${SCAN_LIB_64}/libsane-LexmarkLegacy_1_0_0.so.1.0.18
fi
if [ ! -f ${SCAN_LIB_64}/libsane-LexmarkLegacy_1_0_0.so.1 ]; then
ln -s ${REL_ROOT}/lib/libsane-LexmarkLegacy_1_0_0.so.1.0.18 ${SCAN_LIB_64}/libsane-LexmarkLegacy_1_0_0.so.1
fi
if [ ! -f ${SCAN_LIB_64}/libsane-LexmarkLegacy_1_0_0.so ]; then
ln -s ${REL_ROOT}/lib/libsane-LexmarkLegacy_1_0_0.so.1.0.18 ${SCAN_LIB_64}/libsane-LexmarkLegacy_1_0_0.so
fi
fi
fi
if [ -d ${SCAN_LIB} ]; then
if [ ! -f ${SCAN_LIB}/libsane-LexmarkLegacy_1_0_0.so.1.0.18 ]; then
ln -s ${REL_ROOT}/lib/libsane-LexmarkLegacy_1_0_0.so.1.0.18 ${SCAN_LIB}/libsane-LexmarkLegacy_1_0_0.so.1.0.18
fi
if [ ! -f ${SCAN_LIB}/libsane-LexmarkLegacy_1_0_0.so.1 ]; then
ln -s ${REL_ROOT}/lib/libsane-LexmarkLegacy_1_0_0.so.1.0.18 ${SCAN_LIB}/libsane-LexmarkLegacy_1_0_0.so.1
fi
if [ ! -f ${SCAN_LIB}/libsane-LexmarkLegacy_1_0_0.so ]; then
ln -s ${REL_ROOT}/lib/libsane-LexmarkLegacy_1_0_0.so.1.0.18 ${SCAN_LIB}/libsane-LexmarkLegacy_1_0_0.so
fi
fi
if [ ! -f /etc/sane.d/LexmarkLegacy_1_0_0.conf ]; then
ln -s ${REL_ROOT}/etc/LexmarkLegacy_1_0_0.conf /etc/sane.d/LexmarkLegacy_1_0_0.conf
fi
if [ ! -f /etc/udev/rules.d/99-lexmarklegacy-10.rules ]; then
ln -s ${REL_ROOT}/etc/99-lexmarklegacy-10.rules /etc/udev/rules.d/99-lexmarklegacy-10.rules
fi
if [ -f "/sbin/udevadm" ] ; then
udevadm_version=`/sbin/udevadm version`
udevadm_new_version=126
if [ $udevadm_version -gt $udevadm_new_version ] ; then
/sbin/udevadm control --reload-rules
else
/sbin/udevadm control --reload_rules
fi
fi
scanlib_dll=`grep LexmarkLegacy_1_0_0 /etc/sane.d/dll.conf`
if [ "$scanlib_dll" = "" ]; then
echo "LexmarkLegacy_1_0_0" >> /etc/sane.d/dll.conf
fi
# Check if xsane image location exists
if [ ! -f /usr/share/sane/xsane ]; then
# Copy scanner logo to xsane image location;
# replace if there's an existing image copy
cp -rf ${REL_ROOT}/etc/Lexmark-logo.xpm /usr/share/sane/xsane > /dev/null 2>&1
fi
#-- ADDED by rkhu (2010/09/08) ---
#-- DESC: Enable internationalization/localization support for
# linux scanner driver
# The name for .mo files (should match backend name)
MO_NAME="sane-LexmarkLegacy_1_0_0.mo"
# Get list of language directories (directories are assumed
# to have been named after standard locale names/abbreviations)
DIRS=`ls ${REL_ROOT}/etc/locale`
# For all language directories
for DIR in $DIRS
do
MO_PATH="/usr/share/locale/${DIR}/LC_MESSAGES/${MO_NAME}"
# Check if the language file is not existing in OS locale directory
if [ ! -f ${MO_PATH} ]; then
# Link language file to OS locale directory
ln -s ${REL_ROOT}/etc/locale/${DIR}/LC_MESSAGES/*.mo ${MO_PATH} > /dev/null 2>&1
fi
done
#-- END (2010/09/08) ---
if [ ! -d ${REL_ROOT} ]; then
ln -s ${ABS_ROOT} ${REL_ROOT}
fi
ROOT1=/usr/share/cups/model/Lexmark
ROOT2=/usr/share/ppd/Lexmark
if [ ! -d ${ROOT1} ]; then
mkdir -p ${ROOT1}
fi
if [ ! -d ${ROOT2} ]; then
mkdir -p ${ROOT2}
fi
for item in lxPro700.ppd lxS600.ppd lxPro200-S500.ppd lxS300-S400.ppd lxZ2400.ppd lxX2600.ppd lxPro800-Pro900.ppd lxX3646.ppd lxX5666.ppd lxX4900.ppd lxX7600.ppd lxZ2300.ppd; do
if [ ! -f ${ROOT1}/${item} ]; then
cp -R ${REL_ROOT}/etc/${item} ${ROOT1}/${item}
fi
if [ ! -f ${ROOT2}/${item} ]; then
cp -R ${REL_ROOT}/etc/${item} ${ROOT2}/${item}
fi
done
echo 'Install DBUS service umf ...'
DBUS_SERVICE=umf-legacy
DBUS_CID=mdwapclss.apps.umframework.DBusProxyLegacy
if [ -d /etc/dbus-1/session.d ]; then
if [ ! -f /etc/dbus-1/session.d/${DBUS_SERVICE}.conf ]; then
ln -s ${ABS_ROOT}/etc/umf.conf /etc/dbus-1/session.d/${DBUS_SERVICE}.conf
fi
fi
#this is for fedora & suse
if [ -d /etc/X11/xinit/xinitrc.d ]; then
if [ ! -f /etc/X11/xinit/xinitrc.d/99umf ]; then
cp ${ABS_ROOT}/bin/.scripts/99umf /etc/X11/xinit/xinitrc.d
chmod 555 /etc/X11/xinit/xinitrc.d/99umf
fi
fi
#this is for ubuntu
if [ -d /etc/X11/Xsession.d ]; then
if [ ! -f /etc/X11/Xsession.d/99umf ]; then
cp ${ABS_ROOT}/bin/.scripts/99umf /etc/X11/Xsession.d
chmod 644 /etc/X11/Xsession.d/99umf
fi
fi
echo 'creating the service file'
if [ ! -f /usr/share/dbus-1/services/${DBUS_SERVICE}.service ]; then
echo "[D-BUS Service]" > /usr/share/dbus-1/services/${DBUS_SERVICE}.service
echo "Name=${DBUS_CID}" >> /usr/share/dbus-1/services/${DBUS_SERVICE}.service
echo "Exec=${ABS_ROOT}/bin/.scripts/umf.sh" >> /usr/share/dbus-1/services/${DBUS_SERVICE}.service
fi
echo 'initializing umf.sh'
if [ -f ${ABS_ROOT}/bin/.scripts/umf.sh ]; then
rm -f ${ABS_ROOT}/bin/.scripts/umf.sh
fi
echo "#!/bin/sh" > ${ABS_ROOT}/bin/.scripts/umf.sh
echo "OS_ARCH=\`uname -aa | grep x86_64\`" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo "ARCH=''" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo "if [ -n \"\$OS_ARCH\" ]; then" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo " ARCH=64" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo "fi" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo "JAVA_CMD=java" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo "if [ -f \"/usr/local/lexmark/fwu_legacy/jre/bin/java\" ]; then" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo " JAVA_CMD=\"/usr/local/lexmark/fwu_legacy/jre/bin/java\"" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo "elif [ -f \"/usr/local/lexmark/wsu_legacy/jre/bin/java\" ]; then" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo " JAVA_CMD=\"/usr/local/lexmark/wsu_legacy/jre/bin/java\"" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo "elif [ -f \"/usr/local/lexmark/legacy/jre/bin/java\" ]; then" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo " JAVA_CMD=\"/usr/local/lexmark/legacy/jre/bin/java\"" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo "elif [ -f \"/usr/bin/java\" ]; then" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo " JAVA_CMD=\"/usr/bin/java\"" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo "elif [ -f \"/etc/alternatives/java\" ]; then" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo " JAVA_CMD=\"/etc/alternatives/java\"" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo "else" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo " exit 1" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo "fi" >> ${ABS_ROOT}/bin/.scripts/umf.sh
echo "\${JAVA_CMD} -Djava.library.path=${ABS_ROOT}/lib\${ARCH} -Ddbus=${DBUS_CID} -classpath ${ABS_ROOT}/jar/debug-disable-1.1.jar:${ABS_ROOT}/jar/hexdump-0.2.jar:${ABS_ROOT}/jar/libdbus-java-2.6.jar:${ABS_ROOT}/jar/unix-0.5.jar:${ABS_ROOT}/jar/xpp3_min-1.1.4c.jar:${ABS_ROOT}/jar/xstream-1.3.1.jar:${ABS_ROOT}/jar/uiframework.jar:${ABS_ROOT}/jar/tools.jar:${ABS_ROOT}/jar/devicecore.jar:${ABS_ROOT}/jar/config.jar:${ABS_ROOT}/jar/localize.jar:${ABS_ROOT}/jar/umframework.jar mdwapclss.apps.umframework.UserMessagingFramework" >> ${ABS_ROOT}/bin/.scripts/umf.sh
chmod +x ${ABS_ROOT}/bin/.scripts/umf.sh
#remove remnant
rm -f /tmp/.umf_*
if [ ! -f /usr/share/applications/lxtoolboxlegacy.desktop ];
then
cp ${ABS_ROOT}/etc/lxtoolbox.desktop /usr/share/applications/lxtoolboxlegacy.desktop
fi
if [ -f /usr/share/gnome-menus/update-gnome-menus-cache ];
then
/usr/share/gnome-menus/update-gnome-menus-cache /usr/share/applications > /tmp/app
ls /usr/share/applications | grep desktop | grep cache | xargs -ti cp /tmp/app /usr/share/applications/{} > /dev/null 2>&1
rm /tmp/app
fi
check_cups
}
post_upgrade() {
check_cups
}
pre_remove() {
echo 'Executing pre remove scripts ...'
ABS_ROOT=/usr/local/lexmark/legacy
REL_ROOT=/usr/local/lexmark/legacy
OEM=lexmark
echo 'Remove demond ...'
#this is for fedora & suse
if [ -f /etc/X11/xinit/xinitrc.d/99demon2 ]; then
rm -f /etc/X11/xinit/xinitrc.d/99demon2
fi
#this is for ubuntu
if [ -f /etc/X11/Xsession.d/99demon2 ]; then
rm -f /etc/X11/Xsession.d/99demon2
fi
echo 'delete demond2.pid'
if [ -f /var/run/lexmark/demond2.pid ]; then
rm -f /var/run/lexmark/demond2.pid
fi
echo 'terminate previous running instance/s of device monitor'
killall -9 demond > /dev/null 2>&1
echo 'Remove symbolic link to /usr/lib for 2008 HPEs'
if [ -f ${REL_ROOT}/lib/liblxkrf08flib ]; then
unlink ${REL_ROOT}/lib/liblxkrf08flib
fi
if [ -f /usr/lib/liblxkrf08flib ]; then
unlink /usr/lib/liblxkrf08flib
fi
if [ -f /usr/lib/liblxkrf08flib.so ]; then
unlink /usr/lib/liblxkrf08flib.so
fi
if [ -f ${REL_ROOT}/lib/liblxkrf08hpec ]; then
unlink ${REL_ROOT}/lib/liblxkrf08hpec
fi
if [ -f /usr/lib/liblxkrf08hpec ]; then
unlink /usr/lib/liblxkrf08hpec
fi
if [ -f /usr/lib/liblxkrf08hpec.so ]; then
unlink /usr/lib/liblxkrf08hpec.so
fi
if [ -f ${REL_ROOT}/lib/liblxkrf08hpeh ]; then
unlink ${REL_ROOT}/lib/liblxkrf08hpeh
fi
if [ -f /usr/lib/liblxkrf08hpeh ]; then
unlink /usr/lib/liblxkrf08hpeh
fi
if [ -f /usr/lib/liblxkrf08hpeh.so ]; then
unlink /usr/lib/liblxkrf08hpeh.so
fi
if [ -f ${REL_ROOT}/lib/liblxkrf08hpep ]; then
unlink ${REL_ROOT}/lib/liblxkrf08hpep
fi
if [ -f /usr/lib/liblxkrf08hpep ]; then
unlink /usr/lib/liblxkrf08hpep
fi
if [ -f /usr/lib/liblxkrf08hpep.so ]; then
unlink /usr/lib/liblxkrf08hpep.so
fi
if [ -f ${REL_ROOT}/lib/liblxkrs08flib ]; then
unlink ${REL_ROOT}/lib/liblxkrs08flib
fi
if [ -f /usr/lib/liblxkrs08flib ]; then
unlink /usr/lib/liblxkrs08flib
fi
if [ -f /usr/lib/liblxkrs08flib.so ]; then
unlink /usr/lib/liblxkrs08flib.so
fi
if [ -f ${REL_ROOT}/lib/liblxkrs08hpec ]; then
unlink ${REL_ROOT}/lib/liblxkrs08hpec
fi
if [ -f /usr/lib/liblxkrs08hpec ]; then
unlink /usr/lib/liblxkrs08hpec
fi
if [ -f /usr/lib/liblxkrs08hpec.so ]; then
unlink /usr/lib/liblxkrs08hpec.so
fi
if [ -f ${REL_ROOT}/lib/liblxkrs08hpeh ]; then
unlink ${REL_ROOT}/lib/liblxkrs08hpeh
fi
if [ -f /usr/lib/liblxkrs08hpeh ]; then
unlink /usr/lib/liblxkrs08hpeh
fi
if [ -f /usr/lib/liblxkrs08hpeh.so ]; then
unlink /usr/lib/liblxkrs08hpeh.so
fi
if [ -f ${REL_ROOT}/lib/liblxkrs08hpep ]; then
unlink ${REL_ROOT}/lib/liblxkrs08hpep
fi
if [ -f /usr/lib/liblxkrs08hpep ]; then
unlink /usr/lib/liblxkrs08hpep
fi
if [ -f /usr/lib/liblxkrs08hpep.so ]; then
unlink /usr/lib/liblxkrs08hpep.so
fi
if [ -f ${REL_ROOT}/lib/liblxkyf08flib ]; then
unlink ${REL_ROOT}/lib/liblxkyf08flib
fi
if [ -f /usr/lib/liblxkyf08flib ]; then
unlink /usr/lib/liblxkyf08flib
fi
if [ -f /usr/lib/liblxkyf08flib.so ]; then
unlink /usr/lib/liblxkyf08flib.so
fi
if [ -f ${REL_ROOT}/lib/liblxkyf08hpec ]; then
unlink ${REL_ROOT}/lib/liblxkyf08hpec
fi
if [ -f /usr/lib/liblxkyf08hpec ]; then
unlink /usr/lib/liblxkyf08hpec
fi
if [ -f /usr/lib/liblxkyf08hpec.so ]; then
unlink /usr/lib/liblxkyf08hpec.so
fi
if [ -f ${REL_ROOT}/lib/liblxkyf08hpeh ]; then
unlink ${REL_ROOT}/lib/liblxkyf08hpeh
fi
if [ -f /usr/lib/liblxkyf08hpeh ]; then
unlink /usr/lib/liblxkyf08hpeh
fi
if [ -f /usr/lib/liblxkyf08hpeh.so ]; then
unlink /usr/lib/liblxkyf08hpeh.so
fi
if [ -f ${REL_ROOT}/lib/liblxkyf08hpep ]; then
unlink ${REL_ROOT}/lib/liblxkyf08hpep
fi
if [ -f /usr/lib/liblxkyf08hpep ]; then
unlink /usr/lib/liblxkyf08hpep
fi
if [ -f /usr/lib/liblxkyf08hpep.so ]; then
unlink /usr/lib/liblxkyf08hpep.so
fi
if [ -f ${REL_ROOT}/lib/liblxknf09hpec ]; then
unlink ${REL_ROOT}/lib/liblxknf09hpec
fi
if [ -f ${REL_ROOT}/lib/liblxkns09hpec ]; then
unlink ${REL_ROOT}/lib/liblxkns09hpec
fi
if [ -f ${REL_ROOT}/lib/liblxknf10hpec ]; then
unlink ${REL_ROOT}/lib/liblxknf10hpec
fi
if [ -f ${REL_ROOT}/lib/liblxkns10hpec ]; then
unlink ${REL_ROOT}/lib/liblxkns10hpec
fi
if [ ! -d ${REL_ROOT} ]; then
ln -s ${ABS_ROOT} ${REL_ROOT}
fi
OEM=lexmark
rm -rf ${ABS_ROOT}/docs/license*
rm -rf ${ABS_ROOT}/docs/EU*
echo 'Remove scanner ...'
SCAN_LIB="/usr/lib/sane"
SCAN_LIB_64="/usr/lib64/sane"
MACHINE_TYPE_A=`uname -m`
MACHINE_TYPE_B=`uname -i`
if [ ${MACHINE_TYPE_A} = 'x86_64' -o ${MACHINE_TYPE_B} = 'x86_64' ]; then
if [ -d ${SCAN_LIB_64} ]; then
if [ -f ${SCAN_LIB_64}/libsane-LexmarkLegacy_1_0_0.so.1.0.18 ]; then
unlink ${SCAN_LIB_64}/libsane-LexmarkLegacy_1_0_0.so.1.0.18
fi
if [ -f ${SCAN_LIB_64}/libsane-LexmarkLegacy_1_0_0.so ]; then
unlink ${SCAN_LIB_64}/libsane-LexmarkLegacy_1_0_0.so
fi
if [ -f ${SCAN_LIB_64}/libsane-LexmarkLegacy_1_0_0.so.1 ]; then
unlink ${SCAN_LIB_64}/libsane-LexmarkLegacy_1_0_0.so.1
fi
fi
fi
if [ -f ${SCAN_LIB}/libsane-LexmarkLegacy_1_0_0.so.1.0.18 ]; then
unlink ${SCAN_LIB}/libsane-LexmarkLegacy_1_0_0.so.1.0.18
fi
if [ -f ${SCAN_LIB}/libsane-LexmarkLegacy_1_0_0.so ]; then
unlink ${SCAN_LIB}/libsane-LexmarkLegacy_1_0_0.so
fi
if [ -f ${SCAN_LIB}/libsane-LexmarkLegacy_1_0_0.so.1 ]; then
unlink ${SCAN_LIB}/libsane-LexmarkLegacy_1_0_0.so.1
fi
if [ -f /etc/sane.d/LexmarkLegacy_1_0_0.conf ]; then
unlink /etc/sane.d/LexmarkLegacy_1_0_0.conf
fi
if [ -f /etc/udev/rules.d/99-lexmarklegacy-10.rules ]; then
unlink /etc/udev/rules.d/99-lexmarklegacy-10.rules
fi
if [ -f "/sbin/udevadm" ] ; then
udevadm_version=`/sbin/udevadm version`
udevadm_new_version=126
if [ $udevadm_version -gt $udevadm_new_version ] ; then
/sbin/udevadm control --reload-rules
else
/sbin/udevadm control --reload_rules
fi
fi
#-- ADDED by rkhu (2010/09/08) ---
#-- DESC: Disable internationalization/localization support for
# linux scanner driver
# The name for .mo files (should match backend name)
MO_NAME="sane-LexmarkLegacy_1_0_0.mo"
# Get list of language directories (directories are assumed
# to have been named after standard locale names/abbreviations)
DIRS=`ls ${REL_ROOT}/etc/locale`
# For all language directories
for DIR in $DIRS
do
MO_PATH="/usr/share/locale/${DIR}/LC_MESSAGES/${MO_NAME}"
# Check if the language file is existing in OS locale directory
if [ -f ${MO_PATH} ]; then
# Unlink language file to OS locale directory
unlink ${MO_PATH} > /dev/null 2>&1
fi
done
#-- END (2010/09/08) ---
OEM=lexmark
export IFS=" "
SIZE=`cat /etc/passwd | awk -F ":" '{print $6}' | wc -w`
counter=1
while [ $counter -le $SIZE ]
do
VALUE=`cat /etc/passwd | awk -F ":" '{print $6}' | sed -n $counter'p'`
if [ -d $VALUE/.$OEM ];
then
rm -rf $VALUE/.$OEM
fi
counter=`expr $counter + 1`
done
${ABS_ROOT}/bin/.scripts/unregisterPrinters.sh ${ABS_ROOT}
if [ -f ${ABS_ROOT}/etc/netscanconfig.xml ];
then
rm -rf ${ABS_ROOT}/etc/netscanconfig.xml
fi
if [ ! -d ${REL_ROOT} ]; then
ln -s ${ABS_ROOT} ${REL_ROOT}
fi
ROOT1=/usr/share/cups/model/Lexmark
ROOT2=/usr/share/ppd/Lexmark
for item in lxPro700.ppd lxS600.ppd lxPro200-S500.ppd lxS300-S400.ppd lxZ2400.ppd lxX2600.ppd lxPro800-Pro900.ppd lxX3646.ppd lxX5666.ppd lxX4900.ppd lxX7600.ppd lxZ2300.ppd; do
if [ -f ${ROOT1}/${item} ]; then
unlink ${ROOT1}/${item}
fi
if [ -f ${ROOT2}/${item} ]; then
unlink ${ROOT2}/${item}
fi
done
echo 'Remove DBUS service umf'
if [ -f /etc/dbus-1/session.d/umf.conf ]; then
unlink /etc/dbus-1/session.d/umf.conf
fi
#this is for fedora & suse
if [ -f /etc/X11/xinit/xinitrc.d/99umf ]; then
rm -f /etc/X11/xinit/xinitrc.d/99umf
fi
#this is for ubuntu
if [ -f /etc/X11/Xsession.d/99umf ]; then
rm -f /etc/X11/Xsession.d/99umf
fi
#removing the service file
if [ -f /usr/share/dbus-1/services/umf.service ]; then
rm -f /usr/share/dbus-1/services/umf.service
fi
#initializing umf.sh
if [ -f ${ABS_ROOT}/bin/.scripts/umf.sh ]; then
rm -f ${ABS_ROOT}/bin/.scripts/umf.sh
fi
echo 'Clean menu desktop file'
if [ -f /usr/share/applications/lxtoolboxlegacy.desktop ];
then
rm /usr/share/applications/lxtoolboxlegacy.desktop
fi
if [ -f /usr/share/gnome-menus/update-gnome-menus-cache ];
then
/usr/share/gnome-menus/update-gnome-menus-cache /usr/share/applications > /tmp/app
ls /usr/share/applications | grep desktop | grep cache | xargs -ti cp /tmp/app /usr/share/applications/{} > /dev/null 2>&1
rm /tmp/app
fi
}
|