Commit ad58bf47 authored by testing testuser's avatar testing testuser

Adds older file share scripts.

parent 33000949
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.loginscript</string>
<key>Program</key>
<string>/Users/Shared/mountist.sh</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
#!/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 '######################'
mkdir -p /Users/$1/Library/LaunchAgents
cp /Users/Shared/com.user.loginscript.plist /Users/$1/Library/LaunchAgents/com.user.loginscript.plist
#!/bin/sh
# Mount network shares for MacBooks.
# Nina Pollak, Jozef Reisinger, Liviu Radulescu
rm -f $HOME/.mount_staffdata
DESKTOP="$HOME/Desktop"
LOG_FILE='/tmp/mountista.log'
username=`/usr/bin/id -un`
DOMAIN='IST.LOCAL'
IST_SHARES_FOLDER='IST-Net-Shares'
# bash builtin echo does not support -n
ECHO_N='/bin/echo -n'
mount_ist() {
msg="$1"
share_point="$2"
mount_point="$3"
$ECHO_N "$msg"
mount_smbfs $share_point $mount_point > /dev/null 2>&1
[ $? -eq 0 ] && echo "done." || echo "failed."
}
date > $LOG_FILE
# Check osx version and if Snow Leopard or less don't use dfs
use_dfs=0
macversion=`sw_vers -productVersion | cut -d "." -f 2`
if [ $macversion -gt 6 ]; then use_dfs=1; fi
dfs_group="dfsgroup"
dfs_home="dfshome"
dfs_q="dfsq/$username"
# Cleanup
$ECHO_N 'Unmounting existing IST network shares ... ' &&
umount -h istsmb3.ist.local -t smbfs > /dev/null 2>&1 &&
umount -h istsmb3.ista.local -t smbfs > /dev/null 2>&1 &&
umount -h smb3.ista.local -t smbfs > /dev/null 2>&1 &&
umount -h archive3.ista.local -t smbfs > /dev/null 2>&1 &&
echo 'done.' ||
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
for f in `echo $IST_SHARES_FOLDER/Q/*`; do rmdir $f; unlink $f; done > /dev/null 2>&1
for f in `echo $IST_SHARES_FOLDER/*`; do rmdir $f; unlink $f; done > /dev/null 2>&1
fi
mkdir -p $IST_SHARES_FOLDER
echo 'done.'
open -g $IST_SHARES_FOLDER
#
# Main shares
#
[ ! -d $IST_SHARES_FOLDER/$username ] && mkdir $IST_SHARES_FOLDER/$username
[ ! -d $IST_SHARES_FOLDER/Idrive ] && mkdir $IST_SHARES_FOLDER/Idrive
if [ -f $HOME/.mount_staffdata -a ! -d $IST_SHARES_FOLDER/staffdata ]; then
mkdir -p $IST_SHARES_FOLDER/staffdata
fi
echo "Mounting IST-Net-Shares ... (please be patient)"
if [ -f $HOME/.mount_staffdata ]; then
mount_ist "Mounting staffdata ... " "//w1521030.ist.local/staffdata" "$IST_SHARES_FOLDER/staffdata"
fi
if [ $use_dfs -ne 0 ]; then
mount_ist "Mounting Idrive ... " //istsmb3.ist.local/Idrive $IST_SHARES_FOLDER/Idrive
mount_ist "Mounting $username home ... " "//istsmb3.ist.local/$dfs_home/$username" "$IST_SHARES_FOLDER/$username"
else
mount_ist "Mounting Idrive ... " "//istsmb3.ist.local/Idrive" "$IST_SHARES_FOLDER/Idrive"
mount_ist "Mounting $username home ... " "//istsmb3.ist.local/$username" "$IST_SHARES_FOLDER/$username"
fi
#
# Other shares: groups and archive
#
# Loop all the linux nis group the user belongs to
groups=`ldapsearch -LLL -x -h ldap.ista.local -b "ou=group,dc=ist,dc=ac,dc=at" memberUid=$username cn | grep cn: | cut -d " " -f 2`
for g in $groups
do
[ ! -d $IST_SHARES_FOLDER/$g ] && mkdir $IST_SHARES_FOLDER/$g
# Main group share
if [ $use_dfs -ne 0 ]; then
mount_ist "Mounting $g ... " "//istsmb3.ist.local/$dfs_group/$g" "$IST_SHARES_FOLDER/$g"
else
mount_ist "Mounting $g ... " "//istsmb3.ist.local/$g" "$IST_SHARES_FOLDER/$g"
fi
done
# User archive share
if [ $use_dfs -ne 0 ]; then
mkdir -p $IST_SHARES_FOLDER/Q
[ ! -d $IST_SHARES_FOLDER/Q/archive-$username ] && mkdir $IST_SHARES_FOLDER/Q/archive-$username
mount_ist "Mounting archive-$username ... " "//istsmb3.ist.local/$dfs_q/archive-$username" "$IST_SHARES_FOLDER/Q/archive-$username"
# Archive group share
for g in $groups; do
[ ! -d $IST_SHARES_FOLDER/Q/archive-$g ] && mkdir $IST_SHARES_FOLDER/Q/archive-$g
mount_ist "Mounting archive-$g ... " "//istsmb3.ist.local/${dfs_q}/archive-$g" "$IST_SHARES_FOLDER/Q/archive-$g"
done
fi
# Replace the imount script if it is not the current one
# curl -o $IMOUNT_COMMAND http://script.ista.local/mac/$IMOUNT > $LOG_FILE 2>&1
# chmod +x $IMOUNT_COMMAND
sleep 2
#!/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