Те же яйца, только в профиль. Побольше предустановленного софта в образе, "нескучные обои", mate. В остальном вроде то же самое.
Для Gallade785:
есть у меня подозрение, что команда service ... start|stop|restart работает в последних версиях для заданий upstart, скрипт запуска ccpd же написан в формате init.
Можете попробовать использовать команду /etc/init.d/ccpd start
На всякий случай вот мой скрипт запуска ccpd
# startup script for Canon Printer Daemon for CUPS (ccpd)
### BEGIN INIT INFO
# Provides: ccpd
# Required-Start: $local_fs $remote_fs $syslog $network $named
# Should-Start: $ALL
# Required-Stop: $syslog $remote_fs
# Default-Start: 2 3
# Default-Stop: 0 1 4 5 6
# Description: Start Canon Printer Daemon for CUPS
### END INIT INFO
DAEMON=/usr/sbin/ccpd
LOCKFILE=/var/lock/subsys/ccpd
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=ccpd
DESC="Canon Printer Daemon for CUPS"
test -f $DAEMON || exit 0
. /lib/lsb/init-functions
case $1 in
start)
log_begin_msg "Starting $DESC: $NAME"
start-stop-daemon --start --quiet --exec $DAEMON
log_end_msg $? ;;
stop)
log_begin_msg "Stopping $DESC: $NAME"
start-stop-daemon --stop --exec $DAEMON
log_end_msg $? ;;
status)
echo "$DESC: $NAME:" `pidof $NAME`
;;
restart)
log_begin_msg "Restarting $DESC: $NAME"
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --exec $DAEMON
log_end_msg $?
;;
*)
echo "Usage: ccpd {start|stop|restart|status}"
exit 1
;;
esac
exit 0
Скрипты на запуск-остановку и правила udev для моего LBP 2900.
Обновление от 23.06.2015, код на страничке заменён обновлённой версией. И старую, и новую версии всех скриптов оставляю в прикреплённых архивах.
changelogcaptstop.sh
переписан с использованием процедур;
добавлена проверка по VID:PID и описанию устройства: скрипт стабатывает тогда, когда в выводе lsusb устройства с заданными параметрами нет;
captstopa.sh:
всё то же самое, что и captstop.sh, только с отключенной проверкой наличия подключённого устройства.
captstart.sh
Добавлены проверки на наличие устройства с заданными VID:PID description в выводе lsusb и /dev/usb/lp1 (опционально, переменная devpath может быть пустой). При отсутствии скрипт завершает работу.
Добавлена проверка запуска других копий скрипта.
Смена разрешений на "чтение-запись" для всех пользователей на устройство /dev/usb/lp1
Процессы ccpd убиваются теперь скриптом с именем captstopa.sh
90-canonlbp2900.rules
Изменена цель-триггер udev, запускающая запуск и остановку сервиса canon. Старые значения сохранены в комментариях.
Тексты скриптов.
/opt/captstart.sh
#!/bin/bash
#script to start ccpd. If cupsd is stopped, then run it before
#specific variables for device to search in lsusb
#devpath can be empty, it's an optional variable
vendorid=04a9
productid=2676
devdescr="Canon, Inc. CAPT Device"
devpath="/dev/usb/lp1"
checkdevice()
{
#checking for device presense: if present, then do nothing and exit
sleep 1
testpatt=$( lsusb | grep -i -c "$vendorid:$productid $devdescr" )
if [[ $testpatt -gt 0 ]];
then
echo "device with selected attributes is present in lsusb message"
echo "Go to the next step"
else
echo "Device with selected attributes is not present. Do nothing, exiting"
exit 1
fi
}
checkdevpath()
{
#if $devpath not null, then will check created link to device in /dev/usb or not, and if not then exit.
if ! [[ -z "$devpath" ]];
then
if [[ -z $( ls "$devpath" ) ]];
then
echo "No selected path in /dev filesystem found. Exiting"
exit 1
fi
fi
}
##### executing #####
checkdevice
checkdevpath
#if found more then 2 processes with script name, then exit
if [[ $( ps aux | grep captstart.sh -c ) -gt 3 ]];
then
echo "other copy of script was found in processes. Exiting"
exit 1
else
echo "no other copies running, continuing"
fi
sleep 2
#create simlink from /dev/usb/lp1 to /dev/usb/lp0, else will work nothing
ln -s /dev/usb/lp1 /dev/usb/lp0
chmod 666 /dev/usb/lp1
iii=10
while [[ $iii -ge 1 ]]; do
if [[ $( ps aux | grep cupsd -c ) -lt 2 ]];
then
service cupsd start
fi
service ccpd start
if [[ $( ps aux | grep ccpd -c ) -lt 2 ]];
then
echo "trying to run ccpd one more time"
service ccpd start
fi
sleep 3
if [[ $( ps aux | grep data-write-fd=9 -c ) -lt 2 ]];
then
/opt/captstopa.sh
else
exit 0
fi
iii=$(( $iii -1 ))
done
exit 0
/opt/captstop.sh
#!/bin/bash
#specific variables for device to search in lsusb
vendorid=04a9
productid=2676
devdescr="Canon, Inc. CAPT Device"
#services to manipulate
SERVICES=" ccpd "
SERVACT="stop"
#app names to clean after services stopping
APPS="ccpd captmon"
checkdevice()
{
#checking for device presense: if present, then do nothing and exit
sleep 1
testpatt=$( lsusb | grep -i -c "$vendorid:$productid $devdescr" )
if [[ $testpatt -gt 0 ]];
then
echo "device with selected attributes is present in lsusb message"
echo "Do nothing, exiting"
exit 1
else
echo "Device with selected attributes is not present. Stopping services"
fi
}
servact()
{
i=
for i in $SERVICES
do
service "$i" "$SERVACT"
done
}
appspids()
{
#searching pids in processes with names from $APPS, add them to PIDS variable
FIELDS=
FIELDS=$( echo $APPS | awk '{ print NF }' )
echo "Number of fields is $FIELDS"
i=1
while [[ $i -le $FIELDS ]]; do
CURRAPP=$( echo $APPS | awk -v intvar=$i '{ print $intvar }' )
echo "Current application is $CURRAPP"
PIDSCURR=$( ps aux | grep $CURRAPP | grep -v grep | awk '{ print $2 }' )
echo "Current PID(s) of $CURRAPP is $PIDSCURR"
PIDS=$( echo $PIDS $PIDSCURR )
i=$(( $i + 1 ))
echo "Current i is $i"
done
echo "Cycle done"
echo "PIDS of apps are $PIDS "
echo
}
appskill()
{
#killing selected PIDs. I would not work with errors, so every action will be applied inside a cycle.
i=1
FIELDS=
FIELDS=$( echo $PIDS | awk '{ print NF }' )
echo "using kill + kill -9 for selected processes"
while [[ $i -le $FIELDS ]]; do
PIDCURR=$( echo $PIDS | awk -v intvar=$i '{ print $intvar }')
echo "applying command is \"kill $PIDCURR\""
kill $PIDCURR
i=$(( $i + 1))
done
sleep 1
i=1
while [[ $i -le $FIELDS ]]; do
PIDCURR=$( echo $PIDS | awk -v intvar=$i '{ print $intvar }')
echo "applying command is \"kill -9 $PIDCURR\""
kill -9 $PIDCURR
i=$(( $i + 1))
done
}
##### executing #####
#if device in system, do nothing and exit
checkdevice
#if no device with VID:PID, then stop services and apps
#executing selected actions for selected services
servact
#kill processes then does not stopped.
appspids
appskill
exit 0
/opt/captstopa.sh
Всё то же самое, что и /opt/captstop.sh, только проверка наличия устройства в системе отключена
#if device in system, do nothing and exit
#checkdevice
/etc/udev/rules.d/90-canonlbp2900.rules
#rules, for, my, canon, lbp2900, device
#old by idvendor, idProduct attributes
#SUBSYSTEMS=="usb" ATTRS{idVendor}=="04a9" ATTRS{idProduct}=="2676" ACTION=="add" RUN+="/opt/captstart.sh"
#SUBSYSTEMS=="usb" ATTRS{product}=="Canon CAPT USB Device"
ACTION=="remove" RUN+="/opt/captstop.sh"
#New, by ieee1284_id
SUBSYSTEMS=="usb" DRIVERS=="usblp" ATTRS{ieee1284_id}=="MFG:Canon;MDL:LBP2900;CMD:CAPT;VER:2.1;CLS:PRINTER;DES:Canon LBP2900"
ACTION=="add" RUN+="/opt/captstart.sh"
SUBSYSTEMS=="usb" ATTRS{product}=="Canon CAPT USB Device"
ACTION=="remove" RUN+="/opt/captstop.sh"