📄 vampiredriversfunctions
字号:
| uniq \ | tr / _ \ | sed -e 's/$/\"/' \ | sed -e 's/^ */mkdir '\""${nthost}"'\/W32X86\//' \ | tee \ ${nthost}/makesubdirsforW32X86driverlist.txt; sh -x ${nthost}/makesubdirsforW32X86driverlist.txt;# rm ${nthost}/makesubdirsforW32X86driverlist.txt;fi}# -----------------------------------------------------------------------------# ----------- Split the WIN40 driverfile listing of each architecture ---------# ------------------------ into individual drivers ----------------------------# -----------------------------------------------------------------------------#function helpwithmakesubdirsforWIN40driverlist(){echo -e " \n\################################################################################# # About splitWIN40fileintoindividualdriverfiles() and # splitW32X86fileintoindividualdriverfiles()...# ---------------------------------------------------## PRECONDITIONS: 1) These functions expect write access to the current directory# and its subdirs '\$nthost/*/'. # 2) These functions expect to have the '\$nthost' variable set# to the according value.# 3) These functions expect to find the two files# '\${nthost}/WIN40/\${nthost}-enumdrivers3list-WIN40.txt' and# '\${nthost}/W32X86/\${nthost}-enumdrivers3list-NTx86.txt' to# work on.## WHAT IT DOES: 1) These functions create a directory for each printer driver. # The directory name is identical to the driver name. # 2) For each supported driver version (\"0\", \"2\" and \"3\") it# creates a subdirectory as required underneath # './\$nthost/<architecture>'. # 3) The directories use the drivernames (including spaces) for # their names. ("/" - slashes - in drivernames are converted to# underscores).# 4) In each subdirectory they dissect the original # '\$nthost/enumdrivers3list.txt' (using "sed", "cat", "awk" # and "grep") and store that part describing the related driver# (under the name \"driverfilesversion.txt\". # 5) For each driver the files \"Drivername\", \"DriverPath\", # \"Drivername\", \"Configfile\", \"Helpfile\", \"AllFiles\" and# \"Dependentfilelist\" are stored in the according directory# which hold contend that is used by other (downstream) # functions.# 6) It creates a file named \"AllFilesIAskFor\" which holds the # case sensitive names of files it wanted to download. It also # creates a file named \"AllFilesIGot\" which holds the case # sensitive spelling of the downloaded files. (Due to # Microsoft's ingenious file naming tradition, you may have # asked for a \"PS5UI.DLL\" but gotten a \"ps5ui.dll\".# 7) The 2 files from 6) will be later compared with the help of# the \"sdiff\" utility to decide how to re-name the files so# that the subsequent 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: You currently have defined: 'nthost'=\"$nthost\".# ################################################################################# ............PRESS \"q\" TO QUIT............" \|less} # -----------------------------------------------------------------------------function splitWIN40fileintoindividualdriverfiles(){if stringinstring help $@ ; thenhelpwithmakesubdirsforWIN40driverlist ;else echo " " echo " " echo "--> Running now function splitWIN40fileintoindividualdriverfiles()..." echo "=====================================================================" for i in ${nthost}/WIN40/*/; do CWD1="$( pwd )" ; cd "${i}" ; echo " " echo " " echo " ###########################################################################################" echo " " echo " Next driver is \"$( basename "$( pwd)" )\"" echo " " echo " ###########################################################################################"##### echo "yes" | cp -f ../../../${nthost}/WIN40/${nthost}-enumdrivers3list-WIN40.txt . 2> /dev/null ; ln -s -f ../${nthost}-enumdrivers3list-WIN40.txt ${nthost}-enumdrivers3list-WIN40.lnk ; tac ${nthost}-enumdrivers3list-WIN40.lnk \ | sed -e '/'"$(basename "$(echo "$PWD")")"'/,/Version/ p' -n \ | grep Version \ | uniq \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print "mkdir \"" $1 "\"" }' \ | tee mkversiondir.txt ; sh mkversiondir.txt 2> /dev/null ; cat ${nthost}-enumdrivers3list-WIN40.lnk \ | sed -e '/\['"$(basename "$(echo "$PWD")")"'\]/,/Monitor/ w alldriverfiles.txt' -n ; for i in */; do CWD2="$( pwd )" ; cd "${i}"; echo "yes" | cp ../alldriverfiles.txt . 2> /dev/null ; cat alldriverfiles.txt \ | egrep '(\\'"$(basename "$( pwd )")"'\\|Driver Name)' \ | tee driverfilesversion.txt ; Drivername=$( grep "Driver Name:" driverfilesversion.txt \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print $1 }' \ | sort -f \ | uniq \ | tee Drivername ) ; DriverPath=$( grep "Driver Path:" driverfilesversion.txt \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print $1 }' \ | awk -F "WIN40" '{ print $2 }' \ | awk -F "\\" '{ print $3 }' \ | sort -f \ | uniq ) ; echo "${DriverPath}" \ | tee DriverPath ; Datafile=$( grep "Datafile:" driverfilesversion.txt \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print $1 }' \ | awk -F "WIN40" '{ print $2 }' \ | awk -F "\\" '{ print $3 }' \ | sort -f \ | uniq ) ; echo "${Datafile}" \ | tee Datafile ; Configfile=$( grep "Configfile:" driverfilesversion.txt \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print $1 }' \ | awk -F "WIN40" '{ print $2 }' \ | awk -F "\\" '{ print $3 }' \ | sort -f \ | uniq ) ; echo "${Configfile}" \ | tee Configfile ; Helpfile=$( grep "Helpfile:" driverfilesversion.txt \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print $1 }' \ | awk -F "WIN40" '{ print $2 }' \ | awk -F "\\" '{ print $3 }' \ | sort -f \ | uniq ) ; echo "${Helpfile}" \ | tee Helpfile ; Dependentfilelist=$( grep "Dependentfiles:" driverfilesversion.txt \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print $1 }' \ | awk -F "WIN40" '{ print $2 }' \ | awk -F "\\" '{ print $3 }' \ | sort -f \ | uniq ) ; Dependentfiles=$( echo $Dependentfilelist \ | sed -e 's/ /,/g ' ) ; echo "${Dependentfiles}" \ | tee Dependentfiles AllFiles=$( echo ${Dependentfilelist}; echo ${Helpfile}; echo ${Configfile}; echo ${Datafile}; echo ${DriverPath} ); echo "${AllFiles}" \ | sort -f \ | uniq \ | tee AllFiles ; for i in $( cat AllFiles ); do echo ${i}; done \ | sort -f \ | uniq \ | tee AllFilesIAskFor ; cd "${CWD2}" 1> /dev/null ; done# rpcclient -U"${smbprinteradmin}%${smbadminpasswd}" \# -c "adddriver \"${Architecture}\" \"${DriverName}:${DriverPath}:${Datafile}:${Configfile}:${Helpfile}:NULL:RAW:${Dependentfiles}\" ${Version}" \ ${smbhost}# rpcclient -U"${smbprinteradmin}%${smbadminpasswd}" \# -c "setdriver \"${printername}\" \"${DriverName}\"" \# ${smbhost}## rpcclient -U"${smbprinteradmin}%${smbadminpasswd}" \# -c "setprinter \"${printername}\" \"Driver was installed and set via MS-RPC (utilized by Kurt Pfeifle\'s set of \"Vampire Printerdrivers\" scripts from Linux)\"" \# ${smbhost} cd "${CWD1}" 1> /dev/null ; done;fi}# -----------------------------------------------------------------------------# ---------- Split the W32X86 driverfile listing of each architecture ---------# ------------------------ into individual drivers ----------------------------# -----------------------------------------------------------------------------#function splitW32X86fileintoindividualdriverfiles(){if stringinstring help $@ ; thenhelpwithmakesubdirsforWIN40driverlist ;else echo " " echo " " echo "--> Running now function splitW32X86fileintoindividualdriverfiles()..." echo "======================================================================" for i in ${nthost}/W32X86/*/; do CWD1="$( pwd )" ; cd "${i}" ; echo " " echo " " echo " ###########################################################################################" echo " " echo " Next driver is \"$( basename "$( pwd)" )\"" echo " " echo " ###########################################################################################"###### echo "yes" | cp -f ../../../${nthost}/W32X86/${nthost}-enumdrivers3list-NTx86.txt . 2> /dev/null ; ln -s -f ../${nthost}-enumdrivers3list-NTx86.txt ${nthost}-enumdrivers3list-NTx86.lnk ; tac ${nthost}-enumdrivers3list-NTx86.lnk \ | sed -e '/'"$(basename "$(echo "$PWD")")"'/,/Version/ p' -n \ | grep Version \ | uniq \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print "mkdir \"" $1 "\"" }' \ | tee mkversiondir.txt ; sh mkversiondir.txt 2> /dev/null ; cat ${nthost}-enumdrivers3list-NTx86.lnk \ | sed -e '/\['"$(basename "$(echo "$PWD")")"'\]/,/Monitor/ w alldriverfiles.txt' -n ; for i in */; do CWD2="$( pwd )" ; cd "${i}"; echo "yes" | cp ../alldriverfiles.txt . 2> /dev/null ; cat alldriverfiles.txt \ | egrep '(\\'"$(basename "$( pwd )")"'\\|Driver Name)' \ | tee driverfilesversion.txt ; Drivername=$( grep "Driver Name:" driverfilesversion.txt \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print $1 }' \ | sort -f \ | uniq \ | tee Drivername ) ;# echo "${Drivername}" \# | tee Drivername ; DriverPath=$( grep "Driver Path:" driverfilesversion.txt \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print $1 }' \ | awk -F "W32X86" '{ print $2 }' \ | awk -F "\\" '{ print $3 }' \ | sort -f \ | uniq ) ; echo "${DriverPath}" \ | tee DriverPath ; Datafile=$( grep "Datafile:" driverfilesversion.txt \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print $1 }' \ | awk -F "W32X86" '{ print $2 }' \ | awk -F "\\" '{ print $3 }' \ | sort -f \ | uniq ) ; echo "${Datafile}" \ | tee Datafile ; Configfile=$( grep "Configfile:" driverfilesversion.txt \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print $1 }' \ | awk -F "W32X86" '{ print $2 }' \ | awk -F "\\" '{ print $3 }' \ | sort -f \ | uniq ) ; echo "${Configfile}" \ | tee Configfile ; Helpfile=$( grep "Helpfile:" driverfilesversion.txt \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print $1 }' \ | awk -F "W32X86" '{ print $2 }' \ | awk -F "\\" '{ print $3 }' \ | sort -f \ | uniq ) ; echo "${Helpfile}" \ | tee Helpfile ; Dependentfilelist=$( grep "Dependentfiles:" driverfilesversion.txt \ | awk -F "[" '{ print $2 }' \ | awk -F "]" '{ print $1 }' \ | awk -F "W32X86" '{ print $2 }' \ | awk -F "\\" '{ print $3 }' \ | sort -f \ | uniq ) ; Dependentfiles=$( echo $Dependentfilelist \ | sed -e 's/ /,/g ' ) ; echo "${Dependentfiles}" \ | tee Dependentfiles AllFiles=$( echo ${Dependentfilelist}; echo ${Helpfile}; echo ${Configfile}; echo ${Datafile}; echo ${DriverPath} ) ; echo "${AllFiles}" \ | sort -f \ | uniq \ | tee AllFiles ; for i in $( cat AllFiles ); do echo ${i}; done \ | sort -f \ | uniq \ | tee AllFilesIAskFor ; cd "${CWD2}" 1> /dev/null ; done# rpcclient -U"${smbprinteradmin}%${smbadminpasswd}" \# -c "adddriver \"${Architecture}\" \"${DriverName}:${DriverPath}:${Datafile}:${Configfile}:${Helpfile}:NULL:RAW:${Dependentfiles}\" ${Version}" \ ${smbhost}# rpcclient -U"${smbprinteradmin}%${smbadminpasswd}" \# -c "setdriver \"${printername}\" \"${DriverName}\"" \# ${smbhost}## rpcclient -U"${smbprinteradmin}%${smbadminpasswd}" \# -c "setprinter \"${printername}\" \"Driver was installed and set via MS-RPC (utilized by Kurt Pfeifle\'s set of \"Vampire Printerdrivers\" scripts from Linux)\"" \# ${smbhost} cd "${CWD1}" 1> /dev/null ; done;fi}# -----------------------------------------------------------------------------# ------------------ First download the driverfiles........... ----------------# -----------------------------------------------------------------------------#function helpwithfetchallW32X86driverfiles(){echo -e " \n\################################################################################# # About fetchallW32X86driverfiles()...# ------------------------------------## PRECONDITIONS: 1) This function expects to have the \'\$nthost\' variable set# to the according value.# 2) This function expects to find files \"AllFiles\", # \"AllFilesIAskFor\", and \"AllFilesIGot\" in the directories # \'\${nthost}/<architecture>/<drivername>/<version>/\'. ## 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!># ################################################################################"} # -----------------------------------------------------------------------------function fetchallW32X86driverfiles(){if stringinstring help $@ ; thenhelpwithfetchallW32X86driverfiles ;else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -