diff options
author | Simon Rettberg | 2013-07-02 18:29:20 +0200 |
---|---|---|
committer | Simon Rettberg | 2013-07-02 18:29:20 +0200 |
commit | 35b739e0eb419cd825e16c0c1193fe72f9b52842 (patch) | |
tree | f90c24a518e5ef97a94b5dc6a34115d27e214a28 /remote | |
parent | [kdm] Tweak theme (diff) | |
parent | Merge branch 'master' of git:openslx-ng/tm-scripts (diff) | |
download | tm-scripts-35b739e0eb419cd825e16c0c1193fe72f9b52842.tar.gz tm-scripts-35b739e0eb419cd825e16c0c1193fe72f9b52842.tar.xz tm-scripts-35b739e0eb419cd825e16c0c1193fe72f9b52842.zip |
Merge branch 'master' of dnbd3:openslx-ng/tm-scripts
Diffstat (limited to 'remote')
-rw-r--r-- | remote/modules/beamer/TODO | 2 | ||||
-rw-r--r-- | remote/modules/beamer/beamer.build | 17 | ||||
-rw-r--r-- | remote/modules/beamer/beamer.conf | 9 | ||||
-rwxr-xr-x | remote/modules/beamer/data/opt/openslx/bin/screenRecognizer.sh | 418 | ||||
-rw-r--r-- | remote/modules/pam/pam.conf.zypper | 4 | ||||
-rw-r--r-- | remote/modules/xorg/xorg.conf | 4 | ||||
l--------- | remote/targets/stage32/beamer | 1 |
7 files changed, 454 insertions, 1 deletions
diff --git a/remote/modules/beamer/TODO b/remote/modules/beamer/TODO new file mode 100644 index 00000000..651759eb --- /dev/null +++ b/remote/modules/beamer/TODO @@ -0,0 +1,2 @@ +Zenity durch eigen QT app ersetzen + diff --git a/remote/modules/beamer/beamer.build b/remote/modules/beamer/beamer.build new file mode 100644 index 00000000..bd189b66 --- /dev/null +++ b/remote/modules/beamer/beamer.build @@ -0,0 +1,17 @@ +fetch_source() { + : +} + +build() { + COPYLIST="list_dpkg_output" + [ -e "$COPYLIST" ] && rm "$COPYLIST" + + list_packet_files >> "$COPYLIST" + tarcopy "$(cat "$COPYLIST" | sort -u)" "${MODULE_BUILD_DIR}" + + return 0 +} + +post_copy() { + : +} diff --git a/remote/modules/beamer/beamer.conf b/remote/modules/beamer/beamer.conf new file mode 100644 index 00000000..270dbd1e --- /dev/null +++ b/remote/modules/beamer/beamer.conf @@ -0,0 +1,9 @@ +REQUIRED_INSTALLED_PACKAGES=" + zenity +" +REQUIRED_CONTENT_PACKAGES=" + zenity +" +REQUIRED_BINARIES=" + zenity +" diff --git a/remote/modules/beamer/data/opt/openslx/bin/screenRecognizer.sh b/remote/modules/beamer/data/opt/openslx/bin/screenRecognizer.sh new file mode 100755 index 00000000..feabe7ee --- /dev/null +++ b/remote/modules/beamer/data/opt/openslx/bin/screenRecognizer.sh @@ -0,0 +1,418 @@ +#! /bin/bash + +RES1610=(1920x1200 1680x1050 1440x900 1280x800 ) +RES169=(1920x1080 1600x900 1280x720 ) +RES54=(1280x1024 ) +RES43=(1280x960 1152x864 1024x768 ) +ALLRES=( ${RES1610[@]} ${RES169[@]} ${RES54[@]} ${RES43[@]} ) + +echo -e "\e[32mSupported resolutions\e[0m" +for i in ${ALLRES[@]} +do + echo -n "$i - " + echo "scale=2; $i" | tr "x" "/" | bc -l +done + +# Get initial data +XRANDR=$( xrandr ) +XRANDRV=$( xrandr --verbose ) + +# Get the connected outputs +declare -a OUTPUTNAMES +while read line; do + OUTPUTNAMES+=("$(echo "$line" | grep -o "^\S*" )") +done < <( echo "$XRANDR" | grep -i " connected" ) +echo -e "Connected outputs: \e[32m${OUTPUTNAMES[@]}\e[0m" + + +if [ ${#OUTPUTNAMES[@]} -eq 1 ]; then + + + # In case of one connected output + xrandr --auto + exit + + +elif [ ${#OUTPUTNAMES[@]} -eq 2 ]; then + + + # In case of two connected outputs + # If one of the two connected outputs is a beamer, based on the assumption + # that a beamer can not output a reasonable dimension. + if ! ( echo "$XRANDR" | egrep "^${OUTPUTNAMES[0]}.*[[:digit:]]{2,}mm x [[:digit:]]{2,}mm" > /dev/null \ + && echo "$XRANDR" | egrep "^${OUTPUTNAMES[1]}.*[[:digit:]]{2,}mm x [[:digit:]]{2,}mm" > /dev/null ); then + + + # If one scree is a beamer. First check which one is the BEAMER + if [[ -z "$(echo "$XRANDR" | egrep "^${OUTPUTNAMES[0]}.*[[:digit:]]{2,}mm x [[:digit:]]{2,}mm")" ]] + then BEAMER=0; else BEAMER=1; fi + echo -ne "${OUTPUTNAMES[$BEAMER]} is a beamer. " + + + # Get the supported modes of the outputs + # Get resolutions of output #0 + for RES in $( echo "$XRANDR" | grep -Pzo \ + "(?s)^${OUTPUTNAMES[0]} connected\N*\n(\t+\N*\n)*(\ +\N*\n)*" \ + | egrep -o "\ \ [[:digit:]]+x[[:digit:]]+" ); do + OUTPUT0+=("$RES"); + done + echo -e "\e[31mOUTPUT0:\e[0m" + for i in ${OUTPUT0[@]}; do echo "$i";done + + # Get resolutions of output #1 + for RES in $( echo "$XRANDR" | grep -Pzo \ + "(?s)^${OUTPUTNAMES[1]} connected\N*\n(\t+\N*\n)*(\ +\N*\n)*" \ + | egrep -o "\ \ [[:digit:]]+x[[:digit:]]+" ); do + OUTPUT1+=("$RES"); + done + echo -e "\e[31mOUTPUT1:\e[0m" + for i in ${OUTPUT1[@]}; do echo "$i";done + + + # Find out, if the beamer transmits reliable EDID data. The data in xrandr + # should be reliable if the EDID is present. + if echo "$XRANDRV" | grep -Pzo \ + "^${OUTPUTNAMES[$BEAMER]}\N*\n((\ |\t)+\N*\n)+" \ + | grep EDID > /dev/null ; then + + + echo "EDID present" + + # If the beamer transmits reliable EDID data, get the perfect match + # Presumed the preferred resolution is the native one, get both native + # resolutions + BEAMERPREF=$(echo "$XRANDRV" \ + | grep -Pzo "^${OUTPUTNAMES[$BEAMER]}\N*\n((\ |\t)+\N*\n)+" \ + | grep preferred | awk '{print $1}') + echo -e "\e[32mBEAMERPREF\e[0m=$BEAMERPREF" + MONITORPREF=$(echo "$XRANDRV" \ + | grep -Pzo "^${OUTPUTNAMES[$((1-$BEAMER))]}\N*\n((\ |\t)+\N*\n)+" \ + | grep preferred | awk '{print $1}') + echo -e "\e[32mMONITORPREF\e[0m=$MONITORPREF" + + # Compute the optimal resolution for presentations + # which is min( 1280, M.X, B.X ) + OPTIMALRESX=$(( ${MONITORPREF%x*} <= ${BEAMERPREF%x*} ? \ + ${MONITORPREF%x*} : ${BEAMERPREF%x*} )) + OPTIMALRESX=$(( $OPTIMALRESX <= 1280 ? $OPTIMALRESX : 1280 )) + AR=$(echo "$BEAMERPREF" | tr "x" "/" | bc -l) # "scale=2; 5/4" + OPTIMALRESY=$(echo "scale=0; $OPTIMALRESX / $(echo "$AR" | bc -l)" | bc -l) + OPTIMALRES="$OPTIMALRESX"x"$OPTIMALRESY" + echo -e "\e[32mOPTIMALRESX\e[0m=$OPTIMALRESX" + echo -e "\e[32mOPTIMALRESY\e[0m=$OPTIMALRESY" + echo -e "\e[32mOPTIMALRES\e[0m=$OPTIMALRES" + echo -e "\e[32mAR\e[0m=$AR" + + # Generate a list of common resolutions (Greedy fun) + for RES1 in ${OUTPUT0[@]}; do + for RES2 in ${OUTPUT1[@]}; do + if [ $RES1 = $RES2 ]; then + COMMONMATCHES+=("$RES1") + fi + done + done + echo -e "\e[31mCOMMONMATCHES:\e[0m" + for i in "${COMMONMATCHES[@]}" + do echo "$i - $( echo "scale=2; $i" | tr "x" "/" | bc -l)" + done + + # Compute the additional resolutions + for i in ${ALLRES[@]}; do + if (( $( echo "$i == $AR" | tr "x" "/" | bc -l ) )); then + if echo ${COMMONMATCHES[@]} | grep "$i" > /dev/null; then + if [ "$OPTIMALRES" = "$i" ]; then continue; fi + ADDITIONALRES+=("$i") + else + xrandr \ + --addmode ${OUTPUTNAMES[$((1-$BEAMER))]} "$i" \ + --addmode ${OUTPUTNAMES[$BEAMER]} "$i" \ + && ADDITIONALRES+=("$i") + fi + fi + done + echo -e "\e[31mADDITIONALRES:\e[0m" + for i in "${ADDITIONALRES[@]}" + do echo "$i - $( echo "scale=2; ${i% *}" | tr "x" "/" | bc -l)" + done + + # Apply the optimal resolution + xrandr \ + --addmode ${OUTPUTNAMES[$((1-$BEAMER))]} $OPTIMALRES \ + --addmode ${OUTPUTNAMES[$BEAMER]} $OPTIMALRES; + xrandr \ + --output ${OUTPUTNAMES[$((1-$BEAMER))]} --mode $OPTIMALRES \ + --primary \ + --output ${OUTPUTNAMES[$BEAMER]} --mode $OPTIMALRES \ + --same-as ${OUTPUTNAMES[$((1-$BEAMER))]} + + # Ask for a resolution + CHOSENRES=$( zenity --list \ + --title="Resolution Chooser" \ + --ok-label="Apply" \ + --cancel-label="Cancel" \ + --text "Choose a resolution\nor press cancel." \ + --width=300 --height=400 \ + --column="Resolution" "$OPTIMALRES (optimal)" "${ADDITIONALRES[@]}" \ + --print-column=1 \ + --hide-header ) || exit + echo "Chosen resolution $CHOSENRES" + + + + # Apply resolution + xrandr \ + --output ${OUTPUTNAMES[0]} --mode ${CHOSENRES%% *} \ + --output ${OUTPUTNAMES[1]} --mode ${CHOSENRES%% *} \ + --same-as ${OUTPUTNAMES[0]} + + + # If beamer DOES NOT transmit reliable EDID data + else + + echo "EDID is not present" + + # Compute the additional resolutions + for i in ${ALLRES[@]}; do + if ! xrandr \ + --addmode ${OUTPUTNAMES[$((1-$BEAMER))]} "$i" \ + --addmode ${OUTPUTNAMES[$BEAMER]} "$i"; then + if xrandr --newmode \ + "$i" $( cvt $(echo "$i" | tr "x" " " ) \ + | grep Modeline | cut -d " " -f3-); then + if ! xrandr --dryrun \ + --addmode ${OUTPUTNAMES[$((1-$BEAMER))]} "$i" \ + --addmode ${OUTPUTNAMES[$BEAMER]} "$i"; then + continue; + fi + else + continue + fi + fi + AR=$(echo "scale=2; $i" | tr "x" "/" | bc -l ) + case $AR in + "1.60") + ADDITIONALRES+=("$i (16:10)") + ;; + "1.77") + ADDITIONALRES+=("$i (16:9)") + ;; + "1.25") + ADDITIONALRES+=("$i (5:4)") + ;; + "1.33") + ADDITIONALRES+=("$i (4:3)") + ;; + *) + esac + done + echo -e "\e[31mADDITIONALRES:\e[0m" + for i in "${ADDITIONALRES[@]}" + do echo "$i - $( echo "scale=2; ${i% *}" | tr "x" "/" | bc -l)" + done + + TEXT="The connected beamer did not transmit reliable configuration\n" \ + TEXT+="data. To avoid clipping or streching, it is recommended to\n" \ + TEXT+="choose a resolution equal to the aspect ratio of the native\n" \ + TEXT+="resolution of the beamer." \ + + # Ask for a resolution + CHOSENRES=$( zenity --list \ + --title="Resolution Chooser" \ + --ok-label="Apply" \ + --cancel-label="Cancel" \ + --text "$TEXT" \ + --width=300 --height=400 \ + --column="Resolution" "${ADDITIONALRES[@]}" \ + --print-column=1 \ + --hide-header ) || exit + echo "Chosen resolution ${CHOSENRES%% *}" + + # Apply resolution + xrandr \ + --addmode ${OUTPUTNAMES[0]} ${CHOSENRES%% *} \ + --addmode ${OUTPUTNAMES[1]} ${CHOSENRES%% *}; + xrandr \ + --output ${OUTPUTNAMES[$((1-$BEAMER))]} --mode ${CHOSENRES%% *} \ + --primary \ + --output ${OUTPUTNAMES[$BEAMER]} --mode ${CHOSENRES%% *} \ + --same-as ${OUTPUTNAMES[$((1-$BEAMER))]} + + fi + else + + + # If neiter of the outputs is a beamer (likely dualscreen + # setup) just apply preferred settings + echo "no beamer" + xrandr \ + --output ${OUTPUTNAMES[0]} --preferred \ + --output ${OUTPUTNAMES[1]} --preferred \ + --right-of ${OUTPUTNAMES[0]} + + + fi + +else + # If there are more than 3 outputs + # its up to the user. Quit. + exit; +fi + + + + # OLD APPROACH + # Find out, if the beamer transmits reliable EDID data. + # For the first assumption the beamer transmits reliable data, if in + # Xorg.log '*EDID for output $BEAMER*' is succeded by '*Manufacturer*' + # and '*Year*'. + # BEAMERELIABILITY=1 + # while read line + # do + # if echo $line | grep "EDID for output ${OUTPUTNAMES[$BEAMER]}" > /dev/null + # then + # read line + # if echo $line | grep "Manufacturer" > /dev/null + # then + # BEAMERELIABILITY=0 + # break + # fi + # fi + # done < "/var/log/Xorg.0.log" + + + + + + +# # if one of the outputs is a beamer, offer a choice +# declare -a OUTPUT1 +# declare -a OUTPUT2 +# + +# # Make sure the desired resolutions are existent +# # FULLHD +# #for in +# +# +# ####################################DEBUG################################### +# echo ${NATIVEMATCHES[@]} +# echo -e "\e[31m--------------------------------\e[0m" +# ############################################################################ +# +# # Add some experimental standard resolutions, which the outputs should be +# # able to display via interpolation. +# declare -a EXPERIMENTALMATCHES=("1920x1080 (16:9)" "1366x768 (16:9)" "1280x960 (4:3)" "1280x720 (16:9)") +# +# ## Form an interactive dialog to suit the users preferred resolution +# #zenity --question \ +# # --timeout=10 \ +# # --text="Do you want to change the resolution?" \ +# # --ok-label "Yes" \ +# # --cancel-label "No" +# +#OfferChoice() +#{ +# false; while [ "$?" != 0 ] #bash do{...}while(...) imitation +# do +# +# +# CHOSENRES=$( zenity --list \ +# --title="Resolution Chooser" \ +# --ok-label="Apply" \ +# --cancel-label="Cancel" \ +# --text "Choose a resolution\nor press cancel." \ +# --width=300 --height=400 \ +# --column="Resolution" 1920x1080 1366x768 1280x720 1024x768 \ +# --print-column=1 \ +# --hide-header ) +# +# ####################################DEBUG################################# +# echo "Chosen resolution $CHOSENRES" +# echo -e "\e[31m--------------------------------\e[0m" +# ########################################################################## +# +# if [ $? != 0 ] +# then +# break +# fi +# +# xrandr \ +# --output ${OUTPUTNAMES[0]} --mode ${CHOSENRES%% *} \ +# --output ${OUTPUTNAMES[1]} --mode ${CHOSENRES%% *} \ +# --same-as ${OUTPUTNAMES[0]} +# +# # in case the mode is unknown +# if [ $? != 0 ] +# then +# xrandr \ +# --addmode ${OUTPUTNAMES[0]} ${CHOSENRES%% *} \ +# --addmode ${OUTPUTNAMES[1]} ${CHOSENRES%% *} +# xrandr \ +# --output ${OUTPUTNAMES[0]} --mode ${CHOSENRES%% *} --primary \ +# --output ${OUTPUTNAMES[1]} --mode ${CHOSENRES%% *} --same-as ${OUTPUTNAMES[0]} +# +# #CVT="$(cvt $(echo ${CHOSENRES%% *} | cut -d " " -f1 | tr "x" " ") | grep Modeline)" +# #MODENAME=echo $CVT | cut -d " " -f2) +# #MODELINE=echo $CVT | cut -d " " -f3-) +# fi +# +# zenity --question \ +# --text="Do you want to stay with this resolution?" \ +# --ok-label "Yes" \ +# --cancel-label "No" +# +# # In case of timeout +# #if [ $? -eq 5]; then ;fi +# +# done +#} +# # If the beamer fits in the monitor, teach the monitor the preferred +# # mode of the beamer +# xrandr --addmode ${OUTPUTNAMES[$((1-$BEAMER))]} $BEAMERPREF +# xrandr --output ${OUTPUTNAMES[$((1-$BEAMER))]} \ +# --mode $BEAMERPREF \ +# --primary \ +# --output ${OUTPUTNAMES[$BEAMER]} \ +# --mode $BEAMERPREF \ +# --same-as ${OUTPUTNAMES[$((1-$BEAMER))]} +# echo -e "\e[32mPERFECTMATCH\e[0m=$BEAMERPREF" +# +# # If the monitor fits in the beamer, teach the beamer the preferred +# # mode of the monitor +# xrandr --addmode ${OUTPUTNAMES[$BEAMER]} $MONITORPREF +# xrandr --output ${OUTPUTNAMES[$((1-$BEAMER))]} \ +# --mode $MONITORPREF \ +# --primary \ +# --output ${OUTPUTNAMES[$BEAMER]} \ +# --mode $MONITORPREF \ +# --same-as ${OUTPUTNAMES[$((1-$BEAMER))]} +# +# +# +# +# +# Offer a mode selection +# 1920x1080, 1366x768, 1280x800 and 1024x800 have to be available. +# Check if the TFT supports the resolution +# if echo "$XRANDRV" \ +# | grep -Pzo "^${OUTPUTNAMES[$((1-$BEAMER))]}\N*\n((\ |\t)+\N*\n)+" \ +# | grep $MODE > /dev/null +# then +# +# # If so, just assign the beamers preferred resolution to the TFT +# xrandr \ +# --output ${OUTPUTNAMES[0]} --mode $MODE \ +# --output ${OUTPUTNAMES[1]} --mode $MODE \ +# --same-as ${OUTPUTNAMES[0]} +# else +# +# # If not, teach the TFT the mode +# xrandr \ +# --addmode ${OUTPUTNAMES[$((1-$BEAMER))]} $MODE +# --output ${OUTPUTNAMES[0]} --mode $MODE \ +# --output ${OUTPUTNAMES[1]} --mode $MODE \ +# --same-as ${OUTPUTNAMES[0]} +# fi +# +# #OfferChoice +# #echo "Offered choice" diff --git a/remote/modules/pam/pam.conf.zypper b/remote/modules/pam/pam.conf.zypper index 75ad3c2e..f54c5a0f 100644 --- a/remote/modules/pam/pam.conf.zypper +++ b/remote/modules/pam/pam.conf.zypper @@ -8,6 +8,7 @@ REQUIRED_INSTALLED_PACKAGES=" libopenssl-devel openldap2-client nfsidmap + nfs-client glibc " REQUIRED_CONTENT_PACKAGES=" @@ -20,12 +21,15 @@ REQUIRED_CONTENT_PACKAGES=" nss-mdns openldap2-client nfsidmap + nfs-client glibc " REQUIRED_BINARIES=" sslconnect ldapsearch mkhomedir_helper + rpc.gssd + rpc.idmapd " REQUIRED_LIBRARIES=" nsswitch diff --git a/remote/modules/xorg/xorg.conf b/remote/modules/xorg/xorg.conf index 74d162e7..b1589b80 100644 --- a/remote/modules/xorg/xorg.conf +++ b/remote/modules/xorg/xorg.conf @@ -4,6 +4,7 @@ REQUIRED_CONTENT_PACKAGES=" xserver-xorg libgl1-mesa-glx xkb-data x11-xkb-utils + x11-xserver-utils xserver-xorg-input-evdev xserver-xorg-input-mouse xserver-xorg-input-vmmouse @@ -40,7 +41,8 @@ REQUIRED_BINARIES=" Xorg xkbwatch xkbbell xkbevd - vmmouse_detect" + vmmouse_detect + xrandr" REQUIRED_DIRECTORIES=" /usr/lib /usr/share/X11 diff --git a/remote/targets/stage32/beamer b/remote/targets/stage32/beamer new file mode 120000 index 00000000..0fbeaeca --- /dev/null +++ b/remote/targets/stage32/beamer @@ -0,0 +1 @@ +../../modules/beamer/
\ No newline at end of file |