Multifunction Printers

Set of THREE scripts I wrote to bring SCX-4100, SCX-3400 Samsung (r) mf printers in a GNU/Linux environment openSUSE 12.2 32 bit i686.

*** THIS POST IS UNDER REVIEW: NOT RELIABLE AT THE MOMENT***

SCRIPT 1


#!/bin/sh
#2012.1017
#
# sam.driver.sh
#
#My purpose is to grab relevant files from the package "UnifiedLinuxDriver_1.01.tar.gz"
#and build with them a structure (from now on referred as "structure") of folders/files that later
#can be safely copied system-wide manually or by means of the script 'root.sam.driver.sh' by the root user
#so to have a working samsung(r) mfp without messing up the system with the original 'install.sh' script.
#
#In case the structure has been copied through 'root.sam.driver.sh' and if it is not needed anymore,
#the system administrator can use the script 'remove.sam.driver.sh' to remove the structure and the associated
#links.
#
#The present script will create a structure that will work only in 32-bit i686 systems (GNU/Linux Platforms)
#
#Probably this will safely work on many GNU/Linux Distributions.
#
#This original work has been developed on the following platform: openSUSE 12.2 ...
#
#At the time of writing this is in TESTING state. Do not execute as root: it won't give you any benefits
#
#REQUIREMENTS of the structure (once it will be installed): UnifiedLinuxDriver, libstdc++.so.5 (in package libstdc++33 or libstdc++5), several qt4 libraries
#
#USAGE : sam.driver.sh [FULL_PATH/TO/UnifiedLinuxDriver_1.01.tar.gz]
#
#The resulting structure will be rooted in $ARCHIVIO
#
ARCHIVIO=~/samlud
EXDIR=/tmp
CDROOT=$EXDIR/cdroot
CLIN=$EXDIR/cdroot/Linux

MFP=$ARCHIVIO/opt/Samsung/mfp
MFPSHARE=$MFP/share
MFPLIB=$MFP/lib
MFPBIN=$MFP/bin

ULOCALS=$ARCHIVIO/usr/local/smfp
ULOCALSE=$ULOCALS/etc
ULOCALSL=$ULOCALS/lib
ULOCALSSCMMS=$ULOCALS/share/cups/model/manufacturer-PPDs/samsung

FILE=$1
#Uncomment the following if you want to get it from the Internet
#FILE=UnifiedLinuxDriver_1.01.tar.gz
#URLF=http://downloadcenter.samsung.com/content/DR/201110/20111020101424892/$FILE
#ftp $URLF

if [ -z “$FILE” -o ! -s “$FILE” ]
then echo -e “Please, feed me with full path to Samsung Unified Linux Driver 1.01. Sorry, I must quit!\n” ; echo -e “USAGE : sam.driver.sh [FULL_PATH/TO/UnifiedLinuxDriver_1.01.tar.gz]\n” ;exit 1
fi

mkdir -p $MFPSHARE $MFPLIB $MFPBIN $ULOCALSE $ULOCALSL $ULOCALSSCMMS

tar xzf $FILE -C $EXDIR; sleep 3

cp -i $CLIN/install.sh $MFPSHARE
cp -i $CLIN/OEM.ini $MFPSHARE

