Commit c1b30ce9 authored by testing testuser's avatar testing testuser

Adds printer script

parent ad58bf47
......@@ -5,7 +5,7 @@
<key>Label</key>
<string>com.user.loginscript</string>
<key>Program</key>
<string>/Users/Shared/mountist.sh</string>
<string>/Users/Shared/mac-scripts/mountist.sh</string>
<key>RunAtLoad</key>
<true/>
</dict>
......
#!/bin/sh
# Download and run the script that will mount network shares.
# Jean St. Laurent, Jozef Reisinger, Liviu Radulescu
# Sets a launch agent for the current user to run mountist.sh
MOUNTIST='mountist.sh'
MOUNTIST_COMMAND="/Users/$1/.$MOUNTIST"
MOUNTIST_LOCAL_COMMAND="/Users/$1/.mountist_local.sh"
ECHO_N='/bin/echo -n'
clear
echo '######################'
echo '# IST Network Shares #'
echo '######################'
cd /Users/Shared/mac-scripts && git pull
mkdir -p /Users/$1/Library/LaunchAgents
cp /Users/Shared/com.user.loginscript.plist /Users/$1/Library/LaunchAgents/com.user.loginscript.plist
......@@ -30,7 +30,7 @@ systemsetup -setremotelogin on
# dsconfigad -remove IST.LOCAL -computer "`hostname -s`" -username $admuser
# add domain admins to admin
dsconfigad -groups "IST.LOCAL\Domain Admins"
dsconfigad -groups "Domain Admins"
# add user to admin
dseditgroup -o edit -n /Local/Default -u $admuser -p -a $username -t user admin
......
#!/bin/sh
# This script installs the floor printers on a Macintosh computer.
# Written by Jean St-Laurent
# Check if the RICOH driver is present
# Install it it's not found
if [ ! -f /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A ];
then
# Check osx version and if Snow Leopard or less don't use dfs
macversion=`sw_vers -productVersion | cut -d "." -f 2`
if [ $macversion -gt 6 ]; then
file="ricoh2.0.0.pkg"
else
file="ricoh1.0.3.pkg"
fi
# Download the printer files for MAC
curl -o ~/ricoh.pkg http://lserv44.ista.local/mac/$file > /dev/null 2>&1
# If fails it probably means that the network is not connected and send an error message to the user.
if [ ! $? == 0 ];
then
echo "It seems that you are not connected to the IST network."
echo "If you are outside the institution, make sure your vpn connection is established."
read ok
exit 1
fi
fi
# Ask for the admin rights from the user and loop until he really type the good password.
sudo -p "Please enter your Mac login password:" echo
while [ $? -gt 0 ]; do
sudo -p "Wrong password. Please enter your Mac login password:" echo
done
echo "Please be patient while the printers are being installed."
# Install RICOH drivers
if [ -f ~/ricoh.pkg ];
then
sudo -S installer -pkg ~/ricoh.pkg -target / > /dev/null 2>&1
fi
# Verify that we have a special driver with the finisher
if [ ! -f /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher ];
then
sudo cp -p /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher
sudo sed -i '' 's/DefaultFinisher: NotInstalled/DefaultFinisher: FinEUPHRATESFBK/g' /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher
fi
# Add the printers to the MAC. Should we loop through a file? Maybe... let's see
sudo lpadmin -p printer-I01-1st -D "Central Building 1st floor" -L "Central Building 1st floor" -E -v socket://p0117101.ista.local:9100 -P /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher -o printer-is-shared=false
sudo lpadmin -p printer-I01-2nd -D "Central Building 2nd floor" -L "Central Building 2nd floor" -E -v socket://p0117102.ista.local:9100 -P /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher -o printer-is-shared=false
sudo lpadmin -p printer-I01-3rd -D "Central Building 3rd floor" -L "Central Building 3rd floor" -E -v socket://p0117103.ista.local:9100 -P /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher -o printer-is-shared=false
sudo lpadmin -p printer-I04-1st -D "Bertalanffy Building 1st floor" -L "Bertalanffy Building 1st floor" -E -v socket://p0417101.ista.local:9100 -P /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher -o printer-is-shared=false
sudo lpadmin -p printer-I04-2nd -D "Bertalanffy Building 2nd floor" -L "Bertalanffy Building 2nd floor" -E -v socket://p0417102.ista.local:9100 -P /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher -o printer-is-shared=false
sudo lpadmin -p printer-I04-3rd -D "Bertalanffy Building 3rd floor" -L "Bertalanffy Building 3rd floor" -E -v socket://p0417103.ista.local:9100 -P /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher -o printer-is-shared=false
sudo lpadmin -p printer-I03-gf -D "Admin Building ground floor" -L "Admin Building ground floor" -E -v socket://p0317100.ista.local:9100 -P /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher -o printer-is-shared=false
sudo lpadmin -p printer-I03-1st -D "Admin Building 1st floor" -L "Admin Building 1st floor" -E -v socket://p0317101.ista.local:9100 -P /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher -o printer-is-shared=false
sudo lpadmin -p printer-I06-1st -D "Lab Building East 1st floor" -L "Lab Building East 1st floor" -E -v socket://p0617101.ista.local:9100 -P /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher -o printer-is-shared=false
sudo lpadmin -p printer-I06-2nd -D "Lab Building East 2nd floor" -L "Lab Building East 2nd floor" -E -v socket://p0617101.ista.local:9100 -P /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C4502A\ Finisher -o printer-is-shared=false
sudo lpadmin -p printer-I01-student -D "Central Building students office" -L "Central Building students office 3rd floor" -E -v socket://p0117018.ista.local:9100 -P /Library/Printers/PPDs/Contents/Resources/RICOH\ Aficio\ MP\ C3002 -o printer-is-shared=false
rm -f ~/ricoh.pkg
......@@ -5,10 +5,10 @@
rm -f $HOME/.mount_staffdata
DESKTOP="$HOME/Desktop"
LOG_FILE='/tmp/mountista.log'
LOG_FILE='/tmp/mountist.log'
username=`/usr/bin/id -un`
DOMAIN='IST.LOCAL'
IST_SHARES_FOLDER='IST-Net-Shares'
IST_SHARES_FOLDER=$HOME/Desktop/IST-Net-Shares
# bash builtin echo does not support -n
ECHO_N='/bin/echo -n'
......@@ -44,7 +44,6 @@ echo 'failed.'
$ECHO_N "Setting up the 'IST-Net-Shares' desktop folder ... "
# Create desktop folder holding links to mount points
IST_SHARES_FOLDER=$HOME/Desktop/IST-Net-Shares
if [ -d $IST_SHARES_FOLDER ]; then
# Remove old folders
find $IST_SHARES_FOLDER -iname .DS_Store -print -delete > /dev/null 2>&1
......
#!/bin/sh
# Download and run the script that will mount network shares.
# Jean St. Laurent, Jozef Reisinger, Liviu Radulescu
MOUNTIST='mountist.sh'
MOUNTIST_COMMAND="/Users/$1/.$MOUNTIST"
MOUNTIST_LOCAL_COMMAND="/Users/$1/.mountist_local.sh"
ECHO_N='/bin/echo -n'
clear
echo '######################'
echo '# IST Network Shares #'
echo '######################'
$ECHO_N 'Downloading the mounting script ... '
# Make sure that wifi is connected and network available.
ping -Q -c 1 ist.ac.at >> /dev/null 2>&1 || sleep 5
ping -Q -c 1 ist.ac.at >> /dev/null 2>&1 || sleep 5
ping -Q -c 1 ist.ac.at >> /dev/null 2>&1 || sleep 5
# Get the CA certificate if not already there
CACERT="/Users/$1/.IST.CA.CRT.pem"
if [ ! -e $CACERT ]; then
curl -o $CACERT http://intranet.ist.local/IST.CA.CRT.pem > /dev/null 2>&1
fi
# Grab the script in secure way
curl --cacert $CACERT -o $MOUNTIST_COMMAND https://script.ista.local/mac/$MOUNTIST > /dev/null 2>&1
if [ $? -eq 0 ]; then
# We got the script, skip rest of loop
break
else
# Some clients have problems with the certificate so try the insecure way
curl -o $MOUNTIST_COMMAND http://script.ista.local/mac/$MOUNTIST > /dev/null 2>&1
# Still no luck?
if [ $? -ne 0 ]; then
echo "failed"
echo "Make sure you're connected to IST network."
echo "(Press Enter to exit.)"
read
exit 1
fi
fi
echo 'done'
chmod +x $MOUNTIST_COMMAND
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment