Mounthome is no longer required
This commit is contained in:
parent
0f4e455717
commit
89fa704ea2
3 changed files with 1 additions and 74 deletions
|
@ -1,3 +0,0 @@
|
|||
%examusers ALL=(root) NOPASSWD: /usr/local/bin/mounthome.sh
|
||||
%role-student ALL=(root) NOPASSWD: /usr/local/bin/mounthome.sh
|
||||
%role-teacher ALL=(root) NOPASSWD: /usr/local/bin/mounthome.sh
|
|
@ -1,66 +0,0 @@
|
|||
#!/usr/bin/bash
|
||||
set -eu
|
||||
|
||||
home="$(getent passwd "$SUDO_UID" | cut -d : -f 6 | sed 's|/srv/samba/schools/default-school/||')"
|
||||
|
||||
exit_script() {
|
||||
echo "unmounting media - terminated by trap!" >> "/tmp/${SUDO_UID}-exit-mount.log"
|
||||
findmnt "/lmn/media/${SUDO_USER}/oldhome" && umount "/lmn/media/${SUDO_USER}/oldhome" && rmdir "/lmn/media/${SUDO_USER}/oldhome"
|
||||
findmnt "/lmn/media/${SUDO_USER}/oldprojects" && umount "/lmn/media/${SUDO_USER}/oldprojects" && rmdir "/lmn/media/${SUDO_USER}/oldprojects"
|
||||
findmnt "/lmn/media/${SUDO_USER}/linuxhome" && umount "/lmn/media/${SUDO_USER}/linuxhome" && rmdir "/lmn/media/${SUDO_USER}/linuxhome"
|
||||
trap - SIGHUP SIGINT SIGTERM # clear the trap
|
||||
kill -- -$$ # Sends SIGTERM to child/sub processes
|
||||
}
|
||||
|
||||
exit_script_home() {
|
||||
echo "unmounting media - terminated by trap!" >> "/tmp/${SUDO_UID}-exit-mount.log"
|
||||
umount "/lmn/media/${SUDO_USER}/home"
|
||||
trap - SIGHUP SIGINT SIGTERM # clear the trap
|
||||
kill -- -$$ # Sends SIGTERM to child/sub processes
|
||||
}
|
||||
|
||||
##########################
|
||||
|
||||
if [[ "$#" -gt 0 ]] && [[ "$1" = '-u' ]]; then
|
||||
findmnt "/lmn/media/${SUDO_USER}/home" && umount "/lmn/media/${SUDO_USER}/home" && rmdir "/lmn/media/${SUDO_USER}/home"
|
||||
#findmnt "/lmn/media/${SUDO_USER}/share" && umount "/lmn/media/${SUDO_USER}/share" && rmdir "/lmn/media/${SUDO_USER}/share"
|
||||
findmnt "/lmn/media/${SUDO_USER}/oldhome" && umount "/lmn/media/${SUDO_USER}/oldhome" && rmdir "/lmn/media/${SUDO_USER}/oldhome"
|
||||
findmnt "/lmn/media/${SUDO_USER}/oldprojects" && umount "/lmn/media/${SUDO_USER}/oldprojects" && rmdir "/lmn/media/${SUDO_USER}/oldprojects"
|
||||
findmnt "/lmn/media/${SUDO_USER}/linuxhome" && umount "/lmn/media/${SUDO_USER}/linuxhome" && rmdir "/lmn/media/${SUDO_USER}/linuxhome"
|
||||
elif [ "$#" -gt 0 ] && [ "$1" = '-o' ]; then
|
||||
echo "Einbinden der Daten des alten/bisherigen Systems (PaedML Novell)."
|
||||
echo "Bitte den Username und Passwort aus dem ALTEN System eingeben."
|
||||
read -rp "Username: " username
|
||||
read -srp "Passwort: " PASSWD
|
||||
export PASSWD
|
||||
echo
|
||||
mkdir -p "/lmn/media/${SUDO_USER}/oldhome"
|
||||
mkdir -p "/lmn/media/${SUDO_USER}/oldprojects"
|
||||
#errcode=$(mount -t cifs -o "username=${username},uid=${SUDO_UID},gid=${SUDO_GID},file_mode=0700,dir_mode=0700,forceuid,forcegid" \
|
||||
# "//192.168.1.2/DOCS/fvs" "/lmn/media/${SUDO_USER}/oldhome")
|
||||
#if [[ ! "${errcode}" ]]; then
|
||||
mount -t cifs -o "username=${username},uid=${SUDO_UID},gid=${SUDO_GID},file_mode=0700,dir_mode=0700,forceuid,forcegid,nobrl,mfsymlinks" \
|
||||
"//192.168.1.2/DOCS/fvs" "/lmn/media/${SUDO_USER}/oldhome"
|
||||
mount -t cifs -o "username=${username},uid=${SUDO_UID},gid=${SUDO_GID},file_mode=0700,dir_mode=0700,forceuid,forcegid,nobrl,mfsymlinks" \
|
||||
"//192.168.1.2/DATA/fvs/projekte" "/lmn/media/${SUDO_USER}/oldprojects"
|
||||
#echo "Mounting successfull!"
|
||||
echo "Einbindung erfolgreich!"
|
||||
echo "Dieses Fenster bitte nicht schließen!"
|
||||
#echo "Um weiter zu arbeiten: <Strg> + <Z>"
|
||||
trap exit_script SIGHUP SIGINT SIGTERM
|
||||
sleep infinity
|
||||
elif [ "$#" -gt 0 ] && [ "$1" = '-l' ]; then
|
||||
echo "Einbinden des Netboot-Home-Verzeichnises. Daten des alten/bisherigen Systems (PaedML Novell)."
|
||||
echo "Bitte den Username und Passwort aus dem ALTEN System (PaedML Novell) eingeben."
|
||||
echo "Bitte auch Groß- und Kleinschreibung achten."
|
||||
read -rp "Username: " username
|
||||
mkdir -p "/lmn/media/${SUDO_USER}/linuxhome"
|
||||
mount -t fuse -o "allow_other,uid=${SUDO_UID},gid=${SUDO_GID},reconnect" \
|
||||
"sshfs#${username}@home.steinbeisschule-reutlingen.de:" "/lmn/media/${SUDO_USER}/linuxhome"
|
||||
#echo "Mounting successfull!"
|
||||
echo "Einbindung erfolgreich!"
|
||||
echo "Dieses Fenster bitte nicht schließen!"
|
||||
#echo "Um weiter zu arbeiten: <Strg> + <Z>"
|
||||
trap exit_script SIGHUP SIGINT SIGTERM
|
||||
sleep infinity
|
||||
fi
|
|
@ -128,14 +128,11 @@
|
|||
|
||||
- name: Deploy sudo configurations
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
src: lmn-vm
|
||||
dest: "/etc/sudoers.d/90-{{ item }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0700'
|
||||
loop:
|
||||
- lmn-mounthome
|
||||
- lmn-vm
|
||||
|
||||
- name: Deploy vmimages scripts
|
||||
ansible.builtin.copy:
|
||||
|
@ -145,7 +142,6 @@
|
|||
group: root
|
||||
mode: '0755'
|
||||
loop:
|
||||
- mounthome.sh
|
||||
- vm-create
|
||||
- vm-rebase
|
||||
- vm-run
|
||||
|
|
Loading…
Add table
Reference in a new issue