cp -i -r $CLIN/noarch/at_root/etc/* $ULOCALSE

tar xzf $CLIN/noarch/libtiff-3-i386.tar.gz –strip-components=2 -C $MFPLIB usr/lib/libtiff.so.3.6.1
cp -i -r $CLIN/noarch/qt4/at_opt/share/* $MFPSHARE
cp -i -r $CLIN/noarch/at_opt/share/* $MFPSHARE

cp -i -r $CLIN/i386/at_root/usr/lib/* $ULOCALSL
cp -i -r $CLIN/i386/at_root/opt/smfp-common $MFP
#cp -i -r $CLIN/i386/qt4/at_root/opt/smfp-common/lib/libnet* $MFPLIB
cp -i -r $CLIN/i386/qt4/at_opt/lib/* $MFPLIB
cp -i -r $CLIN/i386/qt4/at_opt/bin/* $MFPBIN
cp -i -r $CLIN/i386/at_opt/bin/* $MFPBIN

chmod -R go-w $ARCHIVIO
chmod -R u+w $ARCHIVIO
chmod -R u+w $CLIN

find $ARCHIVIO -type f -exec chmod ugo-x ‘{}’ \;
find $ARCHIVIO -type f -path \*\/lib\/\* -exec chmod ugo+x ‘{}’ \;
find $ARCHIVIO -type f -path \*\/bin\/\* -exec chmod ugo+x ‘{}’ \;

cp -i -r $MFPSHARE/ppd/* $ULOCALSSCMMS

rm -r $CDROOT

echo “Please, remove $FILE if you have downloaded it and you do not need it anymore”

SCRIPT 2

 

#!/bin/sh
#
#2012.1020
#
# root.sam.driver.sh
#
#My purpose is to grab the structure rooted in $SAMLUD and copy it
#system-wide in some defaults location and also create relevant links. This means
#that I must be executed using root privileges (or eq).
#
#REQUIREMENTS of the structure (once it will be installed): libstdc++.so.5 (in package libstdc++33 or libstdc++5), several qt4 libraries
#
#This script is divided in four parts
#1-Copy the data
#2-Create relevant links
#3-Run ldconfig
#4-Print out actions the root user must manually accomplish next
#
#USAGE: root.sam.driver.sh [PATH/TO/samlud]
#
COPIA=”cp -v -r -i”
AZIONE=”ln -s -v”
PERCORSOE=/usr/local/smfp
PERCORSO=/usr/local/smfp
SAMLUD=$1
SAMLUDOPTS=$SAMLUD/opt/Samsung
SAMLUDULS=$SAMLUD/usr/local/smfp
FILELOG=~/log.root.sam.driver

if [ -z “$1” -o ! -r “$SAMLUD” ]
then echo “Please, feed me with full path to ‘samlud”s parent directory and a valid ‘samlud’. I can not proceed any further, sorry!” ; echo “USAGE: root.sam.driver.sh [PATH/TO/samlud]”; exit 1
fi

echo “Installing sam.driver `date`” > $FILELOG
echo “” >> $FILELOG
echo “**** Proceeding with $COPIA ****” >> $FILELOG
$COPIA $SAMLUDOPTS /opt >> $FILELOG
$COPIA $SAMLUDULS $PERCORSO >> $FILELOG
echo “” >> $FILELOG
echo “**** Proceeding with $AZIONE ****” >> $FILELOG

cd /usr/lib/sane
$AZIONE $PERCORSO/lib/sane/libsane-smfp.so.1.0.1 >> $FILELOG
cd /usr/lib/cups/backend
$AZIONE $PERCORSO/lib/cups/backend/mfp >> $FILELOG
cd /usr/lib/cups/filter
$AZIONE $PERCORSO/lib/cups/filter/rastertosamsungsplc >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/libscmssc.so >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/smfpautoconf >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/rastertosamsungspl >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/pstosecps >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/pstospjlps >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/pscms >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/smfppreload >> $FILELOG
cd /usr/lib
$AZIONE $PERCORSO/lib/libmfp.so.1.0.1 >> $FILELOG
cd /usr/share/cups/model/manufacturer-PPDs >> $FILELOG
$AZIONE $PERCORSO/share/cups/model/manufacturer-PPDs/samsung >> $FILELOG

cd /etc/cups
$AZIONE $PERCORSOE/etc/cups/pstosecps.types >> $FILELOG
$AZIONE $PERCORSOE/etc/cups/smfp.types >> $FILELOG
$AZIONE $PERCORSOE/etc/cups/smfp.convs >> $FILELOG
$AZIONE $PERCORSOE/etc/cups/pstosecps.convs >> $FILELOG
$AZIONE $PERCORSOE/etc/cups/pstospjlps.types >> $FILELOG
$AZIONE $PERCORSOE/etc/cups/pstospjlps.convs >> $FILELOG
cd /etc/sane.d
$AZIONE $PERCORSOE/etc/sane.d/smfp.conf >> $FILELOG

ldconfig -n /usr/lib/sane
ldconfig -n /usr/lib

echo -e “\n”
echo -e ‘*** What to do next (probably all the following steps are necessary) ***\n’
echo -e ‘#1- Please, _manually_ write smfp in /etc/sane.d/dll.conf’
echo -e ‘#2- Please, _manually_ write /opt/Samsung/mfp/lib in /etc/ld.so.conf’
echo -e ‘#3- Please, _manually_ write /opt/Samsung/mfp/smfp-common/lib in /etc/ld.so.conf’
echo -e ‘#4- Please, once /etc/ld.so.conf is modified, run ldconfig -n /opt/Samsung/mfp/lib /opt/Samsung/mfp/smfp-common/lib’
echo -e ‘#5- Please, if you are going to print/scan from network be sure to tell this system’\”s firewall not to block incoming connections from your printer’\”s IP address’
echo -e ‘#6- Take a look at all the (useful?) binaries located in /opt/Samsung/mfp/bin\n’
echo -e ‘*** —————————————————————- ***\n’

SCRIPT 3


#!/bin/sh
#
# remove.sam.driver.sh
#
#My purpose is to remove files (files/links/folders) previously
#copied system-wide through root.sam.driver.sh
#
#This script is divided in 4 parts
#1- Completely remove $SAMLUDOPTS
#2- Completely remove links
#3- Run ldconfig
#4- Print out actions root should accomplish next
#
#USAGE: remove.sam.driver.sh
#
AZIONE="rm -v"
PERCORSOE=/
PERCORSO=/usr

SAMLUD=/
SAMLUDOPTS=$SAMLUD/opt/Samsung
SAMLUDULS=$SAMLUD/usr/local/smfp
FILELOG=~/log.remove.sam.driver
echo “Removing sam.driver `date`” > $FILELOG
rm -v -r $SAMLUDOPTS >> $FILELOG
rm -v -r $SAMLUDULS >> $FILELOG
#cd /usr/lib/sane
$AZIONE $PERCORSO/lib/sane/libsane-smfp.so.1.0.1 >> $FILELOG
#cd /usr/lib/cups/backend
$AZIONE $PERCORSO/lib/cups/backend/mfp >> $FILELOG
#cd /usr/lib/cups/filter
$AZIONE $PERCORSO/lib/cups/filter/rastertosamsungsplc >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/libscmssc.so >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/smfpautoconf >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/rastertosamsungspl >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/pstosecps >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/pstospjlps >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/pscms >> $FILELOG
$AZIONE $PERCORSO/lib/cups/filter/smfppreload >> $FILELOG
#cd /usr/lib
$AZIONE $PERCORSO/lib/libmfp.so.1.0.1 >> $FILELOG
#cd /usr/share/cups/model/manufacturer-PPDs
$AZIONE $PERCORSO/share/cups/model/manufacturer-PPDs/samsung >> $FILELOG

#cd /etc/cups
$AZIONE $PERCORSOE/etc/cups/pstosecps.types >> $FILELOG
$AZIONE $PERCORSOE/etc/cups/smfp.types >> $FILELOG
$AZIONE $PERCORSOE/etc/cups/smfp.convs >> $FILELOG
$AZIONE $PERCORSOE/etc/cups/pstosecps.convs >> $FILELOG
$AZIONE $PERCORSOE/etc/cups/pstospjlps.types >> $FILELOG
$AZIONE $PERCORSOE/etc/cups/pstospjlps.convs >> $FILELOG
#cd /etc/sane.d
$AZIONE $PERCORSOE/etc/sane.d/smfp.conf >> $FILELOG

ldconfig -n /usr/lib/sane
ldconfig -n /usr/lib

echo -e “\n”
echo -e ‘*** What to do next (to do or not to do… it depends on what it has been done before) ***\n’
echo -e ‘#1- Please, _manually_ remove smfp from /etc/sane.d/dll.conf’
echo -e ‘#2- Please, _manually_ remove /opt/Samsung/mfp/lib from /etc/ld.so.conf’
echo -e ‘#3- Please, _manually_ remove /opt/Samsung/mfp/smfp-common/lib from /etc/ld.so.conf’
echo -e ‘#4- Please, run ldconfig’
echo -e ‘#4- Please, restore your firewall settings as per your printer’\”s IP address \n’
echo -e ‘*** ———————————————————————————- ***\n’

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: