An error occurred a necessary package could not be found in the proper location

Trying to install a printer driver for Canon MB2320. Have downloaded the driver and am executing the following command and receiving the response shown below: kevin@WildBlueCoyote:~/Downloads/

Trying to install a printer driver for Canon MB2320. Have downloaded the driver and am executing the following command and receiving the response shown below:

kevin@WildBlueCoyote:~/Downloads/cnijfilter2-5.00-1-rpm$ sudo bash install.sh
[sudo] password for kevin: 

==================================================

Canon Inkjet Printer Driver
Version 5.00
Copyright CANON INC. 2001-2014

==================================================

An error occurred. A necessary package could not be found in the proper location.

What is missing, or am I missing?

Thank you in advance for your assistance

Ravan's user avatar

Ravan

9,18917 gold badges56 silver badges80 bronze badges

asked Dec 9, 2015 at 5:18

wildblue's user avatar

You downloaded the wrong file. You downloaded a rpm package archive, but you have to download a debian package archive Ubuntu uses .deb files to install packages, not .rpm.

Download cnijfilter2-5.00-1-deb.tar.gz with this command.

wget http://gdlp01.c-wss.com/gds/5/0100006265/01/cnijfilter2-5.00-1-deb.tar.gz

Extract the content with this command :

tar xvzf cnijfilter2-5.00-1-deb.tar.gz

Install the driver with this command :

cd cnijfilter2-5.00-1-deb
./install.sh

cl-netbox's user avatar

cl-netbox

30.6k7 gold badges91 silver badges130 bronze badges

answered Dec 10, 2015 at 4:36

Neil's user avatar

NeilNeil

4,3653 gold badges21 silver badges33 bronze badges

Я не знаю, где найти драйверы Linux для принтеров Canon. На официальном сайте Canon даже нет драйвера Linux для моего принтера. К счастью, драйвер Gutenprint хорошо работает с принтерами Canon. Вы можете установить его следующим образом:

sudo apt install printer-driver-gutenprint

Затем подключите принтер через USB к компьютеру и перейдите в Настройки > Принтеры.

Printers dialog

Если вы не видите там своего принтера, добавьте его. Если вы видите принтер, щелкните значок шестеренки рядом с ним и выберите сведения о принтере. В открывшемся новом окне выберите Выбрать из базы данных…

MP470-series details

Найдите модель своего принтера в драйверах Canon.

Canon drivers list

После того, как вы сохраните это, ваш принтер должен работать :)

Я тестировал это решение как в Ubuntu 18.04, так и в 20.04, используя принтер серии Canon PIXMA MP470, и я также мог видеть запись для принтера серии MG2500.

ответ дан Carlos Garcia-Vaso
23 June 2020 в 16:48

поделиться

So I have a canon printer I’m trying to set it up I’ve gotten the driver from here;

Code:

wget -c http://gdlp01.c-wss.com/gds/1/0100005511/01/cnijfilter-mg7100series-4.00-1-rpm.tar.gz

I try and run the script thats below; But I know where i have to copy the driver too. I was wonder what file i have to copy over.

It’s here at the monent

Code:

~/Downloads$ ls cnijfilter-mg7100series-4.00-1-rpm/

Code:

#!/bin/bash

##############################################################################
##
##  Canon Inkjet Printer Driver for Linux
##  Copyright CANON INC. 2001-2013
##  All Rights Reserved.
##
##  This program is free software; you can redistribute it and/or modify
##  it under the terms of the GNU General Public License as published by
##  the Free Software Foundation; version 2 of the License.
##
##  This program is distributed in the hope that it will be useful,
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##  GNU General Public License for more details.
##
##  You should have received a copy of the GNU General Public License
##  along with this program; if not, write to the Free Software
##  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
##
##############################################################################

C_version="4.00-1"
C_copyright_end="2013"
C_default_system="rpm"

L_INST_COM_01_01="Command executed = %sn"

L_INST_COM_01_02="An error occurred. The package management system cannot be identified.n"
L_INST_COM_01_03="An error occurred. A necessary package could not be found in the proper location.n"
L_INST_COM_01_04="Installation has been completed.n"
L_INST_COM_01_05="An error occurred. Your environment cannot be identified as 32-bit or 64-bit.nTry to install again by using the following command.n"
L_INST_COM_01_06="An error occurred. The specified environment differs from your environment.nTry to install again by using the following command.n"

L_INST_COM_02_01="Usage: %sn"

L_INST_COM_02_02="Uninstallation has been completed.n"

L_INST_COM_03_01="[Package]n"


L_INST_PRN_00_01="Canon Inkjet Printer Driver"
L_INST_PRN_00_02="Version %s"
L_INST_PRN_00_03="Copyright CANON INC. %s-%s"
L_INST_PRN_00_04="All Rights Reserved."

L_INST_PRN_01_01="Register Printern"
L_INST_PRN_01_02="Next, register the printer to the computer.n"
L_INST_PRN_01_03="Connect the printer, and then turn on the power.nTo use the printer on the network, connect the printer to the network.nWhen the printer is ready, press the Enter key.n"

L_INST_PRN_01_04="Connection Methodn"
L_INST_PRN_01_05="USBn"
L_INST_PRN_01_06="Networkn"
L_INST_PRN_01_07="Select the connection method.%s"

L_INST_PRN_01_08="Searching for printers...n"

L_INST_PRN_01_09="Select Printern"
L_INST_PRN_01_10="Select the printer.nIf the printer you want to use is not listed, select Update [0] to search again.nTo cancel the process, enter [Q].n"
L_INST_PRN_01_11="Update"
L_INST_PRN_01_12="Target printers detected (MAC address  IP address)n"
L_INST_PRN_01_13="Other printers detected (MAC address  IP address)n"
L_INST_PRN_01_14="Target printers detectedn"
L_INST_PRN_01_15="Other printers detectedn"
L_INST_PRN_01_16="Currently selected:%s %sn"

L_INST_PRN_01_17="Enter the value."
L_INST_PRN_01_18="Could not detect the target printer.n"

L_INST_PRN_01_19="Register Printern"
L_INST_PRN_01_20="Enter the printer name.%s"

L_INST_PRN_01_21="The printer name you entered already exists. Do you want to overwrite it?nEnter [y] for Yes or [n] for No.%s"

L_INST_PRN_01_22="The printer name is invalid.nYou can only use the following characters for the printer name:n alphanumeric characters (a-z, A-Z, 0-9), ".", "-", "_", "+", "@"n"

L_INST_PRN_01_23="Set as Default Printern"
L_INST_PRN_01_24="Do you want to set this printer as the default printer?nEnter [y] for Yes or [n] for No.%s"

L_INST_PRN_01_25="Printer Name : %sn"

L_INST_PRN_01_26="Select this printer name for printing.n"
L_INST_PRN_01_27="The printer registration has not been completed.nRegister the printer manually by using the lpadmin command.n"

L_INST_PRN_02_01="Uninstall Printern"
L_INST_PRN_02_02="All printer registration for this model will be deleted.n"
L_INST_PRN_02_03="Do you want to continue?nEnter [y] for Yes or [n] for No.%s"

L_INST_PRN_02_04="Failed to delete [%s].nAfter the uninstall process is finished, delete this printer manually by using the lpadmin command.n"
L_INST_PRN_02_05="Failed to delete printers.nAfter the uninstall process is finished, delete these printers manually by using the lpadmin command.n"


C_main_module="cnijfilter"
C_copyright_start="2001"

# internalversion : 3.20.01.005

#################################################################
#### C_function name define
#################################################################
C_function01="P_FUNC_MAIN_make_queue"
C_function02="P_FUNC_MAIN_delete_all_queue"
C_function03="P_FUNC_show_copyright"

#################################################################
#### path, filename, commandname, etc.
#################################################################
P_entry_list_path=""
P_entry_list_path_rpm="/usr/local/share/"
P_entry_list_path_deb="/usr/share/"
P_entry_list_dir="cnijfilter/"
P_entry_list_name="cnij_entry"
P_cupsd_command_1="/etc/init.d/cups"
P_cupsd_command_2="/etc/init.d/cupsys"
P_cupsd_command_current=""
P_lpadmin_command_full="/usr/sbin/lpadmin"
P_lpadmin_command_current=""
P_is_std_usb_backend=0

#################################################################
#### Show the copyright  $1:version
#################################################################
P_FUNC_show_copyright()
{
#	p_copyright1="Canon Inkjet Printer Driver Ver."$1" for Linux"
#	p_copyright2="Copyright CANON INC. 2001-2011"
#	p_copyright3="All Rights Reserved."

#	echo $p_copyright1; echo $p_copyright2; echo $p_copyright3

	printf "$L_INST_PRN_00_01n"
	printf "$L_INST_PRN_00_02n" "$1"
	printf "$L_INST_PRN_00_03n" "$C_copyright_start" "$C_copyright_end"
	printf "$L_INST_PRN_00_04n"
}

#################################################################
#### Check if the model supports LAN or not.
#################################################################
p_FUNC_is_network_model()
{
	local p_local_modelname_cif=""
	local p_local_cif_output=""
	local p_local_cif_command=""
	local p_local_ret
	
	#p_local_modelname_cif=`echo $P_printer_device | sed -e "s/series$//"`
	p_local_modelname_cif=`expr $P_printer_device : '(.+)series$'`
	p_local_cif_command_tmp=cif$p_local_modelname_cif
	p_local_cif_command=`whereis -b $p_local_cif_command_tmp | cut -d' ' -f2`
	p_local_cif_output=`$p_local_cif_command --supportnetwork 2>&1`

	if [ "$p_local_cif_output" = "1" ]; then
		p_local_ret=1
	elif [ "$p_local_cif_output" = "0" ]; then
		p_local_ret=0
	fi
	
	return $p_local_ret
}

#################################################################
#### Add registered entry name to entry_list_file. $1:entry_list_file name  $2:entry name to add
#################################################################
p_FUNC_write_entrydata_to_file()
{
	local p_local_existentrys=""

	p_local_existentrys=`cat $P_entry_list_fullname`

	#to Upper case
	p_local_name_to_write=`echo "$2" | tr a-z A-Z`
	
	
	# set delimiter
	IFS='
	'
	#-----------------------------
	# Check entry list file (If same name exists, you should not to add entry name)
	#-----------------------------
	for line in ${p_local_existentrys}; do
		if [ -n "$line" ]; then
			#to Upper case
			line=`echo "$line" | tr a-z A-Z`
			
			if [ "$p_local_name_to_write" = "$line" ]; then
				# same name exist in the entry_list_file -> restore delimiter and return.
				IFS=$IFS_ORG
				return 1
			fi
		fi
	done

	# restore delimiter.
	IFS=$IFS_ORG

	# add
	local p_local_entry="'"$2"'"
	${P_printer_sudo_command}sh -c "echo $p_local_entry >> $1"
	
	return 0
	
}

#################################################################
#### Delete registered entry name from entry_list_file. $1:entry name to delete
#################################################################
p_FUNC_delete_entryname_from_file()
{
	local p_local_list_of_files=""
	local p_local_existentrys=""
	local p_local_list_of_entries=""
	local p_local_out_flg=0

	p_local_list_of_files=`ls ${P_entry_list_path}/${P_entry_list_name}* 2> /dev/null`

	if [ $? -ne 0 ]; then
		return 1
	fi

	# set delimiter
	IFS='
'

	#to Upper case
	p_local_target_name=`echo "$1" | tr a-z A-Z`

	for file_name in $p_local_list_of_files; do
		p_local_existentrys=`cat $file_name`

		#-----------------------------
		# Check entry list file (If same name exists, you should not to add entry name)
		#-----------------------------
		p_local_out_flg=0
		p_local_list_of_entries=""
		for line in ${p_local_existentrys}; do
			if [ -n "$line" ]; then
				#to Upper case
				upper_val=`echo "$line" | tr a-z A-Z`
				
				if [ "$p_local_target_name" = "$upper_val" ]; then
					p_local_out_flg=1
					continue
				else
					p_local_list_of_entries=${p_local_list_of_entries}${line}"n"
				fi
			fi	
		done

		# add
		if [ $p_local_out_flg -eq 1 ]; then
			IFS=$IFS_ORG
			local p_local_out="'"$p_local_list_of_entries"'"
			${P_printer_sudo_command}bash -c "echo -n -e $p_local_out > $file_name"
			IFS='
'
		fi
	done

	# restore delimiter.
	IFS=$IFS_ORG

	return 0	

}

#################################################################
#### Exec command for printer  $1:command to exec  $2:1..show execution command 
#################################################################
p_FUNC_show_and_exec_printer()
{
	if [ $2 -eq 1 ]; then
		printf "$L_INST_COM_01_01" "$1"
	fi
	
	$1 1> /dev/null		#show error message only
	return $?
}

#################################################################
#### Get "cups" command
#################################################################
p_FUNC_get_cupsd_command()
{
	local p_local_service_command_tmp=""
	local p_local_service_command=""
	local p_local_systemctl_command_tmp=""
	local p_local_systemctl_command=""

	#-----------------------------
	# Check "systemctl" command
	#-----------------------------
	p_local_systemctl_command_tmp=`whereis -b systemctl`
	p_local_systemctl_command=`echo -n ${p_local_systemctl_command_tmp} | cut -s -d' ' -f2`
	if [ -n "$p_local_systemctl_command" ]; then
		${p_local_systemctl_command} status cups.service 1> /dev/null
		if [ $? -eq 0 ]; then
			P_cupsd_command_current=${P_printer_sudo_command}${p_local_systemctl_command}" restart cups.service"
			return 0
		fi
	fi

	#-----------------------------
	# Check "service" command
	#-----------------------------
	p_local_service_command_tmp=`whereis -b service`
	p_local_service_command=`echo -n ${p_local_service_command_tmp} | cut -s -d' ' -f2`
	if [ -n "$p_local_service_command" ]; then
		${p_local_service_command} cups status 1> /dev/null
		if [ $? -eq 0 ]; then
			P_cupsd_command_current=${P_printer_sudo_command}${p_local_service_command}" cups restart"
			return 0
		fi
	fi

	#-----------------------------
	# Check "/etc/init.d/cups"
	#-----------------------------
	if [ -f "$P_cupsd_command_1" ]; then
		P_cupsd_command_current=${P_printer_sudo_command}${P_cupsd_command_1}" restart"
		return 0
	fi
	
	#-----------------------------
	# Check "/etc/init.d/cupsys"
	#-----------------------------
	if [ -f "$P_cupsd_command_2" ]; then
		P_cupsd_command_current=${P_printer_sudo_command}${P_cupsd_command_2}" restart"
		return 0
	fi
	
	return 127	#error

}

#################################################################
#### Get "lpadmin" command
#################################################################
p_FUNC_get_lpadmin_command()
{
	#-----------------------------
	# Check "/usr/sbin/lpamin"
	#-----------------------------
	if [ -f "$P_lpadmin_command_full" ]; then
		P_lpadmin_command_current=${P_printer_sudo_command}$P_lpadmin_command_full
		return 0
	fi
	
	#-----------------------------
	# Get fullpath by "whereis" and check it.
	#-----------------------------
	lpadmin_path_tmp=`whereis -b lpadmin`
	lpadmin_path=`echo ${lpadmin_path_tmp} | cut -d' ' -f2`

	if [ -z "$lpadmin_path" ]; then
		lpadmin_path=`echo ${lpadmin_path_tmp} | cut -dt -f2`
	fi
	
	if [ "$lpadmin_path" ]; then
		if [ -f "$lpadmin_path" ]; then
			P_lpadmin_command_current=${P_printer_sudo_command}$lpadmin_path
			return 0
		fi
	fi
	
	return 127	#error
	
}

#################################################################
#### Select "Yes" or "No". $1:message
#### (Loop until "yes" or "no" selected)
#################################################################
p_FUNC_check_yes_no()
{
	local p_local_result=-1	# neither "Yes" nor "No"

	while [ $p_local_result -eq -1 ]; do
		printf "$1" "[y]"
		read -r CMD

		#Change to uppercase
		CMD=`echo $CMD | tr a-z A-Z`

		case $CMD in
			"") p_local_result=1;;
			"Y") p_local_result=1;;
			"YES") p_local_result=1;;
			"N") p_local_result=0;;
			"NO") p_local_result=0;;
		esac

	done
	
	return $p_local_result
}

#################################################################
#### Make entry name to suggest(default value)  $1:base entry name (ex:"MP640")
#################################################################
p_FUNC_make_default_entryname()
{
	local p_local_count=0
	local p_local_entry_name=""
	local p_local_result=""

	p_local_entry_name=$1

	while [ -z "${p_local_result}" ]; do
		if [ $p_local_count -ge 1 ]; then
			p_local_entry_name=$1"-"$p_local_count
		fi
		p_FUNC_check_entry_exist $p_local_entry_name
		
		if [ $? -ne 0 ]; then
			p_local_result=""
		else
			p_local_result=$p_local_entry_name
		fi
		#
		p_local_count=`expr $p_local_count + 1`
		
	done
	
#	echo $p_local_result
	P_DEF_ENTRYNAME=$p_local_result
	
#	return 0
}

#################################################################
#### Check if the entry name exists or not.  $1:entry name to check
####   0:not exist  1:exist in cnij_entrys  2:exist in /etc/cups/ppd
#################################################################
p_FUNC_check_entry_exist()
{
	#-----------------------------
	# Check the return value of "cngpij --checkentryexist entryname" (new)
	#-----------------------------
#	local p_local_entry="'"$1"'"
	cngpij --checkentryexist "$1" >& /dev/null
	
	if [ $? -eq 0 ]; then		#exist
		return 1
	fi

	return 0	# Same name is not found
}

#################################################################
#### Check if the entry name is valid.  $1:entry name to check
####   0:invalid  1:valid
#################################################################
p_FUNC_is_valid_entry_name()
{
	local p_local_tmpname=""
	
	p_local_tmpname="$1"

	case "$p_local_tmpname" in
		*[^a-zA-Z0-9.+-_@]*)
			return 0;;	#NG
		*)
			return 1;;	#OK
	esac
	
}

#################################################################
#### 
#################################################################
p_FUNC_execute_prepare_process()
{
	local p_local_command=""

	p_local_command=`whereis -b ldconfig | cut -d' ' -f2`
	`${P_printer_sudo_command}${p_local_command}`;
}

#################################################################
#### Make printer list to show from backend output data. S1:USB or LAN string
#################################################################
p_FUNC_make_printer_list_from_backenddata()
{
	# initialize
	local p_local_current_model=""
	local p_local_cn_uri=""
	local p_local_srch_result=""
	local p_local_fax_term=""
	local p_local_dvice_uri=""
	local p_local_ip_add=""
	local p_local_current=""
	local p_local_current_upper=""
	local p_local_display_line=""
	local p_local_is_std_usb_backend=0
	P_target_model_list=""
	P_other_model_list=""
	P_target_model_num=0
	P_other_model_num=0
	P_is_std_usb_backend=0

	# P_DEF_ENTRYNAME:all uppercase..
	p_local_current_model=$P_DEF_ENTRYNAME
	
	# show message...
	printf "n"
	printf "$L_INST_PRN_01_08"

	#-----------------------------
	# Restart cupsd. (just before device detection)
	#-----------------------------
#	$P_cupsd_command_current restart 1> /dev/null		#show error message only
	$P_cupsd_command_current 1> /dev/null		#show error message only
	if [ $? -ne 0 ]; then
		printf "$L_INST_PRN_01_27"
		exit		#quit immediately
	fi

	#-----------------------------
	# Execute device search
	#-----------------------------
	if [ "$1" = "LAN" ]; then
		p_local_srch_result=`${P_printer_sudo_command}cnijlgmon2 --installer_net`
	else
		p_local_srch_result=`${P_printer_sudo_command}cnijlgmon2 --installer_usb`
	fi

	#-----------------------------
	# Make printer list array with detected printers
	#-----------------------------
	# set delimiter
	IFS='
	'
	for line in ${p_local_srch_result}; do
		#line=`echo -n ${line}`
		#line=${line//"/\"}
	
		# Extract the 3rd field("Canon MX320 series") and set to value.
		#value=`perl -e '"'$line'" =~ /"(Canon.+?)"/;print $1'`
		value=`expr $line : '.*"(Canon[^"]*series[^"]*)"'`
		
		# Skip FAX device
		p_local_fax_term=""
		if [ "$value" ]; then
			p_local_fax_term=`expr $value : '.*(FAX).*$'`
		fi
		if [ "$p_local_fax_term" ]; then
			continue
		fi
		
		# Extract the 2nd field(/00-1E-8F-0E-1D-44) and set to dvice_uri.
		p_local_cn_uri=`echo ${line} | cut -d' ' -f2`
		p_local_dvice_uri=`echo ${p_local_cn_uri} | cut -d':' -f2`

		# If the I/F is LAN, delete "/" and add IPP address.
		if [ "$1" = "LAN" ]; then
			#p_local_dvice_uri=`echo ${p_local_dvice_uri} | cut -d'/' -f2`
			p_local_dvice_uri=`expr ${p_local_dvice_uri} : '.*serial=(.+)'`
			
			#p_local_ip_add=`perl -e '"'$line'" =~ /"(IP.+)"/;print $1'`
			p_local_ip_add=`expr $line : '.*"(IP[^"]*).*$'`
			#p_local_ip_add=`echo $p_local_ip_add | sed -e "s/^IP://" `	#new
			p_local_ip_add=`expr $p_local_ip_add : 'IP:(.+)'`
			
			p_local_dvice_uri=$p_local_dvice_uri" "$p_local_ip_add
			
		fi

		if [ "${value}" != "" ]; then
			p_local_current=`echo ${value} | cut -d' ' -f2`
			p_local_current_upper=`echo $p_local_current | tr a-z A-Z`

			# fix backend
			P_is_std_usb_backend=${p_local_is_std_usb_backend}
			
			if [ "${p_local_current_upper}" = "${p_local_current_model}" ]; then	# If target model..
				
				P_target_model_num=`expr $P_target_model_num + 1`	# arrya number starts with "1".
				p_local_display_line="${P_target_model_num}) ${value} (${p_local_dvice_uri})"
				P_target_model_list[P_target_model_num]=$p_local_display_line
			
			else											# If other model...
				P_other_model_num=`expr ${P_other_model_num} + 1`		# arrya number starts with "101".
				p_local_display_line="`expr $P_other_model_num + 100`) ${value} (${p_local_dvice_uri})"
				P_other_model_list[P_other_model_num]=$p_local_display_line
			
			fi
		fi
	done
	
	# restore delimiter
	IFS=$IFS_ORG
	
#	echo "P_target_model_num=$P_target_model_num"
#	echo "P_other_model_num=$P_other_model_num"
	
}

#################################################################
#### Select device from printer lists menu. S1:backend name
#################################################################
p_FUNC_select_printer_from_list()
{
	
	P_ans=''
	local p_local_defaultnum
	local p_local_target_list_title
	local p_local_other_list_title
	local p_local_current_num
	local p_local_indata
	local p_local_indata_for_array

	#-----------------------------
	# Set default selection.
	#-----------------------------
	if [ $P_target_model_num -eq 0 ]; then
		p_local_defaultnum=0
	else
		p_local_defaultnum=1
	fi
	
	# Set list titles according to backend name.
	if [ "$1" != "LAN" ]; then
		p_local_target_list_title="$L_INST_PRN_01_14"
		p_local_other_list_title="$L_INST_PRN_01_15"
	else
		p_local_target_list_title="$L_INST_PRN_01_12"
		p_local_other_list_title="$L_INST_PRN_01_13"
	fi

	#-----------------------------
	# Show printer list
	#-----------------------------
	printf "n"
	printf "n"
	printf "#=========================================================#n"
	printf "#  $L_INST_PRN_01_09"
	printf "#=========================================================#n"
	printf "$L_INST_PRN_01_10"
	printf -- "-----------------------------------------------------------n"
	printf " 0) $L_INST_PRN_01_11n"
	printf -- "-----------------------------------------------------------n"
    
    if [ $P_target_model_num -gt 0 ]; then
    	printf "$p_local_target_list_title"
#		for current in ${P_target_model_list[@]}; do
#		echo $current
#		done
		for (( i=0; i<$P_target_model_num; i++ ))
		{
			p_local_current_num=`expr $i + 1`
			echo ${P_target_model_list[p_local_current_num]}
		}
	else
    	printf "$L_INST_PRN_01_18"
	fi

	echo "-----------------------------------------------------------"

    if [ $P_other_model_num -gt 0 ]; then
	   	printf "$p_local_other_list_title"
	#	for current in ${P_other_model_list[@]}; do
	#		echo $current
	#	done
		for (( i=0; i<$P_other_model_num; i++ ))
		{
			p_local_current_num=`expr $i + 1`
			echo ${P_other_model_list[p_local_current_num]}
		}
		echo "-----------------------------------------------------------"
	fi

	#-----------------------------
	# Show default choice
	#-----------------------------
	if [ $p_local_defaultnum -eq 0 ]; then
		printf "$L_INST_PRN_01_16" "[0]" "$L_INST_PRN_01_11" > /dev/stderr
	
	else
		tmp_selected=${P_target_model_list[${p_local_defaultnum}]}
		tmp_selected=`echo $tmp_selected | cut -d " " -f 2-`
		printf "$L_INST_PRN_01_16" "[1]" "$tmp_selected" > /dev/stderr
	fi
	

	#-----------------------------
	# Loop until valid selection is done...
	#-----------------------------

	# set delimiter
	IFS='
'
	while [ -z "${P_ans}" ]; do
		
		# Please select...
		printf "$L_INST_PRN_01_17 [${p_local_defaultnum}]" > /dev/stderr
		IFS=$IFS_ORG
		read -r p_local_indata
		IFS='
'

		# Enter(not select number) -> deault value selected
		if [ "${p_local_indata}" = "" ] ; then
			p_local_indata=${p_local_defaultnum}
		fi
		
		# Check the inputted data.
		#to Upper case
		p_local_indata=`echo $p_local_indata | tr a-z A-Z`
		
		case "$p_local_indata" in

			# "0"(re-search) -> return 0 immediately
			"0")
				# restore delimiter and return.
				IFS=$IFS_ORG
				return 1;;

			# "Q"(quit) -> return 2 immediately
			"Q")
				# restore delimiter and return.
				IFS=$IFS_ORG
				return 2;;

			*[^0-9]*)
				# contain characters other than number(0-9).-> invaild -> back to input step.
				P_ans='';;
				
			*)
				# valid -> go to next step.
				# Verify inputted value
				# Check if the choice is target model or not.
				
				if [ "${p_local_indata}" -ge 1 -a "${p_local_indata}" -le 100 ] 2> /dev/null; then	#1-100: target model
					if [ "${p_local_indata}" -ge 1 -a "${p_local_indata}" -le "${P_target_model_num}" ] 2> /dev/null; then
						P_ans=${P_target_model_list[${p_local_indata}]}
					else
						:
					fi
				else																#101-: other model
					p_local_indata_for_array=`expr $p_local_indata - 100`
					if [ "${p_local_indata_for_array}" -ge 1 -a "${p_local_indata_for_array}" -le "${P_other_model_num}" ] 2> /dev/null; then
						P_ans=${P_other_model_list[${p_local_indata_for_array}]}
					else
						:
					fi
				fi
		esac
	done
	
	#echo "select num is ${P_ans}"
	
	# restore delimiter and return.
	IFS=$IFS_ORG
	return 0

}

#################################################################
#### Make DeviceURI  $1:USB or LAN string, $2:printer list line
#################################################################
p_FUNC_make_uri()
{
	# set delimiter
	IFS='
	'
#	echo "choice=$2"
	local p_local_uri=""
	
	# Extract "00-00-85-CE-9B-17 172.21.81.49"or"/dev/usb/lp0"
	#p_local_uri=`perl -e '"'$2'" =~ /((.+))/;print $1'`
	p_local_uri=`expr $2 : '.*((.+)).*$'`
	
	# If I/F is LAN: "00-00-85-CE-9B-17 172.21.81.49" -> "00-00-85-CE-9B-17" -> "/00-00-85-CE-9B-17"
	if [ "$1" = "LAN" ]; then	#LAN
		p_local_uri=`echo $p_local_uri | cut -d' ' -f1`
		p_local_uri="//Canon/?port=net&serial="$p_local_uri
	fi

	P_current_uri=$p_local_uri
#	echo P_current_uri="$P_current_uri"
	# restore delimiter
	IFS=$IFS_ORG
	
}

#################################################################
#### Entry creation main  $1:complete message  $2:device("mp640series")  $3:system("rpm")
#################################################################
P_FUNC_MAIN_make_queue()
{
	IFS_ORG=$IFS

	#echo ""
	#echo "## Driver packages installed. ##"
	
	P_printer_device=$2
	
	# make P_printer_sudo_command
	if [ "$3" = "rpm" ]; then
		P_printer_sudo_command=""
		P_entry_list_path=${P_entry_list_path_rpm}${P_entry_list_dir}
	else
		P_printer_sudo_command="sudo "
		P_entry_list_path=${P_entry_list_path_deb}${P_entry_list_dir}
	fi

	####################################
	### Make entry_list file (blank file).
	####################################
	if [ ! -d $P_entry_list_path ]; then
		${P_printer_sudo_command}mkdir -p $P_entry_list_path 2> /dev/null
	fi
	P_entry_list_fullname=$P_entry_list_path${P_entry_list_name}_${P_printer_device}
	${P_printer_sudo_command}touch $P_entry_list_fullname

	####################################
	### prepare command.
	####################################
	p_FUNC_get_cupsd_command
	if [ $? -ne 0 ]; then
		printf "$L_INST_PRN_01_27"
		exit		#quit immediately
	fi
#	echo "cups=$P_cupsd_command_current"
	
	p_FUNC_get_lpadmin_command
	if [ $? -ne 0 ]; then
		printf "$L_INST_PRN_01_27"
		exit		#quit immediately
	fi
#	echo "lpadmin=$P_lpadmin_command_current"

	p_FUNC_execute_prepare_process
	
	####################################
	### Registration start
	####################################
	printf "n"
	printf "#=========================================================#n"
	printf "#  $L_INST_PRN_01_01"
	printf "#=========================================================#n"
	printf "$L_INST_PRN_01_02"
	printf "$L_INST_PRN_01_03"
	echo -n "> "
	read CMD
	
	####################################
	### Restart cupsd. -> moved to "p_FUNC_make_printer_list_from_backenddata" (just before device detection)
	####################################

	####################################
	### Check if LAN I/F is supported.
	####################################
	local p_local_SUPPORT_LAN=0
	p_FUNC_is_network_model
	if [ $? -eq 1 ]; then
		p_local_SUPPORT_LAN=1
	fi

	####################################
	### Select I/F. (If LAN is not supported, skip this step.)
	####################################
	local p_local_BACKENDNAME=""
	local p_local_I_F=""
	if [ "${p_local_SUPPORT_LAN}" -eq 1 ]; then
		printf "n"
		printf "#=========================================================#n"
	    printf "#  $L_INST_PRN_01_04"
		printf "#=========================================================#n"
		printf " 1) $L_INST_PRN_01_05"
		printf " 2) $L_INST_PRN_01_06"

		while [ -z "$p_local_I_F" ]; do
			printf "$L_INST_PRN_01_07" "[1]"
			read -r CMD
		
			case $CMD in
				"")	#USB
					p_local_BACKENDNAME="cnijbe"
					p_local_I_F="USB";;
				"1")	#USB
					p_local_BACKENDNAME="cnijbe"
					p_local_I_F="USB";;
				"2")	#Network
					p_local_BACKENDNAME="cnijbe"
					p_local_I_F="LAN";;
			esac
		done
		
	else
		#Skip I/F select step
		p_local_BACKENDNAME="cnijbe"
		p_local_I_F="USB_NOTSELECT"
	fi
	

	####################################
	### Search printer devices and show list.
	####################################
	### P_DEF_ENTRYNAME..."MX860"
	#Cut "series" from device
	local p_local_SHOTMODELNAME=""
	#p_local_SHOTMODELNAME=`echo $P_printer_device | sed -e "s/series$//"`
	p_local_SHOTMODELNAME=`expr $P_printer_device : '(.+)series$'`
	#Change to uppercase
	P_DEF_ENTRYNAME=`echo $p_local_SHOTMODELNAME | tr a-z A-Z`

	retvalue=1
	until [ $retvalue -eq 0 ]
	do
		#Search printers.
		#ver400 p_FUNC_make_printer_list_from_backenddata $p_local_BACKENDNAME
		p_FUNC_make_printer_list_from_backenddata $p_local_I_F

		#Show printer list.
		#ver400 p_FUNC_select_printer_from_list $p_local_BACKENDNAME
		p_FUNC_select_printer_from_list $p_local_I_F

		retvalue=$?
		if [ $retvalue -eq 0 ]; then		#some device selected -> re-search
			:
		elif [ $retvalue -eq 1 ]; then		#"0" selected -> re-search
			echo ""
			printf "$L_INST_PRN_01_03"
			echo -n "> "
			read CMD		#wait enter...
		elif [ $retvalue -eq 2 ]; then		#"Q" selected -> exit immediately
			printf "$L_INST_PRN_01_27"
			exit		#quit immediately
		fi
	done

#	echo "P_ans=$P_ans"

	# make URI
	P_current_uri=""
	p_FUNC_make_uri "$p_local_I_F" "$P_ans"

	####################################
	### Input entry name
	####################################
	### Make default name
	# P_DEF_ENTRYNAME + I/F
	if [ "$p_local_I_F" = "USB_NOTSELECT" ]; then
		P_DEF_ENTRYNAME=$P_DEF_ENTRYNAME
	else
		P_DEF_ENTRYNAME=$P_DEF_ENTRYNAME$p_local_I_F
	fi
	
	# Make default(pre-set) entry name.
	p_FUNC_make_default_entryname $P_DEF_ENTRYNAME
	
	local p_local_ENTRYNAME=""
	local p_local_remake_flag=0
	
	printf "n"
	printf "#=========================================================#n"
	printf "#  $L_INST_PRN_01_19"
	printf "#=========================================================#n"

	while [ -z "$p_local_ENTRYNAME" ]; do
		p_local_ENTRYNAME=""
		printf "$L_INST_PRN_01_20[$P_DEF_ENTRYNAME]"
		read -r p_local_ENTRYNAME
		
		case "$p_local_ENTRYNAME" in
			"")		# use default name
				p_local_ENTRYNAME=$P_DEF_ENTRYNAME;;
		esac
		
		# Check if specified name is valid.
		p_FUNC_is_valid_entry_name "$p_local_ENTRYNAME"

		if [ $? -eq 0 ]; then		# invalid printer name
			printf "$L_INST_PRN_01_22"
			p_local_ENTRYNAME=""
			echo ""	
			continue
		fi
		
		
		# Check if the specified name is already exist.
		p_FUNC_check_entry_exist $p_local_ENTRYNAME
		
		if [ $? -ne 0 ]; then
			#If the entry_name exists, ask if overwrite or not.
			p_FUNC_check_yes_no "$L_INST_PRN_01_21"
			
			if [ $? -eq 0 ]; then		#No -> back to input step
				p_local_ENTRYNAME=""
				echo ""	
			else						#Yes-> set "p_local_remake_flag" 1
				p_local_remake_flag=1
			fi
		else
			:
		fi
		
	done
	
	local p_local_PPDNAME=canon$p_local_SHOTMODELNAME.ppd
	
	####################################
	### Excute lpadmin (registration)
	####################################
	if [ $p_local_remake_flag -eq 1 ]; then
		# remove existing entry.
		p_FUNC_show_and_exec_printer "$P_lpadmin_command_current -x ${p_local_ENTRYNAME}" 0
		if [ $? -ne 0 ]; then
			printf "$L_INST_PRN_01_27"
			exit		#quit immediately
		fi
		# delete entry from file
		p_FUNC_delete_entryname_from_file "$p_local_ENTRYNAME"
	fi
	
	if [ $P_is_std_usb_backend -ne 0 ]; then
		p_local_BACKENDNAME="usb"
	fi
	p_FUNC_show_and_exec_printer "$P_lpadmin_command_current -p $p_local_ENTRYNAME -m $p_local_PPDNAME -v $p_local_BACKENDNAME:$P_current_uri -E" 1
	if [ $? -ne 0 ]; then
		printf "$L_INST_PRN_01_27"
		exit		#quit immediately
	fi

	####################################
	### Add the entry name to the "entry_list" file.(not to add if the entry is overwrited)
	####################################
	p_FUNC_write_entrydata_to_file "$P_entry_list_fullname" $p_local_ENTRYNAME
	

	####################################
	### Set the registered entry as default printer.
	####################################
	printf "n"
	printf "#=========================================================#n"
    printf "#  $L_INST_PRN_01_23"
	printf "#=========================================================#n"
	
	p_FUNC_check_yes_no "$L_INST_PRN_01_24"
	
	if [ $? -eq 1 ]; then
		p_FUNC_show_and_exec_printer "$P_lpadmin_command_current -d $p_local_ENTRYNAME" 0
		if [ $? -ne 0 ]; then
			printf "$L_INST_PRN_01_27"
			exit		#quit immediately
		fi
		
	fi

	####################################
	### Restart cupsd.
	####################################
#	$P_cupsd_command_current restart 1> /dev/null		#show error message only
	$P_cupsd_command_current 1> /dev/null		#show error message only
	if [ $? -ne 0 ]; then
		printf "$L_INST_PRN_01_27"
		exit		#quit immediately
	fi

	####################################
	### Finish (Show registration information)
	####################################
	printf "n"
	printf "#=========================================================#n"
    printf "$1"
    printf "$L_INST_PRN_01_25" "$p_local_ENTRYNAME"
    printf "$L_INST_PRN_01_26"
	printf "#=========================================================#n"
	printf ""

	return 0
	
}

#################################################################
#### Delete entry main   $1:device("mp640series")  $2:system("rpm")
#################################################################
P_FUNC_MAIN_delete_all_queue()
{
	printf "#=========================================================#n"
    printf "#  $L_INST_PRN_02_01"
	printf "#=========================================================#n"
	printf "$L_INST_PRN_02_02"

	IFS_ORG=$IFS

	if [ "$2" = "rpm" ]; then
		P_entry_list_path=${P_entry_list_path_rpm}${P_entry_list_dir}
	else
		P_entry_list_path=${P_entry_list_path_deb}${P_entry_list_dir}
	fi
	
	p_FUNC_check_yes_no "$L_INST_PRN_02_03"
	if [ $? -eq 0 ]; then		#No
		exit		#quit immediately (say nothing)
	
	else						#Yes
	
		# initialize
		local p_local_existentrys=""
		local p_local_entrys_to_delete
		local p_local_entrys_to_delete_num=0
		
		#-----------------------------
		# Prepare file names and Get entry list file.
		#-----------------------------
		P_printer_device="$1"
#		echo P_printer_device=$P_printer_device
		
		P_entry_list_fullname=$P_entry_list_path${P_entry_list_name}_${P_printer_device}
#		echo P_entry_list_fullname=$P_entry_list_fullname
		if [ -f "$P_entry_list_fullname" ]; then
			# set delimiter
			IFS='
			'
			p_local_existentrys=`cat $P_entry_list_fullname`
		else
			# entry list file not found -> go to package uninstallation
			printf "$L_INST_PRN_02_05"
			# restore delimiter and return.
			IFS=$IFS_ORG
			return 1		#skip and go to remove package
		fi
		
		# make P_printer_sudo_command
		if [ "$2" = "rpm" ]; then
			P_printer_sudo_command=""
		else
			P_printer_sudo_command="sudo "
		fi
		

		#-----------------------------
		# prepare for command...
		#-----------------------------
		p_FUNC_get_lpadmin_command
		if [ $? -ne 0 ]; then
			#-----------------------------
			# Failed to get lpadmin command -> Remove entry_list file and go to package uninstallation
			#-----------------------------
			printf "$L_INST_PRN_02_05"
			${P_printer_sudo_command}rm -f $P_entry_list_fullname
			${P_printer_sudo_command}rmdir -p --ignore-fail-on-non-empty $P_entry_list_path

			# restore delimiter and return.
			IFS=$IFS_ORG
			return 1		#skip and go to remove package
		fi
#		echo "lpadmin=$P_lpadmin_command_current"

		
		#-----------------------------
		# make array of entrys to delete.
		#-----------------------------
		for line in ${p_local_existentrys}; do
			if [ -n "$line" ]; then			# skip blank line
				p_local_entrys_to_delete[p_local_entrys_to_delete_num]=$line
				p_local_entrys_to_delete_num=`expr $p_local_entrys_to_delete_num + 1`
			fi
		done
		
		# restore delimiter
		IFS=$IFS_ORG
		
		
		#-----------------------------
		# delete entry for each line.
		#-----------------------------
		for (( i=0; i<$p_local_entrys_to_delete_num; i++ ))
		{
			if [ -n "${p_local_entrys_to_delete[i]}" ]; then	# skip blank line
				p_FUNC_show_and_exec_printer "$P_lpadmin_command_current -x ${p_local_entrys_to_delete[i]}" 1
				if [ $? -ne 0 ]; then
					printf "$L_INST_PRN_02_04" ${p_local_entrys_to_delete[i]}
				fi
			fi
		}
		
#		for line in ${p_local_existentrys}; do
#			if [ -n "$line" ]; then	# skip blank line
#				p_FUNC_show_and_exec_printer "$P_lpadmin_command_current -x $line" 1
#				if [ $? -ne 0 ]; then
#					echo "$L_INST_PRN_02_04" ${line}
#					echo "$L_INST_02_03_2"
#				fi
#			fi
#		done
		
		#-----------------------------
		# Remove entry_list file.
		#-----------------------------
		${P_printer_sudo_command}rm -f $P_entry_list_fullname
		${P_printer_sudo_command}rmdir -p --ignore-fail-on-non-empty $P_entry_list_path
		
	fi
	
	return 0
	
}

#== test program ====================================
# 
#L_INST_01_24="Installation has been completed."
#L_INST_02_04="Uninstallation has been completed."
#argment=$1
#if [ "$argment" = "--uninstall" ]; then
#	test_model=$2		#"mp640series"
#	$C_function02 $test_model  "rpm"
#	echo "$L_INST_02_04"
#else
#	$C_function03 "3.20"
#	$C_function01 "$L_INST_01_24" "mp640series" "rpm"
#fi
#====================================================


C_ERR_CODE="128"
C_big="50"
C_equal="40"
C_small="30"

C_common="common"
C_system=""
C_arch=""
C_arch32=""
C_arch64=""

C_err="no_error"
C_err_unknown="err_unknown"
C_err_mismatch="err_mismatch"
C_err_usage="err_usage"

C_install_script_fname="install.sh"
C_config_path_rpm="/usr/local/bin"
C_config_path_deb="/usr/bin"

C_copyrightb="=================================================="

C_arg_inst="[ --bit32 | --bit64 ]"
C_arg_pkg="[ --uninstall | --version ]"

C_FUNC_show_and_exec()
{
	printf "$L_INST_COM_01_01" "$1"
	$1
}

C_FUNC_version_comp()
{
	local c_tmpstr=""
	local c_ver1=""
	local c_ver2=""
	local c_rela1=""
	local c_reln1=""
	local c_rela2=""
	local c_reln2=""
	
	C_FUNC_makelist()
	{
		echo $1
		echo $2
	}

	## version compare ##
	# ex. 3.10->310, 1.30->130 #
	c_tmpstr=`echo ${1%%-*}`
	c_ver1=`echo ${c_tmpstr%%.*}``echo ${c_tmpstr##*.}`
	c_tmpstr=`echo ${2%%-*}`
	c_ver2=`echo ${c_tmpstr%%.*}``echo ${c_tmpstr##*.}`

	# ex. 310 > 300  #
	if [ "$c_ver1" -gt "$c_ver2" ]; then
		return $C_big
	elif [ "$c_ver1" -lt "$c_ver2" ]; then
		return $C_small
	fi
	
	## release compare ##
	# ex. a13->[a][13], 2->[][2] #
	c_tmpstr=`echo ${1##*-}`
	c_rela1=`echo ${c_tmpstr%%[0-9]*}`
	c_reln1=`echo ${c_tmpstr##*[a-z]}`
	c_tmpstr=`echo ${2##*-}`
	c_rela2=`echo ${c_tmpstr%%[0-9]*}`
	c_reln2=`echo ${c_tmpstr##*[a-z]}`

	# ex. [a][13] < [][2] #
	if [ -z "$c_rela1" ] && [ -n "$c_rela2" ]; then
		return $C_big
	elif [ -n "$c_rela1" ] && [ -z "$c_rela2" ]; then
		return $C_small
	fi
	
	# ex. [a][2] < [b][1] #
	if [ -n "$c_rela1" ] && [ "$c_rela1" != "$c_rela2" ]; then
		list=`C_FUNC_makelist $c_rela1 $c_rela2 | sort`
		for c_tmpstr in $list; do
			if [ "$c_tmpstr" = "$c_rela1" ]; then
				return $C_small
			else
				return $C_big
			fi
		done
	fi
	
	# ex. [a][2] > [a][1], [b][9] < [b][10] #
	if [ "$c_reln1" -gt "$c_reln2" ]; then
		return $C_big
	elif [ "$c_reln1" -lt "$c_reln2" ];then
		return $C_small
	else
		return $C_equal
	fi
}

C_FUNC_get_system()
{
	local c_system_rpm=""
	local c_system_deb=""

	## Judge is the distribution supporting rpm? ##
	rpm --version 1> /dev/null 2>&1
	c_system_rpm=$?

	## Judge is the distribution supporting dpkg(debian)? ##
	dpkg --version 1> /dev/null 2>&1
	c_system_deb=$?

	## rpm error and deb error is error ##
	if [ $c_system_rpm != 0 -a $c_system_deb != 0 ]; then
		return $C_ERR_CODE
	elif [ $c_system_rpm = 0 -a $c_system_deb = 0 ]; then
		C_system=$C_default_system
	else
		if test $c_system_rpm -eq 0; then
			C_system="rpm"
		else
			C_system="deb"
		fi
	fi

	if [ $C_system = "rpm" ]; then
		C_arch32="i386"
		C_arch64="x86_64"
	else
		C_arch32="i386"
		C_arch64="amd64"
	fi
	
	return 0
}

C_FUNC_get_bitconf()
{
	local c_bit_conf=""
	local c_sudo_command=""
	local c_arg1=$1

	if [ $C_system = "deb" ]; then
		c_sudo_command="sudo "
	fi

	getconf LONG_BIT 1> /dev/null 2>&1
	if [ $? -eq 0 ]; then
		c_bit_conf=`getconf LONG_BIT`
	else
		c_bit_conf=""
	fi

	if [ -z $C_arch ]; then
		# No argment and getconf=32|64 -> continue #
		if [ -z $c_bit_conf ]; then
			if [ -z $c_arg1 ]; then
				C_err=$C_err_unknown
			elif [ $c_arg1 = "version" ]; then
				C_arch="*"
			fi
		elif [ $c_bit_conf = "32" ]; then
			C_arch=$C_arch32
		elif [ $c_bit_conf = "64" ]; then
			C_arch=$C_arch64
		else
			C_err=$C_err_unknown
		fi
	else
		if [ $C_arch = "32" ]; then
			# --bit32 and getconf=error -> continue #
			if [ -z $c_bit_conf ]; then
				C_arch=$C_arch32
			elif [ $c_bit_conf = "32" ]; then
				C_arch=$C_arch32
			else
				C_err=$C_err_mismatch
			fi
		elif [ $C_arch = "64" ]; then
			# --bit64 and getconf=error -> continue #
			if [ -z $c_bit_conf ]; then
				C_arch=$C_arch64
			elif [ $c_bit_conf = "64" ]; then
				C_arch=$C_arch64
			else
				C_err=$C_err_mismatch
			fi
		fi
	fi

	if [ $C_err = $C_err_mismatch ]; then
		printf "$L_INST_COM_01_06"
		printf "n  ${c_sudo_command}${0}nn"
		return $C_ERR_CODE
	elif [ $C_err = $C_err_unknown ]; then
		printf "$L_INST_COM_01_05"
		printf "n  ${c_sudo_command}${0} ${C_arg_inst}nn"
		return $C_ERR_CODE
	fi	
	
	return 0
}

C_FUNC_localize()
{
	local lc_file_dir=$1

	## Get current LANG information ##
	local current_lang=`echo $LANG | tr '[:upper:]' '[:lower:]'`

	## Get printer or scanner ##
	local driver=""
	if [ $C_main_module = "cnijfilter" ]; then
		driver="printer"
	else
		driver="scanner"
	fi

	## Get localize file name ##
	local lc_file="nolocalize"
	case "${current_lang##*.}" in
		utf8 | utf-8)
			case "${current_lang%%.*}" in
				ja_jp)
					lc_file="${driver}_ja_utf8.lc"
					;;
				fr_fr)
					lc_file="${driver}_fr_utf8.lc"
					;;
				zh_cn)
					lc_file="${driver}_zh_utf8.lc"
					;;
			esac
			;;
	esac

	## Set localize file ##
	if [ $lc_file != "nolocalize" ]; then
		if [ -f ${lc_file_dir}/${lc_file} ]; then
			source ${lc_file_dir}/${lc_file}
		fi
	fi
	
	return 0
}

