Revision 24561,
1.2 KB
checked in by jdreed, 15 years ago
(diff) |
In cupsys-config:
* Tell the user why it's sitting there for 2 minutes in the postinst
|
-
Property svn:executable set to
*
|
Line | |
---|
1 | restart_cups() |
---|
2 | { |
---|
3 | # Handle Debian package name change from cupsys to cups. |
---|
4 | [ -e /etc/init.d/cups ] && rcname=cups || rcname=cupsys |
---|
5 | # Restart cupsd if it is running |
---|
6 | if /etc/init.d/$rcname status; then |
---|
7 | if hash invoke-rc.d; then |
---|
8 | invoke="invoke-rc.d $rcname" |
---|
9 | else |
---|
10 | invoke="/etc/init.d/$rcname" |
---|
11 | fi |
---|
12 | # Flush remote.cache to deal with things like changing the |
---|
13 | # server we BrowsePoll against. But don't do so if |
---|
14 | # policy-rc.d is going to prevent us from restarting cupsd |
---|
15 | # (for instance, if reactivate is installed and running; |
---|
16 | # in that case, the next logout will flush remote.cache and restart |
---|
17 | # cupsd anyway). |
---|
18 | if $invoke stop; then |
---|
19 | rm -f /var/cache/cups/remote.cache |
---|
20 | $invoke start |
---|
21 | fi |
---|
22 | |
---|
23 | # Wait up to two minutes to pick up all the BrowsePoll server's queues. |
---|
24 | browse_host="$(sed -ne '/^BrowsePoll/ { s/^BrowsePoll //p; q }' /etc/cups/cupsd.conf)" |
---|
25 | if [ -n "$browse_host" ]; then |
---|
26 | echo "Retrieving printer list, please wait..." >&2 |
---|
27 | echo "(This may take up to 2 minutes)" >&2 |
---|
28 | queue_count=$(lpstat -h "$browse_host" -a | wc -l) |
---|
29 | timeout=0 |
---|
30 | while [ $(lpstat -a | wc -l) -lt $queue_count ] && [ $timeout -le 120 ]; do |
---|
31 | sleep 1 |
---|
32 | timeout=$((timeout+1)) |
---|
33 | done |
---|
34 | fi |
---|
35 | fi |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.