Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2014
443
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. echo "ZIJIANG"
  4. echo "cupsdrv-2.4.0 installer"
  5. echo "---------------------------------------"
  6. echo ""
  7. echo "Models included:"
  8. echo " ZJ-58"
  9. echo ""
  10.  
  11. ROOT_UID=0
  12.  
  13. if [ "$(id -u)" -ne "$ROOT_UID" ];
  14. then
  15. echo "This script requires root user access."
  16. echo "Re-run as root user."
  17. exit 1
  18. fi
  19.  
  20. if [ ! -z $DESTDIR ];
  21. then
  22. echo "DESTDIR set to $DESTDIR"
  23. echo ""
  24. fi
  25.  
  26. SERVERROOT=$(grep '^ServerRoot' /etc/cups/cupsd.conf | awk '{print $2}')
  27.  
  28. if [ -z $FILTERDIR ] || [ -z $PPDDIR ];
  29. then
  30. echo "Searching for ServerRoot, ServerBin, and DataDir tags in /etc/cups/cupsd.conf"
  31. echo ""
  32.  
  33. if [ -z $FILTERDIR ];
  34. then
  35. SERVERBIN=$(grep '^ServerBin' /etc/cups/cupsd.conf | awk '{print $2}')
  36.  
  37. if [ -z $SERVERBIN ];
  38. then
  39. echo "ServerBin tag not present in cupsd.conf - using default"
  40. FILTERDIR=usr/lib/cups/filter
  41. elif [ ${SERVERBIN:0:1} = "/" ];
  42. then
  43. echo "ServerBin tag is present as an absolute path"
  44. FILTERDIR=$SERVERBIN/filter
  45. else
  46. echo "ServerBin tag is present as a relative path - appending to ServerRoot"
  47. FILTERDIR=$SERVERROOT/$SERVERBIN/filter
  48. fi
  49. fi
  50.  
  51. echo ""
  52.  
  53. if [ -z $PPDDIR ];
  54. then
  55. DATADIR=$(grep '^DataDir' /etc/cups/cupsd.conf | awk '{print $2}')
  56.  
  57. if [ -z $DATADIR ];
  58. then
  59. echo "DataDir tag not present in cupsd.conf - using default"
  60. PPDDIR=usr/share/cups/model/zjiang
  61. elif [ ${DATADIR:0:1} = "/" ];
  62. then
  63. echo "DataDir tag is present as an absolute path"
  64. PPDDIR=$DATADIR/model/zjiang
  65. else
  66. echo "DataDir tag is present as a relative path - appending to ServerRoot"
  67. PPDDIR=$SERVERROOT/$DATADIR/model/zjiang
  68. fi
  69. fi
  70.  
  71. echo ""
  72.  
  73. echo "ServerRoot = $SERVERROOT"
  74. echo "ServerBin = $SERVERBIN"
  75. echo "DataDir = $DATADIR"
  76. echo ""
  77. fi
  78.  
  79. echo "Copying rastertozj58 filter to $DESTDIR/$FILTERDIR"
  80. mkdir -p $DESTDIR/$FILTERDIR
  81. chmod +x rastertozj58
  82. cp rastertozj58 $DESTDIR/$FILTERDIR
  83. echo ""
  84.  
  85. echo "Copying model ppd files to $DESTDIR/$PPDDIR"
  86. mkdir -p $DESTDIR/$PPDDIR
  87. cp *.ppd $DESTDIR/$PPDDIR
  88. echo ""
  89.  
  90. if [ -z $RPMBUILD ];
  91. then
  92. echo "Restarting CUPS"
  93. if [ -x /etc/software/init.d/cups ];
  94. then
  95. /etc/software/init.d/cups stop
  96. /etc/software/init.d/cups start
  97. elif [ -x /etc/rc.d/init.d/cups ];
  98. then
  99. /etc/rc.d/init.d/cups stop
  100. /etc/rc.d/init.d/cups start
  101. elif [ -x /etc/init.d/cups ];
  102. then
  103. /etc/init.d/cups stop
  104. /etc/init.d/cups start
  105. elif [ -x /sbin/init.d/cups ];
  106. then
  107. /sbin/init.d/cups stop
  108. /sbin/init.d/cups start
  109. elif [ -x /etc/software/init.d/cupsys ];
  110. then
  111. /etc/software/init.d/cupsys stop
  112. /etc/software/init.d/cupsys start
  113. elif [ -x /etc/rc.d/init.d/cupsys ];
  114. then
  115. /etc/rc.d/init.d/cupsys stop
  116. /etc/rc.d/init.d/cupsys start
  117. elif [ -x /etc/init.d/cupsys ];
  118. then
  119. /etc/init.d/cupsys stop
  120. /etc/init.d/cupsys start
  121. elif [ -x /sbin/init.d/cupsys ];
  122. then
  123. /sbin/init.d/cupsys stop
  124. /sbin/init.d/cupsys start
  125. else
  126. echo "Could not restart CUPS"
  127. fi
  128. echo ""
  129. fi
  130.  
  131. echo "Install Complete"
  132. echo "Add printer queue using OS tool, http://localhost:631, or http://127.0.0.1:631"
  133. echo ""
  134.  
  135. echo "installing printer queue"
  136. #/usr/sbin/lpadmin -p ZJPos58 -E -v socket://192.168.1.101 -P /$PPDDIR/zj58.ppd
  137. /usr/sbin/lpadmin -p ZJPos58 -E -v parallel:/dev/lp0 -P /$PPDDIR/zj58.ppd
  138. #/usr/sbin/lpadmin -p zjPos80 -E -v parallel:/dev/lp1 -m deskjet.ppd
  139. #/usr/sbin/lpadmin -p LaserJet -E -v socket://11.22.33.44 -m laserjet.ppd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement