source:
server/rm/revert_printcap
@
569c377
| Last change on this file since 569c377 was 30beeab, checked in by Jessica B. Hamrick <jhamrick@…>, 16 years ago | |
|---|---|
|
|
| File size: 868 bytes | |
| Line | |
|---|---|
| 1 | #!/bin/sh -e |
| 2 | |
| 3 | echo "Reverting changes to /etc/printcap..." >&2 |
| 4 | |
| 5 | if [ -e /usr/lib/gutenbach/config/printername ]; then |
| 6 | printername=$(cat /usr/lib/gutenbach/config/printername) |
| 7 | |
| 8 | mv /etc/printcap /etc/printcap.bak |
| 9 | touch /etc/printcap |
| 10 | foundprinter="false" |
| 11 | while read line; do |
| 12 | printername=$(echo "$line" | grep ^`echo $printername`$ || true) |
| 13 | if [ -n "$printername" ]; then |
| 14 | foundprinter="true" |
| 15 | else |
| 16 | if [ "$foundprinter"="true" ]; then |
| 17 | configline=$(echo "$line" | grep ^[[:space:]]*: || true) |
| 18 | if [ -z "$configline" ]; then |
| 19 | foundprinter="false" |
| 20 | echo "$line" >> /etc/printcap |
| 21 | fi |
| 22 | else |
| 23 | echo "$line" >> /etc/printcap |
| 24 | fi |
| 25 | fi |
| 26 | done < /etc/printcap.bak |
| 27 | rm /etc/printcap.bak |
| 28 | else |
| 29 | echo "Error: /usr/lib/gutenbach/config/printername does not exist!" >&2 |
| 30 | fi |
Note: See TracBrowser
for help on using the repository browser.
