⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vampiredriversfunctions

📁 samba-3.0.22.tar.gz 编译smb服务器的源码
💻
📖 第 1 页 / 共 4 页
字号:
	echo " "	echo " "	echo "--> Running now function fetchallW32X86driverfiles()...."	echo "========================================================"	CURRENTWD=${PWD} ;	for i in ${nthost}/W32X86/*/*/ ; do \	cd "${i}"; 		driverversion="$(basename "$(echo "$PWD")")" ;	echo "$(basename "$(echo "$PWD")")" > driverversion ;		AllFiles=$( cat AllFiles ) ;		[ -d TheFiles ] || mkdir TheFiles; 		cd TheFiles;		echo " "	echo "===================================================="	echo "Downloading files now to ${PWD}....";	echo "===================================================="	echo " "		# Fetch the Driver files from the Windoze box (printserver)	smbclient -U"${ntprinteradmin}%${ntadminpasswd}" -d 2 \	//${nthost}/print\$ -c \	"cd W32X86\\${driverversion};prompt;mget ${AllFiles}"	ls -1 \	| sort -f \	| uniq \	| tee ../AllFilesIGot ;	cd ${CURRENTWD} ;	done ;fi}# -----------------------------------------------------------------------------# -------------- Now upload the driverfiles and activate them! ----------------# Upload files into root "Architecture" directory of Samba'a [print$] share...# -----------------------------------------------------------------------------#function helpwithuploadallW32X86drivers(){echo -e " \n\################################################################################# #		    About uploadallW32X86drivers()...#           	    ---------------------------------## PRECONDITIONS: 1) This function expects to have the '\$nthost', #		    '\$ntprinteradmin' and '\$ntadminpasswd' variables set to#		    according values.#		 2) This function expects to find the files \"AllFiles\",#		    \"AllFilesIGot\" and \"AllFilesIAskFor\" in the #		    \"\${nthost}/W32X86<drivername>/<driverversion>/TheFiles\"#		    subdirectory.## WHAT IT DOES: This function uses "smbclient" to connect to the new Samba print#		server 	"\$nthost" and upload the printer driver files into the#		\"[print\$]\" share there. To achieve that in orderly fashion,#		the previously created subdirectories (named like the drivers#		fetched previously from \$smbhost) are visited in turn and the#		related files are uploaded for each driver/directory. For this #		to really succeed, the files \"AllFilesIGot\" and \"AllFilesIAskFor\"#		are compared with the help of the \"sdiff\" utility to decide#		how to re-name the mis-matching filenams, so that the used #		driver upload command's spelling convention is met....## IF IT DOESN'T WORK: The function "fetchenumdrivers3listfromNThost" and #		      consecutive ones may not have been run successfully. This#		      is a precondition for the current function.#               # HINT: The current values: 'nthost'=\"$nthost\"#			    'ntprinteradmin'=\"$ntprinteradmin\"#			    'ntadminpasswd'=<not shown here, check yourself!># #################################################################################           ............PRESS \"q\" TO QUIT............" \|less}               # -----------------------------------------------------------------------------function uploadallW32X86drivers(){if stringinstring help $@ ; thenhelpwithuploadallW32X86drivers ;else	echo " "	echo " "	echo "--> Running now function uploadallW32X86drivers()...."	echo "====================================================="		for i in ${nthost}/W32X86/*/*/; do \	CURRENTWD=${PWD} ;	cd "${i}" ;							# we are now in [..]/W32X86/[drvrname]/[2|3]/ 		driverversion="$(basename "$(echo "$PWD")")" ;	echo "$(basename "$(echo "$PWD")")" > driverversion ;	cd TheFiles ;							# we are now in [..]/W32X86/[drvrname]/[2|3]/TheFiles	echo " "	echo "===================================================="	echo "Uploading driverfiles now from ${PWD}....";	echo "===================================================="	echo " "	set -x ;		smbclient -U"${smbprinteradmin}%${smbadminpasswd}" -d 2 \	//${smbhost}/print\$ \	-c "mkdir W32X86;cd W32X86;prompt;mput $( cat ../AllFilesIGot )";	cd .. ;							# we are now in [..]/W32X86/[drvrname]/[2|3]/ # Now tell Samba that those files are *printerdriver* files....# The "adddriver" command will move them to the "0" subdir and create or# update the associated *.tdb files (faking the MS Windows Registry on Samba)	Drivername="$( cat Drivername )"	set -x ;	[ x"$( cat Dependentfiles)" == x"" ] && echo NULL > Dependentfiles;	sdiff -s AllFilesIGot AllFilesIAskFor \	| tee sdiff-of-Requested-and-Received.txt ;	[ -s sdiff-of-Requested-and-Received.txt ] \	|| rm -f sdiff-of-Requested-and-Received.txt \	&& cat sdiff-of-Requested-and-Received.txt > ../sdiff-of-Requested-and-Received.txt ;		cat sdiff-of-Requested-and-Received.txt \	| sed -e 's/^/mv /' \	| sed -e 's/ *|/  /' \	| tee rename-Received-to-Requested-case.txt ;	sh -x rename-Received-to-Requested-case.txt ;	mv rename-Received-to-Requested-case.txt rename-Received-to-Requested-case.done ;        echo " ################ B E G I N  DEBUGGING STATEMENT ############"	echo "rpcclient -U\"${smbprinteradmin}%${smbadminpasswd}\" -d 2 \	-c \'adddriver \"Windows NT x86\" \"$( cat Drivername ):$( cat DriverPath ):$( cat Datafile ):$( cat Configfile ):$( cat Helpfile ):NULL:RAW:$( cat Dependentfiles )\" $( cat driverversion )" \	${smbhost} \' ;        echo " ################ E N D  DEBUGGING STATEMENT ################"		rpcclient -U"${smbprinteradmin}%${smbadminpasswd}" -d 2 \	-c "adddriver \"Windows NT x86\" \"$( cat Drivername ):$( cat DriverPath ):$( cat Datafile ):$( cat Configfile ):$( cat Helpfile ):NULL:RAW:$( cat Dependentfiles )\" $( cat driverversion )" \	${smbhost} ;	set +x ;		cd ${CURRENTWD} ;							# we are now back to where we started	done;	set +x ;fi}# Now tell Samba which printqueue this driver is associated with....# The "setdriver" command will do just that and create or# update the associated *.tdb files (faking the MS Windows Registry on Samba)#	rpcclient -U"${smbprinteradmin}%${smbadminpasswd}" \#	-c "setdriver \"${printername}\" \"${DriverName}\"" \#	${smbhost}#  -- NOT YET IMPLEMENTED IN THIS SCRIPT ---## Now set a nice printer comment and let the world know what we've done# (or not.... ;-)#	rpcclient -U"${smbprinteradmin}%${smbadminpasswd}" \#	-c "setprinter \"${printername}\" \"Driver was installed and set via MS-RPC (rpcclient commandline from Linux)\"" \#	${smbhost}#  -- NOT YET IMPLEMENTED IN THIS SCRIPT ---## -----------------------------------------------------------------------------# ------------------ First download the driverfiles........... ----------------# -----------------------------------------------------------------------------#function helpwithfetchallWIN40driverfiles(){echo -e " \n\################################################################################# #		    About fetchallWIN40driverfiles()...#           	    -----------------------------------## PRECONDITIONS: 1) This function expects to have the \$nthost variable set to #		    the according value.#		 2) This function expects to find the \"AllFiles\" file in#		    \"\${nthost}/WIN40<drivername>/<driverversion>/TheFiles\".## WHAT IT DOES: These functions use "smbclient" to connect to the NT print server#		"\$nthost" and download the printer driver files from there. To#		achieve that in an orderly fashion, the previously created#		subdirectories (named like the drivers to fetch) are visited in#		turn and the related files are downloaded for each #		driver/directory.## IF IT DOESN'T WORK: The function "fetchenumdrivers3listfromNThost" and#		      consecutive ones may not have been run successfully. This#		      is a precondition for the current function.#               # HINT: The current values: 'nthost'=\"$nthost\"#			    'ntprinteradmin'=\"$ntprinteradmin\"#			    'ntadminpasswd'=<not shown here, check yourself!># #################################################################################           ............PRESS \"q\" TO QUIT............" \|less}               # -----------------------------------------------------------------------------function fetchallWIN40driverfiles(){if stringinstring help $@ ; thenhelpwithfetchallWIN40driverfiles ;else	echo " "	echo " "	echo "--> Running now function fetchallWIN40driverfiles()...."	echo "======================================================="	CURRENTWD=${PWD} ;	for i in ${nthost}/WIN40/*/*/; do \	cd "${i}"; 		driverversion="$(basename "$(echo "$PWD")")" ;	echo "$(basename "$(echo "$PWD")")" > driverversion ;	AllFiles=$( cat AllFiles ) ;		[ -d TheFiles ] || mkdir TheFiles; 		cd TheFiles;		echo " "	echo "===================================================="	echo "Downloading files now to ${PWD}....";	echo "===================================================="	echo " "	# Fetch the Driver files from the Windoze box (printserver)	smbclient -U"${ntprinteradmin}%${ntadminpasswd}" -d 2 \	//${nthost}/print\$ -c \	"cd WIN40\\${driverversion};prompt;mget ${AllFiles}" ;	ls -1 \	| sort -f \	| uniq \	| tee ../AllFilesIGot ;	cd ${CURRENTWD} ;	done ;fi}# -----------------------------------------------------------------------------# -------------- Now upload the driverfiles and activate them! ----------------# Upload files into root "Architecture" directory of Samba'a [print$] share...# -----------------------------------------------------------------------------#function helpwithuploadallWIN40drivers(){echo -e " \n\################################################################################# #		    About uploadallWIN40drivers()...#           	    --------------------------------## PRECONDITIONS: 1) This function expects to have '\$smbhost', '\$smbprinteradmin'#		    and '\$smbadminpasswd' variables set to according values.#		 2) This function expects to find \"AllFiles\", \"AllFilesIGot\"#		    and \"AllFilesIAskFor\" in the subdirectory #		    \"\${nthost}/WINI40/<drivername>/<driverversion>/TheFiles\".## WHAT IT DOES: These function uses \"smbclient\" to connect to the new Samba#		print server "\$nthost" and upload the printer driver files into#		the \"[print\$]\" share there.#		To achieve that in an orderly fashion, the previously created#		subdirectories (named like the drivers fetched previously from#		\$smbhost) are visited in turn and the related files are#		uploaded for each driver/directory.#		For this to really succeed, \"AllFilesIGot\" and \"AllFilesIAskFor\"#		are compared with the help of the \"sdiff\" utility to decide#		how to re-name the mis-matching filenams, so that the used#		driver upload command's spelling convention is met....## IF IT DOESN'T WORK: The function \"fetchenumdrivers3listfromNThost\" and#		      consecutive ones may not have been run successfully. This#		      is a precondition for the current function.#               # HINT: The current values: 'nthost'=\"$nthost\"#			    'ntprinteradmin'=\"$ntprinteradmin\"#			    'ntadminpasswd'=<not shown here, check yourself!># #################################################################################           ............PRESS \"q\" TO QUIT............" \|less}               function uploadallWIN40drivers(){if stringinstring help $@ ; thenhelpwithuploadallWIN40drivers ;else	echo " "	echo " "	echo "--> Running now function uploadallWIN40drivers()...."	echo "===================================================="		for i in ${nthost}/WIN40/*/*/; do \	CURRENTWD=${PWD} ;	cd "${i}" ; 							# we are now in [..]/WIN40/[drvrname]/[0]/		driverversion="$(basename "$(echo "$PWD")")" ;		echo "$(basename "$(echo "$PWD")")" > driverversion ;	cd TheFiles ;							# we are now in [..]/WIN40/[drvrname]/[0]/TheFiles	echo " "	echo "===================================================="	echo "Uploading driverfiles now from ${PWD}....";	echo "===================================================="	echo " "	set -x ;		smbclient -U"${smbprinteradmin}%${smbadminpasswd}" -d 2 \	//${smbhost}/print\$ \	-c "mkdir WIN40;cd WIN40;prompt;mput $( cat ../AllFilesIGot )";	cd .. ;							# we are now in [..]/WIN40/[drvrname]/[0]/# Now tell Samba that those files are *printerdriver* files....# The "adddriver" command will move them to the "0" subdir and create or# update the associated *.tdb files (faking the MS Windows Registry on Samba)	Drivername="$( cat Drivername )"		set -x ;	[ x"$( cat Dependentfiles)" == x"" ] && echo NULL > Dependentfiles;	sdiff -s AllFilesIGot AllFilesIAskFor \	| tee sdiff-of-Requested-and-Received.txt ;	[ -s sdiff-of-Requested-and-Received.txt ] \	|| rm -f sdiff-of-Requested-and-Received.txt \	&& cat sdiff-of-Requested-and-Received.txt > ../sdiff-of-Requested-and-Received.txt ;		cat sdiff-of-Requested-and-Received.txt \	| sed -e 's/^/mv /' \	| sed -e 's/ *|/  /' \	| tee rename-Received-to-Requested-case.txt ;	sh -x rename-Received-to-Requested-case.txt ;	mv rename-Received-to-Requested-case.txt rename-Received-to-Requested-case.done ;        echo " ################ DEBUGGING STATEMENT "	echo "rpcclient -U\"${smbprinteradmin}%${smbadminpasswd}\" -d 2 \	-c \'adddriver \"Windows NT x86\" \"$( cat Drivername ):$( cat DriverPath ):$( cat Datafile ):$( cat Configfile ):$( cat Helpfile ):NULL:RAW:$( cat Dependentfiles )\" $( cat driverversion )" \	${smbhost}\' ;        echo " ################ DEBUGGING STATEMENT "	rpcclient -U"${smbprinteradmin}%${smbadminpasswd}" -d 2 \	-c "adddriver \"Windows 4.0\" \"$( cat Drivername ):$( cat DriverPath ):$( cat Datafile ):$( cat Configfile ):$( cat Helpfile ):NULL:RAW:$( cat Dependentfiles )\" $( cat driverversion )" \	${smbhost} ;		set +x ;	cd ${CURRENTWD} ;							# we are now back to where we started	done;fi}# Now tell Samba which printqueue this driver is associated with....# The "setdriver" command will do just that and create or# update the associated *.tdb files (faking the MS Windows Registry on Samba)#	rpcclient -U"${smbprinteradmin}%${smbadminpasswd}" \#	-c "setdriver \"${printername}\" \"${DriverName}\"" \#	${smbhost}#  -- NOT YET IMPLEMENTED IN THIS SCRIPT ---## Now set a nice printer comment and let the world know what we've done# (or not.... ;-)#	rpcclient -U"${smbprinteradmin}%${smbadminpasswd}" \#	-c "setprinter \"${printername}\" \"Driver was installed and set via MS-RPC (rpcclient commandline from Linux)\"" \#	${smbhost}#  -- NOT YET IMPLEMENTED IN THIS SCRIPT ---#	#source ${0} ;enumallfunctions;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -