diff options
author | Manuel Schneider | 2014-10-16 16:38:14 +0200 |
---|---|---|
committer | Manuel Schneider | 2014-10-16 16:38:14 +0200 |
commit | e678ca21c35b883640a16165a1001d96407c08f5 (patch) | |
tree | ceb9053131baa6a3cfbfdc0a102483a6275ba7c4 | |
parent | [cups] Update ppds for XRX7545 ("Papierstau im Tray") (diff) | |
parent | [cups] Another library package for Ubuntu 12.04 (libgs9-common) (diff) | |
download | tm-scripts-e678ca21c35b883640a16165a1001d96407c08f5.tar.gz tm-scripts-e678ca21c35b883640a16165a1001d96407c08f5.tar.xz tm-scripts-e678ca21c35b883640a16165a1001d96407c08f5.zip |
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
10 files changed, 285 insertions, 42 deletions
diff --git a/remote/modules/alsa/module.conf.ubuntu.12 b/remote/modules/alsa/module.conf.ubuntu.12 new file mode 100644 index 00000000..2eb57b3d --- /dev/null +++ b/remote/modules/alsa/module.conf.ubuntu.12 @@ -0,0 +1,6 @@ +REQUIRED_CONTENT_PACKAGES=" + alsa-utils + alsa-base + libasound2 + libasound2-plugins +" diff --git a/remote/modules/cups/module.conf.ubuntu.12 b/remote/modules/cups/module.conf.ubuntu.12 new file mode 100644 index 00000000..e858e04c --- /dev/null +++ b/remote/modules/cups/module.conf.ubuntu.12 @@ -0,0 +1,16 @@ +REQUIRED_INSTALLED_PACKAGES=" + ghostscript + cups + ghostscript-cups + cups-filters + foomatic-filters + libgs9-common +" +REQUIRED_CONTENT_PACKAGES=" + ghostscript + cups + ghostscript-cups + cups-filters + foomatic-filters + libgs9-common +" diff --git a/remote/modules/pam-common-share/data/opt/openslx/scripts/pam_script_mount_common_share b/remote/modules/pam-common-share/data/opt/openslx/scripts/pam_script_mount_common_share new file mode 100644 index 00000000..5ffb1205 --- /dev/null +++ b/remote/modules/pam-common-share/data/opt/openslx/scripts/pam_script_mount_common_share @@ -0,0 +1,82 @@ +################################################################### +# +# This script is a part of the pam_script_auth script +# and is not stand-alone! +# +# It will try to mount the common share as specified in the +# variables SLX_COMMON_SHARE_PATH and SLX_COMMON_SHARE_AUTH of +# the global slx config '/opt/openslx/config'. Supported AUTH +# are 'guest' and 'user'. First is self-explanatory, second +# will use the user's credentials to authorize the mount. +# +# Example: +# SLX_COMMON_SHARE_PATH='//windows.server/sharename' +# SLX_COMMON_SHARE_AUTH='user' +# +# + +mount_common_share() { + # at this point we need the slx config to do anything + [ -e "/opt/openslx/config" ] || \ + { slxlog "pam-share-noconfig" "File '/opt/openslx/config' not found."; return; } + + # we have it as we should, source it + . /opt/openslx/config || \ + { slxlog "pam-share-sourceconfig" "Could not source '/opt/openslx/config'."; return; } + + # lets check if we have our variables + [ "x${SLX_COMMON_SHARE_PATH}" != "x" ] || \ + { slxlog "pam-share-noconfig" "No variable 'SLX_COMMON_SHARE_PATH' found in config!"; return; } + [ "x${SLX_COMMON_SHARE_AUTH}" != "x" ] || \ + { slxlog "pam-share-noconfig" "No variable 'SLX_COMMON_SHARE_AUTH' found in config!"; return; } + + # all good: now we can mount depending on the type + # supports: cifs?/nfs? + if [ "${SLX_COMMON_SHARE_PATH:0:2}" = "//" ]; then + # '//' prefixed, assume windows share + # prepare common mount options for either authentication type + MOUNT_OPTS="-t cifs -o nounix,uid=${USER_UID},gid=${USER_GID},forceuid,forcegid,nobrl,noacl" + + # flag for failure + SIGNAL=$(mktemp) + rm -f -- "${SIGNAL}" + # output of command + MOUNT_OUTPUT=$(mktemp) + # now see if the share needs credentials + if [ "${SLX_COMMON_SHARE_AUTH}" = "guest" ]; then + MOUNT_OPTS="${MOUNT_OPTS},guest,file_mode=0777,dir_mode=0777" + elif [ "${SLX_COMMON_SHARE_AUTH}" = "user" ]; then + export USER="{PAM_USER}" + export PASSWD="{PAM_AUTHTOK}" + MOUNT_OPTS="${MOUNT_OPTS},sec=ntlm,file_mode=0700,dir_mode=0700" + else + slxlog "pam-share-auth" "Auth type '${SLX_COMMON_SHARE_AUTH}' not supported." + return; + fi + + # now try to mount it + ( mount ${MOUNT_OPTS} "${SLX_COMMON_SHARE_PATH}" "${COMMON_SHARE_MOUNT_POINT}" > "${MOUNT_OUTPUT}" 2>&1 || touch "${SIGNAL}" ) & + MOUNT_PID=$! + for COUNTER in 1 1 2 4; do + kill -0 "${MOUNT_PID}" 2>/dev/null || break + sleep "${COUNTER}" + done + + # check for failures + if [ -e "${SIGNAL}" ]; then + slxlog "pam-share-mount" "Mount of '${SLX_COMMON_SHARE_PATH}' to '${COMMON_SHARE_MOUNT_POINT}' failed. (Args: ${MOUNT_OPTS}" "${MOUNT_OUTPUT}" + rm -f -- "${SIGNAL}" + elif kill -9 "${MOUNT_PID}" 2>/dev/null; then + slxlog "pam-share-mount" "Mount of '${SLX_COMMON_SHARE_PATH}' to '${COMMON_SHARE_MOUNT_POINT}' timed out. (Args: ${MOUNT_OPTS}" "${MOUNT_OUTPUT}" + fi + ( sleep 2; rm -f -- "${MOUNT_OUTPUT}" ) & + + # always unset credentials + unset USER + unset PASSWD + fi + + # TODO support more than CIFS? NFS maybe? +} + +mount_common_share diff --git a/remote/modules/pam-common-share/module.build b/remote/modules/pam-common-share/module.build new file mode 100644 index 00000000..62d96224 --- /dev/null +++ b/remote/modules/pam-common-share/module.build @@ -0,0 +1,11 @@ +fetch_source() { + : +} + +build() { + pinfo "Static module, nothing to build." +} + +post_copy() { + : +} diff --git a/remote/modules/pam-common-share/module.conf b/remote/modules/pam-common-share/module.conf new file mode 100644 index 00000000..0cd03752 --- /dev/null +++ b/remote/modules/pam-common-share/module.conf @@ -0,0 +1,3 @@ +REQUIRED_BINARIES="" +REQUIRED_LIBRARIES="" +REQUIRED_DIRECTORIES="" diff --git a/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth b/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth index 48efcf6f..e7de3a8c 100755 --- a/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth +++ b/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth @@ -8,14 +8,8 @@ USER_UID=$(echo "$PASSWD" | awk -F ':' '{print $3}') USER_GID=$(echo "$PASSWD" | awk -F ':' '{print $4}') USER_HOME=$(echo "$PASSWD" | awk -F ':' '{print $6}') -# Script to be sourced to mount the user's persistent home -PERSISTENT_MOUNT_SCRIPT="/opt/openslx/scripts/pam_script_mount_persistent" -# Script to be run in the user's context iff the persistent home could be mounted successfully -PERSISTENT_MOUNT_USER_SCRIPT="/opt/openslx/scripts/pam_script_mount_persistent_user" # The user's non-persistent home directory mount point, which should be their linux home TEMP_HOME_DIR="$USER_HOME" -# The user's persistent home directory mount point -PERSISTENT_HOME_DIR="${TEMP_HOME_DIR}/PERSISTENT" # check if the script runs as root [ "x$(whoami)" != "xroot" ] && exit 0 @@ -44,6 +38,18 @@ Your real home is under /home/<user>/PERSISTENT. Please save your files there. EOF +############################################################################### +# +# Preparations for /home/<user>/PERSISTENT +# +# +# Script to be sourced to mount the user's persistent home +PERSISTENT_MOUNT_SCRIPT="/opt/openslx/scripts/pam_script_mount_persistent" +# Script to be run in the user's context iff the persistent home could be mounted successfully +PERSISTENT_MOUNT_USER_SCRIPT="/opt/openslx/scripts/pam_script_mount_persistent_user" +# The user's persistent home directory mount point +PERSISTENT_HOME_DIR="${TEMP_HOME_DIR}/PERSISTENT" + # create the PERSISTENT directory mkdir -p "${PERSISTENT_HOME_DIR}" || \ { slxlog "pam-global-mkpersistent" "Could not create '${PERSISTENT_HOME_DIR}'."; exit 1; } @@ -57,12 +63,40 @@ fi [ ! -e "${PERSISTENT_MOUNT_SCRIPT}" ] && exit 0 # yes . "${PERSISTENT_MOUNT_SCRIPT}" || \ - { slxlog "pam-global-sourcepersistent" "Could not source ${PERSISTENT_MOUNT_SCRIPT}."; exit 1; } + { slxlog "pam-global-sourcepersistent" "Could not source '${PERSISTENT_MOUNT_SCRIPT}'."; exit 1; } # Just try to delete the persistent dir. If the mount was successful, it will not work # If it was not successful, it will be removed so the user doesn't think he can store # anything in there rmdir "$PERSISTENT_HOME_DIR" 2> /dev/null +############################################################################### +# +# Preparations for /home/<user>/SHARE +# +# +# Script to be sourced to mount the common share folder +COMMON_SHARE_MOUNT_SCRIPT="/opt/openslx/scripts/pam_script_mount_common_share" +# User specific mount point for the common share +COMMON_SHARE_MOUNT_POINT="${TEMP_HOME_DIR}/SHARE" + +# create the SHARE directory +mkdir -p "${COMMON_SHARE_MOUNT_POINT}" || \ + { slxlog "pam-global-mkshare" "Could not create '${COMMON_SHARE_MOUNT_POINT}'."; exit 1; } + +# chown the new dir +chown "${PAM_USER}:${USER_GID}" "${COMMON_SHARE_MOUNT_POINT}" || \ + { slxlog "pam-global-chshare" "Could not chown '${COMMON_SHARE_MOUNT_POINT}' to '${PAM_USER}'."; exit 1; } + +# check for common share mount script, exit if we don't have one +[ ! -e "${COMMON_SHARE_MOUNT_SCRIPT}" ] && exit 0 + +# we do! +. "${COMMON_SHARE_MOUNT_SCRIPT}" || \ + { slxlog "pam-global-sourceshare" "Could not source '${COMMON_SHARE_MOUNT_SCRIPT}'."; exit 1; } + +# Just try to delete the common share dir. If the mount was successful, it will not work +rmdir "${COMMON_SHARE_MOUNT_POINT}" 2> /dev/null + exit 0 diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt index 231ef6fe..759b8352 100755 --- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt +++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt @@ -419,9 +419,13 @@ remotedesktopport="590${VM_ID}" # Enable 3D enable3d=$(grep -i -o "<enable3d param=.*" "${xmlfile}" | awk -F '"' '{print $2}' | rv_clean_string) -# Add rw share -sharepath="${HOME}/PERSISTENT" -sharename="home" +# Add rw share for home dir +homesharepath="${HOME}/PERSISTENT" +homesharename="home" + +# Add common share +commonsharepath="${HOME}/SHARE" +commonsharename="share" # Set hostname: using original hostname and adding string hostname="virt-$(hostname)" @@ -435,19 +439,57 @@ writelog "\tVM Hostname:\t\t$hostname" if lspci -n | grep -E -i '8086:1e20( |$)'; then VOL="100%" # bwPC 4: Speaker too quiet :-( else - VOL="80%" + VOL="85%" fi -# Adjust sound volume -amixer -q sset Master "$VOL" unmute 2>/dev/null -amixer -q sset PCM "$VOL" unmute 2>/dev/null -amixer -q sset CD "$VOL" unmute 2>/dev/null -amixer -q sset Headphone "$VOL" unmute 2>/dev/null -amixer -q sset Front "$VOL" unmute 2>/dev/null -amixer -q sset Speaker "$VOL" unmute 2>/dev/null # annoying built-in speaker -amixer -q sset 'Front Mic' "$VOL" unmute 2>/dev/null # to be checked if Mic is actually activated -amixer -q sset 'Rear Mic' "$VOL" unmute 2>/dev/null # =""= -amixer -q sset 'Capture' "$VOL" cap unmute 2>/dev/null # to be checked if Mic is actually activated -amixer -q -c pcsp sset Master "0%" mute 2>/dev/null # fix random static noise when starting vmplayer when module snd_pcsp (not pcspkr) is loaded +if true; then + # detecting which card is to be used + echo "Detecting which sound card to use ..." + PROC="/proc/asound/cards" + if [ ! -r "$PROC" ]; then + echo "'${PROC}' not found or not readable." + SOUND_CARD_INDEX=0 + else + # Try to filter HDMI cards first + SOUND_CARD_INDEX=$(grep -v -i 'HDMI' "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1) + # If empty, try again with all + [ -z "${SOUND_CARD_INDEX}" ] && SOUND_CARD_INDEX=$(cat "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1) + + if [ -z "${SOUND_CARD_INDEX}" ]; then + echo "No sound card found." + SOUND_CARD_INDEX=0 + fi + fi + + SOUND_CARD_INDEX="$(grep -E -o '[0-9]+' <<<$SOUND_CARD_INDEX)" + echo "Detected sound card index is: $SOUND_CARD_INDEX" + + # Adjust sound volume (playback)... Random mixer names we have encountered during testing + echo "Setting up volume..." + amixer -q -c "$SOUND_CARD_INDEX" sset 'Master' "$VOL" unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'PCM' "$VOL" unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'CD' "$VOL" unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Headphone' "$VOL" unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Front' "$VOL" unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Speaker' "$VOL" unmute + # Recording. It seems that (most) devices need the volume set to 0, so you + # don't hear your own mic input, but should be unmuted. Also on some cards, + # you need to set the cap option on the mic you want to use, while other cards + # will just ignore that option. + # Plus, most cards have a Capture mixer, which needs to be set to cap too, and + # have its volume turned up. (There'll probably be some cards that need yet + # another setup, but this works for now on 4 tested cards) + amixer -q -c "$SOUND_CARD_INDEX" sset 'Rear Mic Boost' "50%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Rear Mic' "0%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Front Mic Boost' "50%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Front Mic' "0%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Mic Boost' "50%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Mic' "0%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Capture' "100%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Input Source' 'Front Mic' # Let's hope nobody uses rear mic... + # fix random static noise when starting vmplayer when module snd_pcsp (not pcspkr) is loaded + amixer -q -c pcsp sset Master "0%" mute + echo "Done setting up volume." +fi >> "${LOGFILE}" 2>&1 # Start printer daemon QUEUE="STANDARD" # This has to match the queue you configured in your VM diff --git a/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt b/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt index 231ef6fe..759b8352 100755 --- a/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt +++ b/remote/modules/vmchooser2/data/opt/openslx/scripts/vmchooser-run_virt @@ -419,9 +419,13 @@ remotedesktopport="590${VM_ID}" # Enable 3D enable3d=$(grep -i -o "<enable3d param=.*" "${xmlfile}" | awk -F '"' '{print $2}' | rv_clean_string) -# Add rw share -sharepath="${HOME}/PERSISTENT" -sharename="home" +# Add rw share for home dir +homesharepath="${HOME}/PERSISTENT" +homesharename="home" + +# Add common share +commonsharepath="${HOME}/SHARE" +commonsharename="share" # Set hostname: using original hostname and adding string hostname="virt-$(hostname)" @@ -435,19 +439,57 @@ writelog "\tVM Hostname:\t\t$hostname" if lspci -n | grep -E -i '8086:1e20( |$)'; then VOL="100%" # bwPC 4: Speaker too quiet :-( else - VOL="80%" + VOL="85%" fi -# Adjust sound volume -amixer -q sset Master "$VOL" unmute 2>/dev/null -amixer -q sset PCM "$VOL" unmute 2>/dev/null -amixer -q sset CD "$VOL" unmute 2>/dev/null -amixer -q sset Headphone "$VOL" unmute 2>/dev/null -amixer -q sset Front "$VOL" unmute 2>/dev/null -amixer -q sset Speaker "$VOL" unmute 2>/dev/null # annoying built-in speaker -amixer -q sset 'Front Mic' "$VOL" unmute 2>/dev/null # to be checked if Mic is actually activated -amixer -q sset 'Rear Mic' "$VOL" unmute 2>/dev/null # =""= -amixer -q sset 'Capture' "$VOL" cap unmute 2>/dev/null # to be checked if Mic is actually activated -amixer -q -c pcsp sset Master "0%" mute 2>/dev/null # fix random static noise when starting vmplayer when module snd_pcsp (not pcspkr) is loaded +if true; then + # detecting which card is to be used + echo "Detecting which sound card to use ..." + PROC="/proc/asound/cards" + if [ ! -r "$PROC" ]; then + echo "'${PROC}' not found or not readable." + SOUND_CARD_INDEX=0 + else + # Try to filter HDMI cards first + SOUND_CARD_INDEX=$(grep -v -i 'HDMI' "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1) + # If empty, try again with all + [ -z "${SOUND_CARD_INDEX}" ] && SOUND_CARD_INDEX=$(cat "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1) + + if [ -z "${SOUND_CARD_INDEX}" ]; then + echo "No sound card found." + SOUND_CARD_INDEX=0 + fi + fi + + SOUND_CARD_INDEX="$(grep -E -o '[0-9]+' <<<$SOUND_CARD_INDEX)" + echo "Detected sound card index is: $SOUND_CARD_INDEX" + + # Adjust sound volume (playback)... Random mixer names we have encountered during testing + echo "Setting up volume..." + amixer -q -c "$SOUND_CARD_INDEX" sset 'Master' "$VOL" unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'PCM' "$VOL" unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'CD' "$VOL" unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Headphone' "$VOL" unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Front' "$VOL" unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Speaker' "$VOL" unmute + # Recording. It seems that (most) devices need the volume set to 0, so you + # don't hear your own mic input, but should be unmuted. Also on some cards, + # you need to set the cap option on the mic you want to use, while other cards + # will just ignore that option. + # Plus, most cards have a Capture mixer, which needs to be set to cap too, and + # have its volume turned up. (There'll probably be some cards that need yet + # another setup, but this works for now on 4 tested cards) + amixer -q -c "$SOUND_CARD_INDEX" sset 'Rear Mic Boost' "50%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Rear Mic' "0%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Front Mic Boost' "50%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Front Mic' "0%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Mic Boost' "50%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Mic' "0%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Capture' "100%" cap unmute + amixer -q -c "$SOUND_CARD_INDEX" sset 'Input Source' 'Front Mic' # Let's hope nobody uses rear mic... + # fix random static noise when starting vmplayer when module snd_pcsp (not pcspkr) is loaded + amixer -q -c pcsp sset Master "0%" mute + echo "Done setting up volume." +fi >> "${LOGFILE}" 2>&1 # Start printer daemon QUEUE="STANDARD" # This has to match the queue you configured in your VM diff --git a/remote/modules/vmchooser2/data/opt/openslx/vmchooser/data/openslx.exe b/remote/modules/vmchooser2/data/opt/openslx/vmchooser/data/openslx.exe Binary files differindex 8b320003..31666278 100755 --- a/remote/modules/vmchooser2/data/opt/openslx/vmchooser/data/openslx.exe +++ b/remote/modules/vmchooser2/data/opt/openslx/vmchooser/data/openslx.exe diff --git a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include index ef54218e..016ebdc6 100644 --- a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include +++ b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include @@ -266,8 +266,8 @@ runvmwareconfheader () # sound sound.present = "TRUE" - sound.fileName = "-1" - sound.autodetect = "TRUE" + sound.fileName = "sysdefault:CARD=$SOUND_CARD_INDEX" + sound.autodetect = "FALSE" sound.virtualdev = "$sound" pciSound.enableVolumeControl = "FALSE" sound.enableVolumeControl = "FALSE" @@ -291,11 +291,18 @@ runvmwareconfheader () sharedFolder0.present = "$shfolders" sharedFolder0.enabled = "$shfolders" sharedFolder0.expiration = "never" - sharedFolder0.guestName = "$sharename" - sharedFolder0.hostPath = "$sharepath" + sharedFolder0.guestName = "$homesharename" + sharedFolder0.hostPath = "$homesharepath" sharedFolder0.readAccess = "TRUE" sharedFolder0.writeAccess = "TRUE" - sharedFolder.maxNum = "1" + sharedFolder1.present = "$shfolders" + sharedFolder1.enabled = "$shfolders" + sharedFolder1.expiration = "never" + sharedFolder1.guestName = "$commonsharename" + sharedFolder1.hostPath = "$commonsharepath" + sharedFolder1.readAccess = "TRUE" + sharedFolder1.writeAccess = "TRUE" + sharedFolder.maxNum = "2" # dirs/configs tmpDirectory = "$redodir" |