User creation / mod + eric scripts

parent 5efe098e
......@@ -4,12 +4,24 @@ then
echo "This script should be run as root"
exit 1
fi
USERS="01-mini 02-super 03-maxi prof direction"
DIR=`dirname $0`
NEW_USERS="prof direction"
USERS="01-mini 02-super 03-maxi administrateur $NEW_USERS"
declare -A USER_COMMENTS
USER_COMMENTS=( \
[01-mini] = "01-CP"\
[02-maxi] = "02-CM1-CM2"\
[03-super] = "03-CE1-CE2"\
[prof] = "04-prof"\
[direction] = "05-direction"\
[administrateur] = "administrateur"\
)
PKG_TO_INSTALL="cups-browsed x11vnc evince"
PKG_TO_REMOVE="proxy-protect-firefox-esr dansguardian tinyproxy dillo xpdf"
MANUAL_APP_TO_REMOVE="seamonkey dillo"
PROXY_URL="http://dnsproxy:3128"
echo "Installating packages"
......@@ -18,9 +30,23 @@ apt-get -y remove --purge $PKG_TO_REMOVE
apt-get -y autoremove --purge
apt-get -y install $PKG_TO_INSTALL
# Todo rename users / update password
echo "Adding x11vnc"
cp $DIR/x11vnc.desktop /usr/share/applications/
echo "Creating users $NEW_USERS"
for u in $NEW_USERS
do
groupadd $u
useradd $u --create-home --groups $u,cdrom,audio,video,plugdev,netdev,lpadmin,scanner,sambashare --gid $u
done
echo "Renaming users"
for u in "${!array[@]}"
do
usermod -c ${array[$u]} $u
done
echo "Configuring firefox for network auto detect"
echo "Configuring user session"
for u in $USERS
do
profile=`awk -F = '/^Path/{print $2}' /home/$u/.mozilla/firefox/profiles.ini`
......@@ -29,6 +55,11 @@ do
echo $preffile
sed -i.bak -e '/user_pref("network.proxy.type")/d' $preffile
echo 'user_pref("network.proxy.type", 4);' >> $preffile
# Script session de Eric
cp $DIR/session.sh /home/$u
chmown $u:$u /home/$u/session.sh
sudo -u $u /home/$u/session.sh
rm /home/$u/session.sh
done
echo "Adding apt proxy"
......
#!/bin/bash
SCOPE1=cp
SCOPE2=ce1-ce2
SCOPE3=cm1-cm2
SCOPE41=profs-cp
SCOPE42=profs-ce1-ce2
SCOPE43=profs-cm1-cm2
SCOPE5=direction
while ! /bin/ping -c 2 ecole-dc; do sleep 10; done;
case "$USER" in
"01-mini")
gvfs-mount smb://ecole-dc/$SCOPE1
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE1/travail/ $HOME/Documents/ELEVES
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE1/donnees/ $HOME/Documents/PROFESSEURS
echo smb://ecole-dc/$SCOPE1/travail ELEVES > $HOME/.gtk-bookmarks
echo smb://ecole-dc/$SCOPE1/donnees PROFESSEURS >> $HOME/.gtk-bookmarks
;;
"02-super")
gvfs-mount smb://ecole-dc/$SCOPE2
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE2/travail/ $HOME/Documents/ELEVES
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE2/donnees/ $HOME/Documents/PROFESSEURS
echo smb://ecole-dc/$SCOPE2/travail ELEVES > $HOME/.gtk-bookmarks
echo smb://ecole-dc/$SCOPE2/donnees PROFESSEURS >> $HOME/.gtk-bookmarks
;;
"03-maxi")
gvfs-mount smb://ecole-dc/$SCOPE3
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE3/travail/ $HOME/Documents/ELEVES
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE3/donnees/ $HOME/Documents/PROFESSEURS
echo smb://ecole-dc/$SCOPE3/travail ELEVES > $HOME/.gtk-bookmarks
echo smb://ecole-dc/$SCOPE3/donnees PROFESSEURS >> $HOME/.gtk-bookmarks
;;
"prof")
gvfs-mount smb://ecole-dc/$SCOPE41
gvfs-mount smb://ecole-dc/$SCOPE42
gvfs-mount smb://ecole-dc/$SCOPE43
gvfs-mount smb://ecole-dc/perso
mkdir $HOME/Documents/01-$SCOPE1
mkdir $HOME/Documents/02-$SCOPE2
mkdir $HOME/Documents/03-$SCOPE3
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE41/classe/travail/ $HOME/Documents/01-$SCOPE1/ELEVES
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE41/classe/donnees/ $HOME/Documents/01-$SCOPE1/PROFESSEURS
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE42/classe/travail/ $HOME/Documents/02-$SCOPE2/ELEVES
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE42/classe/donnees/ $HOME/Documents/02-$SCOPE2/PROFESSEURS
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE43/classe/travail/ $HOME/Documents/03-$SCOPE3/ELEVES
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE43/classe/donnees/ $HOME/Documents/03-$SCOPE3/PROFESSEURS
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=perso $HOME/Documents/CONFIDENTIEL
echo smb://ecole-dc/$SCOPE41/classe/travail 01-CP ELEVES > $HOME/.gtk-bookmarks
echo smb://ecole-dc/$SCOPE41/classe/donnees 01-CP PROFESSEURS >> $HOME/.gtk-bookmarks
echo smb://ecole-dc/$SCOPE42/classe/travail 02-CE ELEVES >> $HOME/.gtk-bookmarks
echo smb://ecole-dc/$SCOPE42/classe/donnees 02-CE PROFESSEURS >> $HOME/.gtk-bookmarks
echo smb://ecole-dc/$SCOPE43/classe/travail 03-CM ELEVES >> $HOME/.gtk-bookmarks
echo smb://ecole-dc/$SCOPE43/classe/donnees 03-CM PROFESSEURS >> $HOME/.gtk-bookmarks
echo smb://ecole-dc/perso CONFIDENTIEL >> $HOME/.gtk-bookmarks
;;
"direction")
gvfs-mount smb://svc-prof@ecole-dc/$SCOPE41
gvfs-mount smb://svc-prof@ecole-dc/$SCOPE42
gvfs-mount smb://svc-prof@ecole-dc/$SCOPE43
gvfs-mount smb://svc-prof@ecole-dc/perso
gvfs-mount smb://svc-dir@ecole-dc/perso
mkdir $HOME/Documents/01-$SCOPE1
mkdir $HOME/Documents/02-$SCOPE2
mkdir $HOME/Documents/03-$SCOPE3
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE41,user=svc-prof/classe/travail $HOME/Documents/01-$SCOPE1/ELEVES
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE41,user=svc-prof/classe/donnees $HOME/Documents/01-$SCOPE1/PROFESSEURS
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE42,user=svc-prof/classe/travail $HOME/Documents/02-$SCOPE2/ELEVES
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE42,user=svc-prof/classe/donnees $HOME/Documents/02-$SCOPE2/PROFESSEURS
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE43,user=svc-prof/classe/travail $HOME/Documents/03-$SCOPE3/ELEVES
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=$SCOPE43,user=svc-prof/classe/donnees $HOME/Documents/03-$SCOPE3/PROFESSEURS
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=perso,user=svc-dir/ "$HOME/Documents/CONFIDENTIEL DIRECTION"
ln -s $XDG_RUNTIME_DIR/gvfs/smb-share:server=ecole-dc,share=perso,user=svc-prof/ "$HOME/Documents/CONFIDENTIEL PROFESSEURS"
echo smb://svc-prof@ecole-dc/$SCOPE41/classe/travail 01-CP ELEVES > $HOME/.gtk-bookmarks
echo smb://svc-prof@ecole-dc/$SCOPE41/classe/donnees 01-CP PROFESSEURS >> $HOME/.gtk-bookmarks
echo smb://svc-prof@ecole-dc/$SCOPE42/classe/travail 02-CE ELEVES >> $HOME/.gtk-bookmarks
echo smb://svc-prof@ecole-dc/$SCOPE42/classe/donnees 02-CE PROFESSEURS >> $HOME/.gtk-bookmarks
echo smb://svc-prof@ecole-dc/$SCOPE43/classe/travail 03-CM ELEVES >> $HOME/.gtk-bookmarks
echo smb://svc-prof@ecole-dc/$SCOPE43/classe/donnees 03-CM PROFESSEURS >> $HOME/.gtk-bookmarks
echo smb://svc-dir@ecole-dc/perso CONFIDENTIEL DIRECTION >> $HOME/.gtk-bookmarks
echo smb://svc-prof@ecole-dc/perso CONFIDENTIEL PROFESSEURS >> $HOME/.gtk-bookmarks
;;
esac
[Desktop Entry]
Name=X11VNC Server
Comment=Share this desktop by VNC
Exec=x11vnc -gui tray=setpass -rfbport PROMPT -bg -o %%HOME/.x11vnc.log.%%VNCDISPLAY
Icon=computer
Terminal=false
Type=Application
StartupNotify=false
#StartupWMClass=x11vnc_port_prompt
Categories=Network;RemoteAccess;
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