######################################################
#### _ _ E x e c u t e _ I n s t a l l . s h  _ _ ####
######################################################
if [ ${0##*/} = $C_install_script_fname ]; then

	#################################################################
	#### _ _ B o t h _ P a c k a g e _ C o m m o n _ F l o w _ _ ####
	#################################################################

	C_argment=$1

    ################
	### Localize ###
    ################
    C_local_path_inst="`echo $(dirname $0)`/resources"
	C_FUNC_localize "$C_local_path_inst"

	########################
	## Show the copyright ##
	########################
	C_FUNC_get_system
	if [ $? -eq 0 ]; then
		if [ $C_system = "rpm" ]; then
			##  Check permission by root ##
			if test `id -un` != "root"; then
				su -c "$0 $*"
				exit
			fi
		else
			sudo echo > /dev/null
			if [ $? -ne 0 ]; then
				exit
			fi
		fi
	fi
	echo $C_copyrightb; echo
	$C_function03 "${C_version%%-*}"
	echo ; echo $C_copyrightb

	#########################
	### Check the argment ###
	#########################
	if [ $# -eq 1 ]; then
		if  [ $C_argment = "--bit32" ]; then
			C_arch="32"
		elif [ $C_argment = "--bit64" ]; then
			C_arch="64"
		else
			C_err=$C_err_usage
		fi
	elif [ $# -ne 0 ]; then
		C_err=$C_err_usage
	fi

	if [ $C_err = $C_err_usage ]; then
		printf "$L_INST_COM_02_01" "${0##*/} $C_arg_inst"
		exit
	fi

    #################################
	### Judge distribution system ###
    #################################

	C_FUNC_get_system
	if [ $? -ne 0 ]; then
		printf "$L_INST_COM_01_02"
		exit
	fi

    #########################
	### Judge 32bit/64bit ###
    #########################

	C_FUNC_get_bitconf
	if [ $? -ne 0 ]; then
		exit
	fi

    ############################
	### Check file structure ###
    ############################

	## Get full path of script and packages ##
	C_pkg_path=`echo $(dirname $0)`/packages
	if [ ! -d $C_pkg_path ]; then
		printf "$L_INST_COM_01_03"
		exit
	fi

	## Count total files and check the filename ##
	C_file_cnt=0
	C_files=$C_pkg_path/*${C_arch}*
	for filename in $C_files; do
		if [ $filename != $C_pkg_path ]; then
			# Count number of C_files           #
			C_file_cnt=`expr $C_file_cnt + 1`
			
			# Get only file name              #
			C_onlyfname=`echo ${filename##*/}`
			# Check the extension, and the filename for module #
			if [ `echo ${C_onlyfname##*.}` != $C_system -o `echo ${C_onlyfname%%-*}` != $C_main_module ]; then
				printf "$L_INST_COM_01_03"
				exit
			fi

			# Get device name(ex.mx860series) #
			C_tmpstr=`echo ${C_onlyfname##$C_main_module-}`
			if [ $C_system = "rpm" ]; then
				if [ `echo ${C_tmpstr%%-$C_version*}` != $C_common ]; then
					C_device=`echo ${C_tmpstr%%-$C_version*}`
				fi
			else
				if [ `echo ${C_tmpstr%%_$C_version*}` != $C_common ]; then
					C_device=`echo ${C_tmpstr%%_$C_version*}`
				fi
			fi
		fi
	done

	## Check number of C_files ##
	if [ $C_file_cnt -ne 2 ]; then
		printf "$L_INST_COM_01_03"
		exit
	fi

	## Recheck package names ##
	C_pkgname_common=$C_main_module-$C_common
	C_pkgname_depend=$C_main_module-$C_device
	if [ $C_system = "rpm" ]; then
		C_fpath_common=$C_pkg_path/$C_pkgname_common-$C_version.$C_arch.$C_system
		C_fpath_depend=$C_pkg_path/$C_pkgname_depend-$C_version.$C_arch.$C_system
	else
		C_fpath_common=$C_pkg_path/${C_pkgname_common}_${C_version}_$C_arch.$C_system
		C_fpath_depend=$C_pkg_path/${C_pkgname_depend}_${C_version}_$C_arch.$C_system
	fi

	## Check having common and depend package files ##
	if [ ! -f $C_fpath_common ] || [ ! -f $C_fpath_depend ]; then
		printf "$L_INST_COM_01_03"
		exit
	fi

	#####################################################################
	#### _ _ P a c k a g e _ S y s t e m _ D e p e n d _ F l o w _ _ ####
	#####################################################################

	C_FUNC_rpm_install_process()
	{
		local c_fpath_pkg_name=$1
		local c_pkg_name=$2
		local c_exec_update=1
		local c_installed_pkg=""
		
		## result -> 0:Package installed, 1:Package not installed ##
		c_installed_pkg=`rpm -q $c_pkg_name`
		if [ $? -eq 0 ]; then
			c_installed_pkg_ver=`echo ${c_installed_pkg##$c_pkg_name-}`
			c_installed_pkg_ver=`echo ${c_installed_pkg_ver%%.$C_arch32}`
			c_installed_pkg_ver=`echo ${c_installed_pkg_ver%%.$C_arch64}`
			C_FUNC_version_comp $c_installed_pkg_ver $C_version
			if [ $? -ne $C_small ]; then
				c_exec_update=0
			fi
		fi

		if [ $c_exec_update -eq 1 ]; then
			C_FUNC_show_and_exec "rpm -Uvh $c_fpath_pkg_name"
			if [ $? -ne 0 ]; then
				return $C_ERR_CODE
			fi
		else
			C_FUNC_show_and_exec "rpm --test -U $c_fpath_pkg_name"
		fi

		return 0	
	}

	C_FUNC_deb_install_process()
	{
		local c_fpath_pkg_name=$1

		## result -> 0:Install process complete, 1:Install process depend error ##
		C_FUNC_show_and_exec "sudo dpkg -iG $c_fpath_pkg_name"
		if [ $? != 0 ]; then
			return $C_ERR_CODE
		fi
		
		return 0
	}

	## Make Package-config script, after Check Newer version config script is installed already ##
	C_FUNC_make_pkgconfig()
	{
		local c_pkgconfig_fname=$1
		local c_script_path=$2
		local c_sudo_command=$3
		local c_pkgconfig_fpath="$c_script_path/$c_pkgconfig_fname"
		local c_config_path=""

		if [ ! -d /usr ]; then
			$c_sudo_command mkdir /usr
		fi
		if [ $2 = "rpm" ]; then
			if [ ! -d /usr/local ]; then
				mkdir /usr/local
			fi
			c_config_path=$C_config_path_rpm
		else
			c_config_path=$C_config_path_deb
		fi
		if [ ! -d $c_config_path ]; then
			$c_sudo_command mkdir $c_config_path
		fi

		$c_sudo_command cp -af $(dirname $0)/$C_install_script_fname $c_pkgconfig_fpath

		## Change file permission to same install.sh ##
		$c_sudo_command chmod 755 $c_pkgconfig_fpath
		$c_sudo_command chown root $c_pkgconfig_fpath
		$c_sudo_command chgrp root $c_pkgconfig_fpath
	}

	## Copy Localize-file, after making pkeconfig script ##
	C_FUNC_copy_lcfile()
	{
		local c_lcfile_srcpath=$1
		local c_lcfile_dstname=$2
		local c_sudo_command=$3
		local c_lcfile_dstpath=""

		if [ ! -d /usr ]; then
			$c_sudo_command mkdir /usr
		fi
		if [ $C_system = "rpm" ]; then
			if [ ! -d /usr/local ]; then
				mkdir /usr/local
			fi
			if [ ! -d /usr/local/share ]; then
				mkdir /usr/local/share
			fi
			c_lcfile_dstpath="/usr/local/share"
		else
			if [ ! -d /usr/share ]; then
				$c_sudo_command mkdir /usr/share
			fi
			c_lcfile_dstpath="/usr/share"
		fi

		$c_sudo_command rm -rf $c_lcfile_dstpath/$c_lcfile_dstname
		$c_sudo_command mkdir $c_lcfile_dstpath/$c_lcfile_dstname

		$c_sudo_command cp -a $c_lcfile_srcpath/*.lc $c_lcfile_dstpath/$c_lcfile_dstname/
	}

	if [ $C_system = "rpm" ]; then
		C_install_process="C_FUNC_rpm_install_process"
		C_uninstall_command="rpm -e"
		C_script_path=$C_config_path_rpm
		C_sudo_command=""
	else
		C_install_process="C_FUNC_deb_install_process"
		C_uninstall_command="sudo dpkg -P"
		C_script_path=$C_config_path_deb
		C_sudo_command="sudo"
	fi

	## Common-Package install process ##
	$C_install_process $C_fpath_common $C_main_module-$C_common
	if [ $? -ne 0 ]; then
		if [ $C_system = "deb" ]; then
			C_FUNC_show_and_exec "$C_uninstall_command $C_pkgname_common"
		fi
		exit
	fi
		
	## Depend-Package install process ##
	$C_install_process $C_fpath_depend $C_main_module-$C_device
	if [ $? -ne 0 ]; then
		if [ $C_system = "deb" ]; then
			C_FUNC_show_and_exec "$C_uninstall_command $C_pkgname_depend"
		fi
		C_FUNC_show_and_exec "$C_uninstall_command $C_pkgname_common"
		exit
	fi
		
	C_pkgconfig_fname=$C_main_module-$C_device-pkgconfig.sh
	C_pkgconfig_dname=${C_pkgconfig_fname%%.sh}
	$C_pkgconfig_fname --pkgconfig 1> /dev/null 2>&1
	if [ $? -ne 0 ]; then
		C_FUNC_make_pkgconfig $C_pkgconfig_fname $C_script_path $C_sudo_command
		C_FUNC_copy_lcfile $C_local_path_inst $C_pkgconfig_dname $C_sudo_command
	else
		C_installed_config_ver=`$C_pkgconfig_fname --pkgconfig`
		C_FUNC_version_comp $C_installed_config_ver $C_version
		if [ $? -lt $C_equal ]; then
			$C_sudo_command rm -rf $C_script_path/$C_pkgconfig_fname
			C_FUNC_make_pkgconfig $C_pkgconfig_fname $C_script_path $C_sudo_command
			C_FUNC_copy_lcfile $C_local_path_inst $C_pkgconfig_dname $C_sudo_command
		fi
	fi
	
	$C_function01 "$L_INST_COM_01_04" "$C_device" "$C_system"

##########################################################
#### _ _ E x e c u t e _ P k g c o n f i g . s h  _ _ ####
##########################################################
else
	C_argment=$1

    #################################
	### Judge distribution system ###
    #################################
	C_FUNC_get_system
	if [ $? -ne 0 ]; then
		printf "$L_INST_COM_01_02"
		exit
	fi

	C_intermediate=${0##*$C_main_module-}
	C_device=${C_intermediate%%-*}

    ################
	### Localize ###
    ################
	if [ $C_system = "rpm" ]; then
		C_local_path_pkgconf="/usr/local/share/${C_main_module}-${C_device}-pkgconfig"
	else
		C_local_path_pkgconf="/usr/share/${C_main_module}-${C_device}-pkgconfig"
	fi
	C_FUNC_localize "$C_local_path_pkgconf"

	## Check the argment ##
	if [ $# -ne 1 ]; then
		C_err=$C_err_usage
	elif [ $C_argment != "--version" ] && [ $C_argment != "--uninstall" ] && [ $C_argment != "--pkgconfig" ]; then
		C_err=$C_err_usage
	fi

	if [ $C_err = $C_err_usage ]; then
		printf "$L_INST_COM_02_01" "${0##*/} $C_arg_pkg"
		exit
	fi

	########################
	### Unistall process ###
	########################
	if [ $C_argment = "--uninstall" ]; then
	
		C_FUNC_rpm_uninstall_process()
		{
			rpm -q $1 1> /dev/null 2>&1
			## result -> 0:Package installed, 1:Package not installed ##
			if [ $? -eq 0 ]; then
				# uninstall #
				C_FUNC_show_and_exec "rpm -e $1"
				## result -> 0:Uninstall complete, 1:Uninstall error by debendency ##
				if [ $? -ne 0 ]; then
					# Dependency error #
					return $C_ERR_CODE
				fi
			fi
			return 0
		}

		C_FUNC_deb_uninstall_process()
		{
			# uninstall #
			C_FUNC_show_and_exec "sudo dpkg -P $1"
			## result -> 0:Uninstall complete, 1:Uninstall error by debendency ##
			if [ $? -ne 0 ]; then
				# Dependency error #
				return $C_ERR_CODE
			fi
			
			return 0
		}

		if [ $C_system = "rpm" ]; then
			C_uninstall_process="C_FUNC_rpm_uninstall_process"
			C_sudo_command=""
			
			##  Check permission by root ##
			if test `id -un` != "root"; then
				su -c "$0 $C_argment"
				exit
			fi
		else
			C_uninstall_process="C_FUNC_deb_uninstall_process"
			C_sudo_command="sudo"

			sudo echo > /dev/null
				if [ $? -ne 0 ]; then
				exit
			fi
		fi

		$C_function02 "$C_device" "$C_system"

		##  Uninstall Depend-Package ##
		$C_uninstall_process $C_main_module-$C_device
		if [ $? -ne 0 ]; then
			exit
		fi

		##  Delete mine (pkgconfig.sh)  ##
		$C_sudo_command rm -rf $(dirname $0)/${0##*/}

		C_pkgconfigsh=${0##*/}
		C_pkgconfig=${C_pkgconfigsh%%.sh}
		if [ $C_system = "rpm" ]; then
			C_lcfile_path="/usr/local/share/${C_pkgconfig}"
		else
			C_lcfile_path="/usr/share/${C_pkgconfig}"
		fi
		$C_sudo_command rm -rf $C_lcfile_path
		
		##  Uninstall Common-Package ##
		$C_uninstall_process $C_main_module-$C_common

		printf "$L_INST_COM_02_02"

	###############################
	### Version display process ###
	###############################
	elif [ $C_argment = "--version" ]; then

	    #########################
		### Judge 32bit/64bit ###
	    #########################
		 
		C_FUNC_get_bitconf version
		if [ $? -eq $C_ERR_CODE ]; then
			exit
		fi
				
		echo ; $C_function03 "${C_version%%-*}"
		printf "n$L_INST_COM_03_01"
		
		if [ $C_system = "rpm" ]; then
			echo $C_main_module-$C_common-$C_version.$C_arch.$C_system
			echo $C_main_module-$C_device-$C_version.$C_arch.$C_system
		else
			echo $C_main_module-${C_common}_${C_version}_$C_arch.$C_system
			echo $C_main_module-${C_device}_${C_version}_$C_arch.$C_system
		fi
		echo

	elif [ $C_argment = "--pkgconfig" ]; then
		echo $C_version
	fi

fi

thanks for your help in advance.

I’m still learn Bash.

Josh

Модератор: Модераторы разделов

Аватара пользователя

Maximus_V

Сообщения: 432
ОС: Gentoo, FreeBSD
Контактная информация:

Canon ip2700

Прельствишись дешевизной принтера, купил сабж. Пытаюсь завести под Gentoo Linux.
Прошерстил форум, соседние темы. Использовал руководство http://en.gentoo-wiki.com/wiki/Canon_Pixma_Series — нет поддержки именно ip2700, попытка установки cnijfilter для других принтеров к успеху не привела — устанавливается, но не печатает. Ставил gutenprint — тоже безрезультатно.
На официальном сайте нашел пакет cnijfilter версии 3.3 — под мой принтер. Установил оттуда ppd-файл — принтер успешно добавился в cups, при попытке печати выдал, что не найден фильтр pstocanonij. Установил его из cnijfilter-3.3, задания на печать отправляются — и тишина. При отправке тестовой страницы в логах /var/log/cups/error_log примерно следующее:

Код: Выделить всё

I [10/Jan/2011:21:54:39 +0300] Started "/usr/libexec/cups/cgi-bin/printers.cgi" (pid=10710)
I [10/Jan/2011:21:54:39 +0300] [Job 22] Adding start banner page "none".
I [10/Jan/2011:21:54:39 +0300] [Job 22] Adding end banner page "none".
I [10/Jan/2011:21:54:39 +0300] [Job 22] File of type application/postscript queued by "root".
I [10/Jan/2011:21:54:39 +0300] [Job 22] Queued on "IP2700" by "root".
I [10/Jan/2011:21:54:39 +0300] [Job 22] Started filter /usr/libexec/cups/filter/pstops (PID 10711)
I [10/Jan/2011:21:54:39 +0300] [Job 22] Started filter /usr/libexec/cups/filter/pstocanonij (PID 10712)
I [10/Jan/2011:21:54:39 +0300] [Job 22] Started backend /usr/libexec/cups/backend/usb (PID 10713)
I [10/Jan/2011:21:54:40 +0300] [Job 22] Completed successfully.
I [10/Jan/2011:21:54:41 +0300] Started "/usr/libexec/cups/cgi-bin/printers.cgi" (pid=10733)
I [10/Jan/2011:21:55:34 +0300] Started "/usr/libexec/cups/cgi-bin/printers.cgi" (pid=11142)

Аватара пользователя

Rootlexx

Бывший модератор
Сообщения: 4439
Статус: GNU generation
ОС: Debian GNU/Linux

Re: Canon ip2700

Сообщение

Rootlexx » 11.01.2011 20:56

Maximus_V писал(а): ↑

11.01.2011 11:09

I [10/Jan/2011:21:54:39 +0300] [Job 22] Started backend /usr/libexec/cups/backend/usb (PID 10713)

cnijfilter содержит собственный backend: cnijusb. Попробуйте задействовать его.

Maximus_V писал(а): ↑

11.01.2011 11:09

Установил оттуда ppd-файл — принтер успешно добавился в cups, при попытке печати выдал, что не найден фильтр pstocanonij. Установил его из cnijfilter-3.3, задания на печать отправляются — и тишина.

Зачем ставите по частям?

Аватара пользователя

Maximus_V

Сообщения: 432
ОС: Gentoo, FreeBSD
Контактная информация:

Re: Canon ip2700

Сообщение

Maximus_V » 16.01.2011 14:57

Rootlexx писал(а): ↑

11.01.2011 20:56

cnijfilter содержит собственный backend: cnijusb. Попробуйте задействовать его.

Как его бы правильно поставить? Заменил usb ссылкой на cnijusb — вроде процесс сдвинулся с мертвой точки, в логах много интересного, будто бы печать подготавливается, и затем — не найден файл cifip2700.

Rootlexx писал(а): ↑

11.01.2011 20:56

Зачем ставите по частям?

Не было в архиве с исходниками инструкции, как ставить целиком. К каждой части — своя инструкция.

По запросу cifip2700 и нашел в гугле инструкцию по сборке —
http://people.salixos.org/maximus/cnijfilt…3.30.1/SLKBUILD
но все равно файл cifip2700 в системе не появился. Если слинковать какой-нибудь другой файл из имеющихся (напр. cifip3500), то в логах пишет, что неверная модель принтера.
Как быть дальше?

Аватара пользователя

Maximus_V

Сообщения: 432
ОС: Gentoo, FreeBSD
Контактная информация:

Re: Canon ip2700

Сообщение

Maximus_V » 16.01.2011 22:46

В случае с моим source-based дистрибутивом (gentoo) — видимо, да, только для прикола. Инструкция по установке только для rpm и deb пакетов

Аватара пользователя

radial

Сообщения: 577
ОС: OpenSUSE

Re: Canon ip2700

Сообщение

radial » 16.01.2011 23:59

Генту я заметил. думал, что можно как-то вытащить firmware или что там вам требуется. А так да, для генты canon точно ничего не будет выкладывать- и ежу понятно :)

Аватара пользователя

Rootlexx

Бывший модератор
Сообщения: 4439
Статус: GNU generation
ОС: Debian GNU/Linux

Re: Canon ip2700

Сообщение

Rootlexx » 17.01.2011 01:15

Maximus_V писал(а): ↑

16.01.2011 14:57

Не было в архиве с исходниками инструкции, как ставить целиком. К каждой части — своя инструкция.

Судя по Makefile, расположенному в корне архива, достаточно выполнить обычные:

Кроме того, в подкаталоге scripts есть файл с говорящим названием install.sh.

Аватара пользователя

Maximus_V

Сообщения: 432
ОС: Gentoo, FreeBSD
Контактная информация:

Re: Canon ip2700

Сообщение

Maximus_V » 17.01.2011 07:49

Rootlexx писал(а): ↑

17.01.2011 01:15

Судя по Makefile, расположенному в корне архива, достаточно выполнить обычные:

Я тоже так подумал. Но:

Код: Выделить всё

# make
for dir in libs cngpij pstocanonij backend backendnet cngpijmon/cnijnpr; do (cd $dir; make $target)|| exit 1; done
make[1]: Entering directory `/home/michael/SRC/cnijfilter-source-3.30-1/libs'
make[1]: *** Не заданы цели и не найден make-файл.  Останов.
make[1]: Leaving directory `/home/michael/SRC/cnijfilter-source-3.30-1/libs'
make: *** [all] Ошибка 1

Rootlexx писал(а): ↑

17.01.2011 01:15

Кроме того, в подкаталоге scripts есть файл с говорящим названием install.sh.

Спасибо за наводку. У меня архив почему-то без него скачался. Перекачал. Вечером разберусь, какие файлы он ищет (убегаю на работу сейчас):

Код: Выделить всё

# ./install.sh
==================================================

Canon Inkjet Printer Driver Ver.3.30-1 for Linux
Copyright CANON INC. 2001-2010
All Rights Reserved.

==================================================
An error occurred. A necessary package could not be found in the proper location

Pixma MG6250 scan gear installation problems

Hope someone can help, I have scoured the forums for help but can’t find anyhting.

I have a Pxma MG6250 all in one — the printer part has installed correctly after some jigging of the install script re architecture. However the scangear drivers will not install.

I have jigged the install script per instructions from here so that it will recognise the architecture but then I get this error coming up

Code:

An error occurred. A necessary package could not be found in the proper location.
douglas@douglas-K53SV:~/Documents/Downloads/Canon Drivers/scangearmp-mg6200series-1.80-1-deb$ 

What package is missing? or in the wrong location. This is a meaningless error message and very frustrating as I have now been on this for 2 hours.

Please help if possible.


Re: Pixma MG6250 scan gear installation problems


Re: Pixma MG6250 scan gear installation problems

so I would go here

http://support-asia.canon-asia.com/c…100396002.html

and download scangearmp-mg6200series-1.80-1-deb.tar.gz

and if I suggest some terminal commands for you ……if you copy and paste each and hit the enter key after pasting each command ……..

tar -zxvf scangearmp-mg6200series-1.80-1-deb.tar.gz

cd scangearmp-mg6200series-1.80-1-deb

……that should install it for you ……..

…….to run scangear ….if you issue the command

…..it opens the programme………..

………. you may well prefer a launcher for repeated uses …..

……..such links as this

http://www.howopensource.com/2012/10…-ubuntu-12-10/

…….tell you how…..

…..we hope all goes well for you ………


Re: Pixma MG6250 scan gear installation problems

Thanks for the help, but ,maybe I wasn’t clear enough. I have done all of your commands, exactly, but when it comes to the command — I get that error and no way to find out what is missing.

Incidentally following canon’s install htm results in «unknown architecture’ error, which is well detailed in other threads. That i what I meant for jigging the bash script.

So the same errors occurred with the bash script for installing the printer, but after correcting the script, it went fine. Scan gear will not though.

Any ideas?


Pixma MG6250 ScanGearMP

let’s get some details;

please let us know……..

………version of ubuntu…..32bit………64bit……..standalone computer…….usb cable to 6250…………..

…..you say……….

but when it comes to the command Code: sudo ./install.sh

………..where did you get the sudo ./install.sh from ..(I didn’t use it..) …………..see post #3 above ……………….

…..you also say…………

I get that error and no way to find out what is missing.

………….help me understand…………..which error?

the intention of the

install.sh is to make things easier…but…

…………if one looks at the packages that Canon supply, (see thumbnail below); they supply both 32bit and 64bit………and they can be installed from the directory they are packaged in……..called Packages…….

………..as with many Canon packages…….there is

1) a

COMMON package to install

……and then ……..

2) a

SPECIFIC (MG6200series) package

……….so one could work out if one has 32bit or 64bit and install the correct common and then specific …………. using gdebi installer…………….

Last edited by pdc; December 2nd, 2012 at 08:03 PM.


Re: Pixma MG6250 scan gear installation problems

Ok I will try to answer all your questions.

1) 32bit Ubuntu 12.04
2) Laptop — wireless — standalone
3) The sudo./install command comes directly from the canon install guide

Ok here is what the terminal gives me,

Code:

Canon Drivers$ tar zxvf scangearmp-mg6200series-1.80-1-deb.tar.gz 

scangearmp-mg6200series-1.80-1-deb/
scangearmp-mg6200series-1.80-1-deb/packages/
scangearmp-mg6200series-1.80-1-deb/packages/scangearmp-mg6200series_1.80-1_amd64.deb
scangearmp-mg6200series-1.80-1-deb/packages/scangearmp-common_1.80-1_i386.deb
scangearmp-mg6200series-1.80-1-deb/packages/scangearmp-common_1.80-1_amd64.deb
scangearmp-mg6200series-1.80-1-deb/packages/scangearmp-mg6200series_1.80-1_i386.deb
scangearmp-mg6200series-1.80-1-deb/resources/
scangearmp-mg6200series-1.80-1-deb/resources/scanner_ja_utf8.lc
scangearmp-mg6200series-1.80-1-deb/resources/scanner_fr_utf8.lc
scangearmp-mg6200series-1.80-1-deb/resources/scanner_zh_utf8.lc
scangearmp-mg6200series-1.80-1-deb/install.sh

Code:

Canon Drivers$ cd scangearmp-mg6200series-1.80-1-deb

Code:

scangearmp-mg6200series-1.80-1-deb$ install.sh
install.sh: command not found

However putting (direct from the Canon html guide to installing scangear)

Code:

 

scangearmp-mg6200series-1.80-1-deb$ sudo ./install.sh

ScanGear MP
Version 1.80
Copyright CANON INC. 2007-2011
All Rights Reserved.

==================================================
An error occurred. The package management system cannot be identified.

At this point I go to thread http://ubuntuforums.org/showthread.php?t=1475336

Which details to hack the install script and force it to ignore the architecture. (The weird thing is though, that the thread says this hack is for 64bit systems and uname -m returns i686 for me, so definitely a 32 bit system. I had to hack the printer installs cript too, but once I did that went fine and works a treat.

AHHHH — found the problem

when I followed the hack exactly and edited out the comments it told me too, leaving only « C_system=»deb»

then I got the following errors

Code:

scangearmp-mg6200series-1.80-1-deb$ sudo ./install.sh
./install.sh: line 354: [: =: unary operator expected
==================================================

ScanGear MP
Version 1.80
Copyright CANON INC. 2007-2011
All Rights Reserved.

==================================================
./install.sh: line 228: [: =: unary operator expected
./install.sh: line 432: [: too many arguments
./install.sh: line 439: [: =: unary operator expected
./install.sh: line 432: [: too many arguments
./install.sh: line 439: [: =: unary operator expected
./install.sh: line 460: [: =: unary operator expected
An error occurred. A necessary package could not be found in the proper location.

BUT — I thought about it, and included the next line in the install script which is C_arch32=»i386″

and Bingo it installed, and works fine.

So thank you, because in answering this I went back and ran over exactly what I did step by step to give you the answers, and suddenly found the solution.

So once again thanks, problem solved

Last edited by Bhakti108; December 3rd, 2012 at 06:28 AM.


Re: Pixma MG6250 scan gear installation problems

that’s great;

the usual explanation for

An error occurred. The package management system cannot be identified.

……is that it is finding some trace of rpm on your system, as well as .deb packages……..I don’t know if that is true for you:

What I was trying to say was………..

install.sh tells the system to install the appropriate COMMON and then SPECIFIC package ……..

…….another way…….is for you….knowing it is 32bit…….to just choose the COMMON and then the SPECIFIC and install them yourself.. that’s all the script does………

……..glad all is working and enjoy …..


Forum rules
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.

aniketsutradhar

Level 1
Level 1
Posts: 8
Joined: Mon Jun 01, 2020 6:28 am

[Solved] Cannon G2000 scanner not working

My Cannon Prixma G2000 Print+Copy+Scan, Print working properly but linux mint cannot find scaner.
«No scanner device found»— same error message from SimpleScan & Xsane.
I am new to Linux, and Linux Mint 19.3 Tricia Cinnamon. Before that I was using Windows 7.
Help me..

Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.

Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.

michael-hi

Level 4
Level 4
Posts: 214
Joined: Sun Mar 19, 2017 2:31 pm

Re: Cannon G2000 scanner not working

Post

by michael-hi » Tue Jun 02, 2020 5:18 am

On the sane-project.org website the Canon Pixma G2000 is listed as supported by the current version of the Sane scanner software. However, the current version is 1.0.30 whereas Mint has an older version 1.0.27 which doesn’t seem to support it.

So you could try adding this PPA, provided by one of the Sane gurus, which should update your Sane to the latest stable version. Open a terminal and type these commands, one after the other:

Code: Select all

sudo add-apt-repository ppa:rolfbensch/sane-release
sudo apt update
sudo apt upgrade

You may then need to reboot. If that doesn’t work, you could do a web search for the Canon driver scangearmp2 although that only works with its own user interface, not with Xsane or Simple Scan, and it is said to be rather limited. Or you could use a commercial product called Vuescan which you have to pay for but can try out for free.

aniketsutradhar

Level 1
Level 1
Posts: 8
Joined: Mon Jun 01, 2020 6:28 am

Re: [Solved] Cannon G2000 scanner not working

Post

by aniketsutradhar » Fri Jun 26, 2020 3:22 am

I have tried to download scangearmp2 var. 3.70.tar.gz but cannot install it. The error message is…»An error occurred. A necessary package could not be found in the proper location.»
My OS: Linux mint 19.3 xfce 32bit
CPU: Core2duo
RAM: 2gb

michael-hi

Level 4
Level 4
Posts: 214
Joined: Sun Mar 19, 2017 2:31 pm

Re: [Solved] Cannon G2000 scanner not working

Post

by michael-hi » Sat Jun 27, 2020 11:33 am

Hi, aniketsutradhar. It’s not clear if this a second computer on which you’re trying to install the scanner.

Anyway, I just wanted to say that you may be confusing Sane and XSane, which are not the same thing. Sane is the software already installed by default in Mint which enables many (not all) scanners to work in Linux. Xsane is a graphical frontend (user interface) for Sane. Xsane is not installed in Mint by default and isn’t really needed if a user finds Simple Scan (which is included by default) to be sufficient for their needs.

I doubt you will be able to update Xsane because 0.99 is probably the latest version.

On the other hand, if you want to check what Sane version you have, you can enter scanimage -V in a terminal.

strungoutfan78

Posts: 50
Joined: 2011-07-01 03:22
Location: San Diego, CA

Canon mx340 trouble

#1

Post

by strungoutfan78 » 2011-07-03 07:47

Hi all. Just jumped from the sinking ship that is Fedora into Debian Squeeze. It’s been a while since I’ve used a anything Debian related but it’s all coming back. Problem I’m having is this darn Canon MX340 all-in-one printer. I’ve downloaded the proper drivers as far as I know ( from here: http://support-my.canon-asia.com/P/sear … g_os=Linux ) and they seem to install properly, but cups fails to recognize it, neither does it show in system-config-printer. The drivers only come in a 32-bit version, so the command I’m using to install is:

Code: Select all

sudo dpkg -i --force-all cnijfilter-mx340series_3.30-1_i386.deb

The output I get is:

Code: Select all

neil@debian:~/Downloads/Drivers/cnijfilter-mx340series-3.30-1-i386-deb/packages$ sudo dpkg -iG --force-architecture *.deb
dpkg: warning: overriding problem because --force enabled:
 package architecture (i386) does not match system (amd64)
Selecting previously deselected package cnijfilter-common.
(Reading database ... 146317 files and directories currently installed.)
Unpacking cnijfilter-common (from cnijfilter-common_3.30-1_i386.deb) ...
dpkg: warning: overriding problem because --force enabled:
 package architecture (i386) does not match system (amd64)
Selecting previously deselected package cnijfilter-mx340series.
Unpacking cnijfilter-mx340series (from cnijfilter-mx340series_3.30-1_i386.deb) ...
Setting up cnijfilter-common (3.30-1) ...
Setting up cnijfilter-mx340series (3.30-1) ...

But after this I don’t have the Canon-MX340.ppd file in /etc/cups/ppd like I did in my Fedora installation. I tried copying the ppd file to my current system, hoping that would do it but still no joy. I’ve also tried downloading the source tarballs but I’ve no clue what to do with them. It’s not just a straight forward ./configure, make, make install, and when I try to run the install.sh script it just gives me this cryptic error:

Code: Select all

neil@debian:~/Downloads/Drivers/cnijfilter-source-3.30-1/scripts$ ./install.sh 
==================================================

Canon Inkjet Printer Driver Ver.3.30-1 for Linux
Copyright CANON INC. 2001-2010
All Rights Reserved.

==================================================
An error occurred. A necessary package could not be found in the proper location.

I’d really like to get this thing fixed. Anyone have experience with this printer?

Last edited by strungoutfan78 on 2011-07-11 19:45, edited 2 times in total.


User avatar

roseway

Posts: 1528
Joined: 2007-12-31 22:50
Location: Kent, UK
Been thanked: 1 time

Re: Canon mx340 trouble

#2

Post

by roseway » 2011-07-03 09:01

I went through a similar exercise with a Canon MP640 on a 64-bit system. The solution which I found somewhere on the net was to use the 32-bit deb installer and edit the install.sh script to force the architecture. The section in question looks like this after editing:

Code: Select all

C_FUNC_deb_install_process()
	{
		local c_fpath_pkg_name=$1

		## result -> 0:Install process complete, 1:Install process depend error ##
		C_FUNC_show_and_exec "sudo dpkg -iG --force-architecture $c_fpath_pkg_name"
		if [ $? != 0 ]; then
			return $C_ERR_CODE
		fi
		
		return 0
	

It did work successfully, so perhaps that would be a solution for you. Don’t worry if you don’t use sudo (as I don’t). The script tests for that and aliases «sudu» to «» if sudo isn’t used on the system.

Eric


strungoutfan78

Posts: 50
Joined: 2011-07-01 03:22
Location: San Diego, CA

Re: Canon mx340 trouble

#3

Post

by strungoutfan78 » 2011-07-03 17:01

Thank you for that. That worked perfectly. Strange that issuing the command manually didn’t work. I still have a problem though. During the printer setup my printer is not being discovered on the network. I have a feeling this is an iptables issue but the Debian method of manipulating iptables is a bit foreign to me. I have a static IP assigned to the printer but when using system-config-printer and manually searching it finds nothing. This smells like a firewall issue. Any ideas?

**EDIT**
Seems this was a user permission issue. Maybe. I found that I was not allowed to administer changes to printers. Once I added myself to this group I also rebooted to be safe. After this it worked, but only sort of. After reboot the printer was recognized in the cups web interface as dnssd://blah-blah-blah but it would not process jobs and kept giving me a dnssd backend failure. Once again I purged the drivers, reinstalled them, restarted avahi-daemon, per another forum post I came across, AND cups, logged back into the web interface and found again under network printers the dnssd entry, as well as a cnijnet version of my printer under the other printers list. I added the printer, using the cnijnet version and it works like a charm now. :D


strungoutfan78

Posts: 50
Joined: 2011-07-01 03:22
Location: San Diego, CA

Re: Canon mx340 trouble

#4

Post

by strungoutfan78 » 2011-07-11 19:48

I’ve removed the solved tag because the problem is back. Seems I’ve rebooted a few times since my last successful print job and the printer no longer works. Just keeps processing endlessly. I tried following the same steps from my previous post (minus adding myself to lpadmin), as well as disabling the firewall, and still the printer does not show up in the driver dialog nor the cups interface. If anyone knows what the deal is here I’d be forever greatful.

**EDIT**
Now Windows 7 can’t find the printer either. Something is definitely screwy with the printer and not Debian.

Seems this may have something to do with another post of mine located here: http://forums.debian.net/viewtopic.php?f=5&t=66456
I reset my router and now I am able to install the printer on both Windows 7 and Debian, no problem. My router is a Buffalo WHR-G300N, for anyone who is interested. Apparently it can’t handle torrents very well. Back to solved. :D



strungoutfan78

Posts: 50
Joined: 2011-07-01 03:22
Location: San Diego, CA

Re: Canon mx340 trouble

#6

Post

by strungoutfan78 » 2011-07-16 17:06

grege wrote:You just need to install the ia32-libs package.

Thank you but that’s not the issue. ia32libs is part of the post install configuration I perform on Debian distributions by default. The driver installs fine and the printing and scanning work, unless I’ve had transmission running either:
A: heavily
B: for extended periods of time

At this point I must hard-reset(unplug) my router so that my laptop can see the printer.


User avatar

grege

Posts: 214
Joined: 2009-08-13 11:10
Location: Melbourne, Australia

Re: Canon mx340 trouble

#7

Post

by grege » 2011-07-17 00:48

Maybe try Deluge instead of Transmission and see what happens. I cannot see how Transmission can alter router settings, but it possibly can alter priorities on your system. Your router log will certainly show bittorrent clients in it’s log (my Billion does anyway), maybe Deluge will do something differently which will give a clue.


strungoutfan78

Posts: 50
Joined: 2011-07-01 03:22
Location: San Diego, CA

Re: Canon mx340 trouble

#8

Post

by strungoutfan78 » 2011-07-17 03:52

grege wrote:Maybe try Deluge instead of Transmission and see what happens. I cannot see how Transmission can alter router settings, but it possibly can alter priorities on your system. Your router log will certainly show bittorrent clients in it’s log (my Billion does anyway), maybe Deluge will do something differently which will give a clue.

Well it’s not that transmission is changing router settings, I think that the router just can’t handle the constant barrage of traffic coming and going and gets hung up. That’s a good suggestion to try deluge though. I’ll give it a shot and see what happens.

**UPDATE**
I’ve had Deluge running all day and haven’t had any issues with connectivity, printer or DAAP sharing. Seems it’s a little easier on my equipment. Not sure if I understand exactly why though.


Like this post? Please share to your friends:
  • An error in computer data is called
  • An error in chemistry by william faulkner
  • An error has occurredjsplugin 3005
  • An error has occurred роблокс
  • An error has occurred with the fingerprint sensor