Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/lprng/printing.client.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1647 by niro, Thu Mar 10 18:15:28 2011 UTC revision 2011 by niro, Mon Aug 13 09:52:58 2012 UTC
# Line 29  helper_addprinter() Line 29  helper_addprinter()
29   [[ -z ${name} ]] && help_printing_printer && return 1   [[ -z ${name} ]] && help_printing_printer && return 1
30   [[ -z ${port} ]] && help_printing_printer && return 1   [[ -z ${port} ]] && help_printing_printer && return 1
31    
32   [[ ! -d /etc/printcap.d ]] && install -d /etc/printcap.d   [[ ! -d ${MROOT}/etc/printcap.d ]] && install -d ${MROOT}/etc/printcap.d
33    
34   case ${port} in   case ${port} in
35   lpt[0-9]*) port="/dev/lp$(( ${port/lpt/}-1 ))" ;;   lpt[0-9]*) port="/dev/lp$(( ${port/lpt/}-1 ))" ;;
# Line 39  helper_addprinter() Line 39  helper_addprinter()
39   #socket) port="socket://${ip}:${share}" ;;   #socket) port="socket://${ip}:${share}" ;;
40   esac   esac
41    
42   CONFIG="/etc/printcap.d/${name}.conf"   CONFIG="${MROOT}/etc/printcap.d/${name}.conf"
43   clearconfig   clearconfig
44   addconfig "${name}|${name}"   addconfig "${name}|${name}"
45   addconfig " :lp=${port}"   addconfig " :lp=${port}"
46   addconfig " :sd=/var/spool/lpd/${name}"   addconfig " :sd=/var/spool/lpd/${name}"
47     addconfig " :sd=/var/spool/lpd/${name}"
48     addconfig " :lf=/var/log/lprng/${name}"
49    
50   # regenerate printcap   # regenerate printcap
51   helper_generate_printcap   helper_generate_printcap
# Line 55  helper_delprinter() Line 57  helper_delprinter()
57    
58   [[ -z ${name} ]] && help_printing_printer && return 1   [[ -z ${name} ]] && help_printing_printer && return 1
59    
60   if [[ -f /etc/printcap.d/${name}.conf ]]   if [[ -f ${MROOT}/etc/printcap.d/${name}.conf ]]
61   then   then
62   rm /etc/printcap.d/${name}.conf   rm ${MROOT}/etc/printcap.d/${name}.conf
63   fi   fi
64    
65   if [[ -d /var/spool/lpd/${name} ]]   if [[ -d ${MROOT}/var/spool/lpd/${name} ]]
66   then   then
67   rm -rf /var/spool/lpd/${name}   rm -rf ${MROOT}/var/spool/lpd/${name}
68   fi   fi
69    
70     if [[ -d ${MROOT}/var/log/lprng/${name} ]]
71     then
72     rm -rf ${MROOT}/var/log/lprng/${name}
73     fi
74    
75   # regenerate printcap   # regenerate printcap
76   helper_generate_printcap   helper_generate_printcap
77  }  }
# Line 100  get_printing_printer() Line 107  get_printing_printer()
107  helper_generate_printcap()  helper_generate_printcap()
108  {  {
109   local i   local i
110     local prn
111    
112   CONFIG="/etc/printcap"   CONFIG="${MROOT}/etc/printcap"
113   clearconfig   clearconfig
114    
115   for i in $(find /etc/printcap.d -type f -name \*.conf)   for i in $(find ${MROOT}/etc/printcap.d -type f -name \*.conf)
116   do   do
117   mecho "adding ${i}"   mecho "adding ${i}"
118   addconfig "#--- added by mcored ---"   addconfig "#--- added by mcored ---"
# Line 112  helper_generate_printcap() Line 120  helper_generate_printcap()
120   addconfig "#-----------------------"   addconfig "#-----------------------"
121   addconfig   addconfig
122    
123     prn=$(basename ${i} .conf)
124    
125   # install spooler directories   # install spooler directories
126   install -o lp -g lp -m0700 -d /var/spool/lpd/$(basename ${i} .conf)   install -o lp -g lp -m0700 -d ${MROOT}/var/spool/lpd/${prn}
127    
128     # create empty log files
129     install -d ${MROOT}/var/log/lprng
130     touch ${MROOT}/var/log/lprng/${prn}
131     chown lp:lp ${MROOT}/var/log/lprng/${prn}
132     chmod 0600 ${MROOT}/var/log/lprng/${prn}
133   done   done
134  }  }

Legend:
Removed from v.1647  
changed lines
  Added in v.2011