From: Yura Kalinichenko <yuk@iceb.vinnitsa.com>
To: AltLinux Community Maillist <community@altlinux.ru>
Subject: Re: [Comm] Re: CUPS
Date: 02 Sep 2004 12:48:46 +0300
Message-ID: <1094118526.2831.21.camel@iceb> (raw)
In-Reply-To: <200409021237.24168.kosha@kp.ru>
[-- Attachment #1: Type: text/plain, Size: 983 bytes --]
В Чтв, 02.09.2004, в 11:37, Korshunov Ilya написал:
> В сообщении от Четверг 02 Сентябрь 2004 12:17 Michael Shigorin написал(a):
> > On Thu, Sep 02, 2004 at 11:17:07AM +0300, Yura Kalinichenko wrote:
> > > Я для такого случая даю юзерам кнопку "Сброс принтера".
> >
> > Как бы ее опакетить?..
Скрипт на 2 кило в пакет ? IMHO, перебор...
>
>
> Э...подробнее pls :-)
> Имеется в виду кнопка старт/рестрат в веб-интерфейсе купса ? Если да то как
> дали юзерам только её не давая доступ к всему остальному ?
Не через веб. Скрипт с мордой на Xdialog запускается из xdm -
естественно, с правами рута, и висит в виде менюшки в правом нижнем углу
экрана. Делает три вещи, которые необходимо делать от рута: сброс
локальных принтеров, останов и перезагрузку компьютера.
Скрипт пришит к письму. В случае xdm вызов его помещается в
/etc/X11/xdm/Xsetup_0 (образец также пришит). Как действовать в лучае
других dm - не пользую, не знаю.
--
Yura Kalinichenko
[-- Attachment #2: xshut --]
[-- Type: text/x-sh, Size: 2304 bytes --]
#!/bin/sh
x0=187
y0=152
DIALOG=Xdialog
TITLE="Управление компьютером"
sigs="1 2 3 5 10 13 15"
tf=/tmp/xshut.$$
trap abort $sigs
if [ -z "$DISPLAY" ]; then
export DISPLAY=:0
fi
abort() {
rm -f $tf
exit 1
}
set_printers_list() {
# PRINTERS="iceb hpdj"
PRINTERS=`lpstat -v | grep -e " usb:/" -e " parallel:/" | cut -d: -f1 | awk '{print $3}'`
}
reset_printers() {
local title
title="Printer reset"
set_printers_list
set -- $PRINTERS
if [ $# -eq 0 ]; then
$DIALOG --title "$title" --msgbox "На этом компьютере не установлен\nни один принтер - сбрасывать нечего." 8 40
return 1
elif [ $# -eq 1 ]; then
PRINTERS=$1
else
set -- $PRINTERS
menuh=$#
if [ "$DIALOG" = "Xdialog" ]; then
dh=12
max_menuh=20
else
dh=8
max_menuh=17
fi
if [ $menuh -gt $max_menuh ]; then
menuh=$max_menuh
fi
h=`expr $menuh + $dh`
str="_ Все on"
for lp in $PRINTERS ; do
str="$str $lp . off"
done
if $DIALOG --title "$title" --begin $x0 $y0 --separate-output \
--checklist "Какой принтер сбрасывать:" \
$h 30 $menuh $str 2> $tf ; then
list=`cat $tf`
if [ "$list" \!= "_" ]; then
PRINTERS="$list"
fi
else
return 1
fi
fi
set -- $PRINTERS
while [ $# -gt 0 ] ; do
$DIALOG --title "$title"--begin $x0 $y0 --no-buttons --infobox "Сбрасываем $1..." 3 30
lprm -P$1 -
lpadmin -p $1 -E
shift
done
return 0
}
#main
#export XDIALOG_HIGH_DIALOG_COMPAT=1
#export LC_CTYPE=uk_UA.KOI8-U
export LC_CTYPE=ru_RU.KOI8-R
#--fixed-font --no-cancel
#--rc-file /usr/local/etc/xshut.rc
#echo $$ > /var/run/xshut.pid
while [ 1 ]; do
mode=`Xdialog --stdout \
--title Shutdown --no-tags --no-cancel \
--radiolist "$TITLE" ${x0}x${y0}-1-40 2 \
p "Сброс принтеров" on \
h "Выключить" off \
r "Перезагрузить" off`
if [ $? -eq 0 ]; then
case "$mode" in
p)
reset_printers
;;
h|r)
shutdown -$mode now
break
;;
*) break
;;
esac
else
break
fi
done
rm -rf $tf
[-- Attachment #3: Xsetup_0 --]
[-- Type: text/x-sh, Size: 645 bytes --]
#!/bin/sh
# (C) MandrakeSoft
# Chmouel Boudjnah <chmouel@mandrakesoft.com>
# Source function library.
. /etc/init.d/functions
SourceIfNotEmpty /etc/profile.d/kde.sh
[ -n "$KDEDIR" ] || KDEDIR=/usr
if [ -x $KDEDIR/bin/kdmdesktop ];then
# /usr/bin/kdmdesktop
# Commented above line and added next line because of kdedesktop issues
# fixes background.
/usr/X11R6/bin/xsetroot -solid "#666699"
else
/usr/X11R6/bin/xsetroot -solid "#666699"
/usr/X11R6/bin/xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed -exitOnFail
fi
ExecIfExecutable /etc/X11/xinit/fixkeyboard
/usr/local/bin/xshut &
freetemp
xbanner
next prev parent reply other threads:[~2004-09-02 9:48 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-02 5:52 [Comm] CUPS Korshunov Ilya
2004-09-02 8:17 ` Yura Kalinichenko
2004-09-02 8:17 ` [Comm] CUPS Michael Shigorin
2004-09-02 8:37 ` Korshunov Ilya
2004-09-02 9:48 ` Yura Kalinichenko [this message]
2004-09-02 10:16 ` Michael Shigorin
2004-09-02 10:55 ` Yura Kalinichenko
2004-09-02 10:23 ` Korshunov Ilya
2004-09-02 10:59 ` Yura Kalinichenko
2004-09-02 11:52 ` Korshunov Ilya
2004-09-03 4:39 ` Yura Kalinichenko
2004-09-03 4:49 ` Korshunov Ilya
2004-09-03 5:11 ` Yura Kalinichenko
2004-09-03 7:08 ` [Comm] Re: CUPS reset Michael Shigorin
2004-09-04 7:11 ` Yura Kalinichenko
2004-09-06 8:44 ` Michael Shigorin
2004-09-06 14:27 ` Yura Kalinichenko
2004-09-06 16:02 ` Michael Shigorin
2004-09-07 5:08 ` Yura Kalinichenko
2004-09-02 11:03 ` [Comm] Re: CUPS Alexey Novikov
2004-09-03 4:43 ` Yura Kalinichenko
2004-09-03 6:45 ` Alexey Novikov
2004-09-03 9:07 ` Alexey Novikov
2004-09-04 7:08 ` Yura Kalinichenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1094118526.2831.21.camel@iceb \
--to=yuk@iceb.vinnitsa.com \
--cc=community@altlinux.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git