Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!
Home page Ubuntu C++ Hardware HTML i javascript Java Software SQL

Awk|bash – Scanner and installing driver to program Xsane.

Added: 2012-05-12

After installing program Xsane (apt-get install xsane) to scanning documents, It may happen that the attempt to scan the document fails, because do not have driver to device in folder gt68xx. The page with the list of drivers gt68xx-backend.

If you find driver to your scanner, download it and save it in the folder /usr/share/sane/gt68xx/, and give him right to run chmod u+x [nameFile].

Script below will automatically download driver, and will install it in appropriate place. The script takes one parameter, it is path to driver on server (address to driver you can get, clicking right button on mouse and selecting option "copy address link"). This script must operate with administrator right, to be able to copying file to folder gt68xx.


echo "A script that installs drivers for scanner to program XSane."

if [ "$1" = "" ]; then
	echo "Argument does not exist!!!";
	exit 102;

if [ "$(id -u)" -ne "0" ]; then
	echo "Script must be run as root!!!";
	echo "If you are sure, that this script works on roots rights press [y]:";
	read option;
	if [ "$option" != "y" ]; then
		echo "Exit scripts...";
		exit 136;

wget $1
if [ "$?" -eq "0" ]; then
	echo "Download file is ended.";
	echo "Can not download file '"$1"'!!!";
	exit 1;

awk -vf=$1 -vp=`pwd` 'BEGIN { 
	nameFile = f;
	sub("(.+\/)", "", nameFile);

	print "File to coping: "nameFile;

	print p;
	if (p != "/usr/share/sane/gt68xx"){
		system("cp "nameFile" /usr/share/sane/gt68xx/"nameFile);
	system("chmod u+x /usr/share/sane/gt68xx/"nameFile);

exit 0;