summarylogtreecommitdiffstats
path: root/brother-hl4150cdn.install
blob: 39ddba9de039646f36af4b39205529923f7f875b (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
MODEL=hl4150cdn

advisorymsg() {
  cat <<EOM
  The usblp kernel module must be disabled before CUPS can detect the
  printer.

  Start CUPS after installation and type the command:
      lpadmin -p $MODEL -E -v \$URL -P /usr/share/cups/model/$MODEL.ppd
  where \$URL can be found using the command:
      lpinfo -v | grep -i 'Brother'
  You can also register the new printer using web interface at:
      http://localhost:631/

  You may have to add "$MODEL" to /usr/share/Brother/inf/brPrintList for
  proper operation and extended printing options.
EOM
}

post_install() {
  _port=`lpinfo -v | grep -i 'usb://Brother/' | head -1 | sed 's/direct //g'`

  if [ "$_port" = '' ];then
          _port="usb:/dev/usb/lp0"
  fi
  echo ""
  echo "Added $MODEL configuration defaults to /usr/share/Brother/inf/brPrintList"
  echo ""
  cat /usr/share/Brother/Printer/hl4150cdn/inf/brhl4150cdnrc >> /usr/share/Brother/Printer/hl4150cdn/inf/brPrintList

#  echo $MODEL >> /usr/share/Brother/inf/brPrintList
#  lpadmin -p $MODEL -E -v $_port -P /usr/share/cups/model/$MODEL.ppd

  advisorymsg
}

post_upgrade() {
  advisorymsg
}

pre_remove() {
  echo "Remember to unregister the $MODEL:"
  echo "    lpadmin -x $MODEL"
  echo "Or visit the CUPS web interface at:"
  echo "    http://localhost:631/"
  # lpadmin -x $MODEL

  # Reverse this
  # echo $MODEL >> /usr/share/Brother/inf/brPrintList
}