diff options
5 files changed, 45 insertions, 9 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc index d6ddfbd0..9dd30845 100755 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc @@ -34,6 +34,8 @@ MOUNTCIFSPRAE="-v -t cifs -o " MOUNTCIFSOPTS="uid=$(id --user "$LOCALUSER"),gid=$(id --group "$LOCALUSER"),forceuid,forcegid,file_mode=0700,dir_mode=0700,nobrl,noacl" MOUNTNFSPRAE="-v -t nfs4 -o " MOUNTNFSOPTS="rw,nosuid,nodev,nolock,intr,hard,sloppy" +MOUNTDAVPRAE="-t davfs -o " +MOUNTDAVOPTS="uid=$(id --user "$LOCALUSER"),gid=$(id --group "$LOCALUSER")" NATADDR=$(head -n 1 "$CONFIGFILE" | cut -f 1 -d$'\t') PORT=$(head -n 1 "$CONFIGFILE" | cut -f 2 -d$'\t') diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/10_functions.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/10_functions.inc index e080d278..23ef0246 100755 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/10_functions.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/10_functions.inc @@ -69,6 +69,19 @@ function mounter() done [ "$AUSGANG" -eq 0 ] && logger "openslx sharemapper: ${SHAREPATH} mounted to ${MOUNTDIR} (cifs $VERSION)." ;; + dav) AUSGANG=0 + x=2 + while ! echo -e "${USER}\n${PASSWD}" | mount $MOUNTPARAM "$MOUNTOPTS" "$SHAREPATH" "$MOUNTDIR" 2>/dev/null 1>&2; do + logger "openslx sharemapper: could not mount ${SHAREPATH} to ${MOUNTDIR}, waited another $x seconds, retrying." + sleep x + if [ "$x" -gt 4 ]; then + AUSGANG=1 + logger "openslx sharemapper: timeout, could not mount ${SHAREPATH} to ${MOUNTDIR}. mount.davfs installed?" + break + fi + let x=x+2 + done + ;; *) logger "openslx sharemapper: unknown mounter ${MOUNTER}!" ;; esac diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/30_mount_shares.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/30_mount_shares.inc index c5d37105..c6bdc8c9 100755 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/30_mount_shares.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/30_mount_shares.inc @@ -9,7 +9,12 @@ function mount_shares() SHAREPASS=$(echo "${ROHSHARES[CONFIGROW]}" | cut -f 5 -d$'\t') # User-PW, bei Userhome nicht vorhanden # Sharetyp bestimmen: - if [ "${SHAREPATH:0:2}" == '\\' ] || [ "${SHAREPATH:0:2}" == '//' ]; then + if [ "${SHAREPATH:0:4}" == 'http' ]; then + SHAREPATH="${SHAREPATH//\\//}" # shouldn't be needed, but who knows what windows users do... + MOUNTER=dav + MOUNTPARAM="$MOUNTDAVPRAE" + MOUNTOPTS="$MOUNTDAVOPTS" + elif [ "${SHAREPATH:0:2}" == '\\' ] || [ "${SHAREPATH:0:2}" == '//' ]; then USER=$(echo "$SHAREUSER"|cut -d '\' -f 2) SHAREPATH="${SHAREPATH//\\//}" # '\' --> `/` :-) MOUNTER=cifs diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/50_umounter.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/50_umounter.inc index e161b961..a4c080d2 100755 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/50_umounter.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/50_umounter.inc @@ -1,12 +1,22 @@ umount_home() { - umount /home/"${LOCALUSER}"/PERSISTENT && logger "openslx unmounter: umounted home (PERSISTENT)." \ - || logger "openslx unmounter: could not home (PERSISTENT)!" + umount "${USERHOMEDIR}" && logger "openslx umounter: umounted home (${USERHOMEDIR})." \ + || logger "openslx umounter: could not home(${USERHOMEDIR})!" } umount_shares() { - index=0 - for SHARE in $( mount | grep SHARE | tr -s ' ' | cut -f 3 -d " " ); do - umount "${SHARE}" && logger "openslx unmounter: umounted ${SHARE}." \ - || logger "openslx unmounter: could not umount ${SHARE}!" + get_shares # fills array ROHSHARES; row 0 global infos from (shares-)CONFIGFILE, + + for (( CONFIGROW = 2; CONFIGROW < ${#ROHSHARES[@]}; CONFIGROW++ )); do # row 1 always home, so forget... + SHAREPATH=$(echo "${ROHSHARES[CONFIGROW]}" | cut -f 1 -d$'\t') # Could be a webdav share... + SHARENAME=$(echo "${ROHSHARES[CONFIGROW]}" | cut -f 3 -d$'\t' | sed 's/ /_/g') + [ -z "${SHARENAME}" ] && SHARENAME=$(echo "${ROHSHARES[CONFIGROW]}" | cut -f 2 -d$'\t' | sed 's/://g') # yields SHARELETTER + + if [ "${SHAREPATH:0:4}" == 'http' ]; then + fusermount -u "${USERHOME}/${SHARENAME}" && logger "openslx umounter: umounted ${SHARENAME}. (webdav)" \ + || logger "openslx umounter: could not umount ${SHARENAME}! (webdav)" + else + umount "${USERHOME}/${SHARENAME}" && logger "openslx umounter: umounted ${SHARE}." \ + || logger "openslx umounter: could not umount ${SHARE}!" + fi done } diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/vm_installer b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/vm_installer index 91f5b6d2..7bf44730 100755 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/vm_installer +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/vm_installer @@ -75,7 +75,6 @@ case $(${PS} --pid 1 -o comm h) in [Unit] Description=openSLX umount utility Before=shutdown.target - Requires=${SERVICEDISKMOUNT} DefaultDependencies=no [Service] @@ -88,9 +87,16 @@ case $(${PS} --pid 1 -o comm h) in [ ! -d "$SERVICEDIR"/"${TARGET}".wants ] && mkdir "$SERVICEDIR"/"${TARGET}".wants 2>/dev/null [ ! -d "$SERVICEDIR"/shutdown.target.wants ] && mkdir "$SERVICEDIR"/shutdown.target.wants 2>/dev/null - + # some distr. eg. Suse seem to want these: + # [ ! -d "$SERVICEDIR"/reboot.target.wants ] && mkdir "$SERVICEDIR"/reboot.target.wants 2>/dev/null + # [ ! -d "$SERVICEDIR"/halt.target.wants ] && mkdir "$SERVICEDIR"/halt.target.wants 2>/dev/null + ln -s "${SERVICEDIR}"/"${SERVICEUTIL}" "$SERVICEDIR"/"${TARGET}".wants/"${SERVICEUTIL}" ln -s "${SERVICEDIR}"/"${SERVICEUMOUNT}" "$SERVICEDIR"/shutdown.target.wants/"${SERVICEUMOUNT}" + # ln -s "${SERVICEDIR}"/"${SERVICEUMOUNT}" "$SERVICEDIR"/reboot.target.wants/"${SERVICEUMOUNT}" + # ln -s "${SERVICEDIR}"/"${SERVICEUMOUNT}" "$SERVICEDIR"/halt.target.wants/"${SERVICEUMOUNT}" + + echo "openslx praeinstaller: doing systemd reload." systemctl daemon-reload |