diff options
| author | Michael Neves | 2013-07-08 17:02:37 +0200 |
|---|---|---|
| committer | Michael Neves | 2013-07-08 17:02:37 +0200 |
| commit | 12d3c2d4bc1a66eb33566fb32b0f25603836eea8 (patch) | |
| tree | 0179ffbd9e85dcd3954afa1720b1a699f33c4f31 /remote | |
| parent | [vmchooser] remove unneeded icon for xterm (diff) | |
| parent | [debug] remove xset from REQUIRED_INSTALLED_PACKAGES as its wrong for ubuntu (diff) | |
| download | tm-scripts-12d3c2d4bc1a66eb33566fb32b0f25603836eea8.tar.gz tm-scripts-12d3c2d4bc1a66eb33566fb32b0f25603836eea8.tar.xz tm-scripts-12d3c2d4bc1a66eb33566fb32b0f25603836eea8.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote')
47 files changed, 1148 insertions, 116 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/debug/debug.conf b/remote/modules/debug/debug.conf index a2db5dc0..7cf1934a 100644 --- a/remote/modules/debug/debug.conf +++ b/remote/modules/debug/debug.conf @@ -1,5 +1,9 @@ REQUIRED_INSTALLED_PACKAGES=" curl + ltrace + nano + fontconfig + fonts-config " REQUIRED_BINARIES=" strace @@ -8,4 +12,8 @@ REQUIRED_BINARIES=" setterm curl nano + fc-cache + fc-query + xset + locale " diff --git a/remote/modules/debug/debug.conf.zypper b/remote/modules/debug/debug.conf.zypper new file mode 100644 index 00000000..8728c4bf --- /dev/null +++ b/remote/modules/debug/debug.conf.zypper @@ -0,0 +1,21 @@ +REQUIRED_INSTALLED_PACKAGES=" + curl + ltrace + nano + fontconfig + fonts-config + xset +" +REQUIRED_BINARIES=" + strace + ltrace + ldd + setterm + curl + nano + fc-cache + fc-query + fonts-config + xset + locale +" diff --git a/remote/modules/german/german.build b/remote/modules/german/german.build index aa64e0ad..f7f19a84 100644 --- a/remote/modules/german/german.build +++ b/remote/modules/german/german.build @@ -26,6 +26,8 @@ build() { } post_copy() { - add_env LANG de_DE.utf-8 || perror "add_env function failed." + for i in LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION; do + add_env $i de_DE.UTF-8 || perror "$i: add_env function failed." + done } diff --git a/remote/modules/german/german.conf b/remote/modules/german/german.conf index ec22c760..3bbaecca 100644 --- a/remote/modules/german/german.conf +++ b/remote/modules/german/german.conf @@ -1,7 +1,12 @@ -REQUIRED_CONTENT_PACKAGES="" +REQUIRED_INSTALLED_PACKAGES=" + libX11-data + language-pack-de" +REQUIRED_CONTENT_PACKAGES=" + libX11-data" +REQUIRED_LIBRARIES="libX11-data" REQUIRED_BINARIES="" REQUIRED_FILES="" REQUIRED_DIRECTORIES=" - /usr/lib/locale/de_DE.utf8 + /usr/lib/locale/de_DE.utf8 + /usr/share/X11 " - diff --git a/remote/modules/kdm/data/usr/share/desktop/themes/kdm/bwlehrpool/theme.xml b/remote/modules/kdm/data/usr/share/desktop/themes/kdm/bwlehrpool/theme.xml index 62277113..5de73ea6 100644 --- a/remote/modules/kdm/data/usr/share/desktop/themes/kdm/bwlehrpool/theme.xml +++ b/remote/modules/kdm/data/usr/share/desktop/themes/kdm/bwlehrpool/theme.xml @@ -15,12 +15,12 @@ KDM-OpenSLX-Theme <normal color="#000000" alpha="0.0"/> <pos anchor="n" x="50%" y="0" width="100%" height="45%"/> <box orientation="vertical" homogeneous="true"> - <item type="pixmap" background="true"> + <item type="pixmap"> <normal file="top-bar.png"/> <pos anchor="n" x="50%" y="0" width="80%" height="50"/> <box orientation="horizontal" homogeneous="true"> <!-- Welcome on ... --> - <item type="label" background="true"> + <item type="label"> <pos anchor="w" x="12%" y="11"/> <normal color="#f0f0f0" font="Sans 11"/> <stock type="welcome-label"/> diff --git a/remote/modules/kdm/data/usr/share/desktop/themes/kdm/bwlehrpool/top-bar.png b/remote/modules/kdm/data/usr/share/desktop/themes/kdm/bwlehrpool/top-bar.png Binary files differindex fb63c5cc..0c89dbef 100644 --- a/remote/modules/kdm/data/usr/share/desktop/themes/kdm/bwlehrpool/top-bar.png +++ b/remote/modules/kdm/data/usr/share/desktop/themes/kdm/bwlehrpool/top-bar.png diff --git a/remote/modules/kernel/kernel.build b/remote/modules/kernel/kernel.build index 59bc8e99..99ee36a2 100644 --- a/remote/modules/kernel/kernel.build +++ b/remote/modules/kernel/kernel.build @@ -3,7 +3,7 @@ fetch_source() { if [ "x$PACKET_MANAGER" == "xapt" ]; then pdebug "apt-ing kernel source" apt-get install -y dpkg-dev || perror "Installing dpkg-dev failed." - apt-get source linux-image-${KERNEL_VERSION} || perror "Fetching kernel source failed." + apt-get source linux-image-${KERNEL_CURRENT_VERSION} || perror "Fetching kernel source failed." [ -z "$(ls -d linux-*/)" ] && perror "Source directory not found." [ ! -e ksrc ] && ln -s "$(ls -d linux-*/)" "ksrc" elif [ "x$PACKET_MANAGER" == "xzypper" ]; then @@ -29,6 +29,10 @@ fetch_source() { # fix pc speaker ./patch-speaker + + # remember the current kernel version + echo "${KERNEL_CURRENT_VERSION}" > ksrc/KVERSION + } build() { @@ -47,7 +51,7 @@ build() { else make oldconfig || perror "make oldconfig failed" fi - pinfo "Kompaliere kernel... (this will take some time)" + pinfo "Compiling kernel... (this will take some time)" if gcc --version | grep "4\.7" && which distcc; then pinfo "USING DISTCC" make CC="distcc gcc-4.7" -j16 || perror "make failed" @@ -116,8 +120,8 @@ patch_aufs() { git clone "git://aufs.git.sourceforge.net/gitroot/aufs/aufs3-standalone.git" || perror "Cloning aufs3 failed." fi # get the needed version - [ ! -z ${KERNEL_VERSION} ] && local NEEDED_BRANCH=$(echo $KERNEL_VERSION | awk -F "." '{print $1"."$2}') \ - || perror "KERNEL_VERSION not set, this should not happen!" + [ ! -z ${KERNEL_CURRENT_VERSION} ] && local NEEDED_BRANCH=$(echo $KERNEL_CURRENT_VERSION | awk -F "." '{print $1"."$2}') \ + || perror "KERNEL_CURRENT_VERSION not set, this should not happen!" pinfo "Getting branch origin/$NEEDED_BRANCH" cd "$MODULE_DIR/aufs3-standalone" || perror "Could not CD to aufs3-standalone" git checkout "origin/aufs$NEEDED_BRANCH" diff --git a/remote/modules/nscd/data/etc/nscd.conf b/remote/modules/nscd/data/etc/nscd.conf new file mode 100644 index 00000000..863a6f50 --- /dev/null +++ b/remote/modules/nscd/data/etc/nscd.conf @@ -0,0 +1,90 @@ +# +# /etc/nscd.conf +# +# An example Name Service Cache config file. This file is needed by nscd. +# +# Legal entries are: +# +# logfile <file> +# debug-level <level> +# threads <initial #threads to use> +# max-threads <maximum #threads to use> +# server-user <user to run server as instead of root> +# server-user is ignored if nscd is started with -S parameters +# stat-user <user who is allowed to request statistics> +# reload-count unlimited|<number> +# paranoia <yes|no> +# restart-interval <time in seconds> +# +# enable-cache <service> <yes|no> +# positive-time-to-live <service> <time in seconds> +# negative-time-to-live <service> <time in seconds> +# suggested-size <service> <prime number> +# check-files <service> <yes|no> +# persistent <service> <yes|no> +# shared <service> <yes|no> +# max-db-size <service> <number bytes> +# auto-propagate <service> <yes|no> +# +# Currently supported cache names (services): passwd, group, hosts, services +# + + +# logfile /var/log/nscd.log +# threads 4 +# max-threads 32 +# server-user nobody +# stat-user somebody + debug-level 0 +# reload-count 5 + paranoia no +# restart-interval 3600 + + enable-cache passwd yes + positive-time-to-live passwd 600 + negative-time-to-live passwd 20 + suggested-size passwd 211 + check-files passwd yes + persistent passwd yes + shared passwd yes + max-db-size passwd 33554432 + auto-propagate passwd yes + + enable-cache group yes + positive-time-to-live group 3600 + negative-time-to-live group 60 + suggested-size group 211 + check-files group yes + persistent group yes + shared group yes + max-db-size group 33554432 + auto-propagate group yes + + enable-cache hosts yes + positive-time-to-live hosts 1800 + negative-time-to-live hosts 20 + suggested-size hosts 211 + check-files hosts yes + persistent hosts yes + shared hosts yes + max-db-size hosts 33554432 + + enable-cache services yes + positive-time-to-live services 28800 + negative-time-to-live services 20 + suggested-size services 211 + check-files services yes + persistent services yes + shared services yes + max-db-size services 33554432 + +# netgroup caching is known-broken, so disable it in the default config, +# see: https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1068889 + enable-cache netgroup no + positive-time-to-live netgroup 28800 + negative-time-to-live netgroup 20 + suggested-size netgroup 211 + check-files netgroup yes + persistent netgroup yes + shared netgroup yes + max-db-size netgroup 33554432 diff --git a/remote/modules/nscd/data/etc/systemd/system/basic.target.wants/nscd.service b/remote/modules/nscd/data/etc/systemd/system/basic.target.wants/nscd.service new file mode 120000 index 00000000..70066631 --- /dev/null +++ b/remote/modules/nscd/data/etc/systemd/system/basic.target.wants/nscd.service @@ -0,0 +1 @@ +../nscd.service
\ No newline at end of file diff --git a/remote/modules/nscd/data/etc/systemd/system/nscd.service b/remote/modules/nscd/data/etc/systemd/system/nscd.service new file mode 100644 index 00000000..46b7d2e7 --- /dev/null +++ b/remote/modules/nscd/data/etc/systemd/system/nscd.service @@ -0,0 +1,14 @@ +[Unit] +Description=Name Service Cache Daemon +DefaultDependencies=no +After=sysinit.target +Before=shutdown.target + +[Service] +ExecStart=/usr/sbin/nscd -d +ExecStop=/usr/sbin/nscd --shutdown +Restart=always + +[Install] +WantedBy=basic.target +Also=nscd.socket diff --git a/remote/modules/nscd/data/etc/tmpfiles.d/nscd.conf b/remote/modules/nscd/data/etc/tmpfiles.d/nscd.conf new file mode 100644 index 00000000..57c16660 --- /dev/null +++ b/remote/modules/nscd/data/etc/tmpfiles.d/nscd.conf @@ -0,0 +1 @@ +D /var/run/nscd 0755 root root diff --git a/remote/modules/nscd/nscd.build b/remote/modules/nscd/nscd.build new file mode 100644 index 00000000..bd189b66 --- /dev/null +++ b/remote/modules/nscd/nscd.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/nscd/nscd.conf b/remote/modules/nscd/nscd.conf new file mode 100644 index 00000000..3f25aea9 --- /dev/null +++ b/remote/modules/nscd/nscd.conf @@ -0,0 +1,9 @@ +REQUIRED_INSTALLED_PACKAGES=" + nscd +" +REQUIRED_CONTENT_PACKAGES=" + nscd +" +REQUIRED_BINARIES=" + nscd +" diff --git a/remote/modules/openbox/openbox.conf.zypper b/remote/modules/openbox/openbox.conf.zypper index 63e5e25d..1d0b68c5 100644 --- a/remote/modules/openbox/openbox.conf.zypper +++ b/remote/modules/openbox/openbox.conf.zypper @@ -2,4 +2,10 @@ REQUIRED_INSTALLED_PACKAGES=" openbox libpango-1_0-0" REQUIRED_CONTENT_PACKAGES=" openbox libpango-1_0-0" +REQUIRED_BINARIES=" openbox + openbox-session" +REQUIRED_FILES=" /usr/share/xsessions/openbox.desktop" +REQUIRED_DIRECTORIES=" /etc + /usr/$LIB64 + /usr/share/themes/Clearlooks" diff --git a/remote/modules/pam/data/etc/ldap.conf b/remote/modules/pam/data/etc/ldap.conf index 43b1640e..483595d2 100644 --- a/remote/modules/pam/data/etc/ldap.conf +++ b/remote/modules/pam/data/etc/ldap.conf @@ -1,5 +1,8 @@ URI ldaps://bv1.ruf.uni-freiburg.de ldaps://bv2.ruf.uni-freiburg.de ldaps://bv3.ruf.uni-freiburg.de BASE ou=people,dc=uni-freiburg,dc=de +BIND_TIMELIMIT 5 +TIMELIMIT 10 +LOGDIR /tmp/ldap TLS_REQCERT allow nss_base_passwd ou=people,dc=uni-freiburg,dc=de?one?rufdienst=ldap*)(&(rufclienthome=*)(rufstatus=enabled) nss_base_group ou=group,dc=uni-freiburg,dc=de?one diff --git a/remote/modules/pam/data/etc/pam.d/common-session b/remote/modules/pam/data/etc/pam.d/common-session index 9210dfbb..6182d470 100644 --- a/remote/modules/pam/data/etc/pam.d/common-session +++ b/remote/modules/pam/data/etc/pam.d/common-session @@ -13,23 +13,25 @@ # pam-auth-update(8) for details. # here are the per-package modules (the "Primary" block) -session [default=1] pam_permit.so +session [default=1] pam_permit.so # here's the fallback if no module succeeds -session requisite pam_deny.so +session requisite pam_deny.so # prime the stack with a positive return value if there isn't one already; # this avoids us returning an error just because nothing sets a success code # since the modules above will each just jump around -session required pam_permit.so +session required pam_permit.so # The pam_umask module will set the umask according to the system default in # /etc/login.defs and user settings, solving the problem of different # umask settings with different shells, display managers, remote sessions etc. # See "man pam_umask". -session optional pam_umask.so +session optional pam_umask.so # and here are more per-package modules (the "Additional" block) -session required pam_systemd.so -session optional pam_krb5.so minimum_uid=1000 -session [success=1] pam_unix.so -session [success=ok] pam_ldap.so -session sufficient pam_script.so -session optional pam_mkhomedir.so skel=/etc/skel umask=0022 +session required pam_systemd.so +session optional pam_env.so readenv=1 +session optional pam_env.so readenv=1 envfile=/etc/default/locale +session optional pam_krb5.so minimum_uid=1000 +session [success=1] pam_unix.so +session [success=ok] pam_ldap.so +session sufficient pam_script.so +session optional pam_mkhomedir.so skel=/etc/skel umask=0022 # end of pam-auth-update config diff --git a/remote/modules/pam/data/etc/pam.d/kdm b/remote/modules/pam/data/etc/pam.d/kdm index 11b5f1fc..e6a4ec9b 100644 --- a/remote/modules/pam/data/etc/pam.d/kdm +++ b/remote/modules/pam/data/etc/pam.d/kdm @@ -4,8 +4,7 @@ auth required pam_nologin.so auth required pam_env.so readenv=1 auth required pam_env.so readenv=1 envfile=/etc/default/locale -auth include common-auth -session required pam_limits.so -account include common-account -password include common-password -session include common-session +auth include common-auth +account include common-account +password include common-password +session include common-session diff --git a/remote/modules/pam/data/etc/pam.d/kdm-np b/remote/modules/pam/data/etc/pam.d/kdm-np index 8c1a2a81..dc10e5b5 100644 --- a/remote/modules/pam/data/etc/pam.d/kdm-np +++ b/remote/modules/pam/data/etc/pam.d/kdm-np @@ -5,7 +5,7 @@ auth required pam_nologin.so auth required pam_env.so readenv=1 auth required pam_env.so readenv=1 envfile=/etc/default/locale session required pam_limits.so -account include common-account -password include common-password -session include common-session +account include common-account +password include common-password +session include common-session auth required pam_permit.so diff --git a/remote/modules/pam/data/etc/pam.d/login b/remote/modules/pam/data/etc/pam.d/login index 561c71df..1065f351 100644 --- a/remote/modules/pam/data/etc/pam.d/login +++ b/remote/modules/pam/data/etc/pam.d/login @@ -40,7 +40,8 @@ auth requisite pam_nologin.so # that a module could execute code in the wrong domain. # When the module is present, "required" would be sufficient (When SELinux # is disabled, this returns success.) -session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close +# OpenSLX: Not Needed? +#session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close # This module parses environment configuration file(s) # and also allows you to use an extended config diff --git a/remote/modules/pam/data/etc/systemd/system/activate-nss-ldap.service b/remote/modules/pam/data/etc/systemd/system/activate-nss-ldap.service index a09b78ae..bbac775a 100644 --- a/remote/modules/pam/data/etc/systemd/system/activate-nss-ldap.service +++ b/remote/modules/pam/data/etc/systemd/system/activate-nss-ldap.service @@ -1,6 +1,10 @@ [Unit] Description=Activate NSS-LDAP lookups +Before=graphical.target [Service] -Type=simple -ExecStart=/opt/openslx/bin/sed -i -e 's/^passwd.*/passwd:\t\tfiles ldap/g;s/^group.*/group:\t\tfiles ldap/g' /etc/nsswitch.conf +Type=oneshot +ExecStart=-/opt/openslx/bin/mkdir /tmp/ldap +ExecStart=/opt/openslx/bin/sed -i -e 's/^passwd:.*$/passwd:\t\tcache files ldap/;s/^group:.*$/group:\t\tcache files ldap/;s/^hosts:.*files/hosts:\t\tcache files/' /etc/nsswitch.conf +ExecStart=/usr/bin/systemctl restart nscd + diff --git a/remote/modules/pam/data/etc/systemd/system/rpc-gssd.service b/remote/modules/pam/data/etc/systemd/system/rpc-gssd.service index 6623428d..79ffce8d 100644 --- a/remote/modules/pam/data/etc/systemd/system/rpc-gssd.service +++ b/remote/modules/pam/data/etc/systemd/system/rpc-gssd.service @@ -4,4 +4,4 @@ Requires=run-rpc_pipefs.mount After=run-rpc_pipefs.mount [Service] -ExecStart=/usr/sbin/rpc.gssd -f -vvv +ExecStart=/usr/sbin/rpc.gssd -f -vvv -p /run/rpc_pipefs diff --git a/remote/modules/pam/pam.build b/remote/modules/pam/pam.build index d3c0dd88..4cdba400 100644 --- a/remote/modules/pam/pam.build +++ b/remote/modules/pam/pam.build @@ -1,13 +1,20 @@ fetch_source() { - : + # get pam-script source + download_untar "$REQUIRED_PAM_SCRIPT_URL" "src/" } build() { mkdir -p "$MODULE_BUILD_DIR/opt/openslx/bin" gcc -o "$MODULE_BUILD_DIR/opt/openslx/bin/sslconnect" "$MODULE_DIR/sslconnect.c" -lssl -lcrypto -O3 || perror "Could not compile sslconnect.c" local COPYLIST="$MODULE_BUILD_DIR/list_packet_files" - list_packet_files | sort -u > "$COPYLIST" + # TODO: Hack for SUSE: Ignore file (/var/lib/nfs/state) that does not exist :( + list_packet_files | grep -v '/var/lib/nfs/state' | sort -u > "$COPYLIST" tarcopy "$(cat "$COPYLIST")" "${MODULE_BUILD_DIR}" + + # build pam-script separatly since we use a source tarball + cd "${MODULE_DIR}/src/pam-script-${REQUIRED_PAM_SCRIPT_VERSION}" || perror "Could not cd to ${MODULE_DIR}/src/pam-script-${REQUIRED_PAM_SCRIPT_VERSION}." + ./configure --prefix=/ --sysconfdir=/etc/pam-script --libdir=/lib/security|| perror "pam-script: ./configure failed." + make DESTDIR="${MODULE_BUILD_DIR}" install || perror "pam-script: make install to ${MODULE_BUILD_DIR} failed." } post_copy() { diff --git a/remote/modules/pam/pam.conf b/remote/modules/pam/pam.conf index a3399190..140bca9e 100644 --- a/remote/modules/pam/pam.conf +++ b/remote/modules/pam/pam.conf @@ -1,7 +1,6 @@ REQUIRED_INSTALLED_PACKAGES=" libpam-ldap libnss-ldap - libpam-script krb5-user krb5-config libpam-krb5 @@ -9,13 +8,13 @@ REQUIRED_INSTALLED_PACKAGES=" ldap-utils libnfsidmap2 nfs-common + libpam0g-dev " REQUIRED_CONTENT_PACKAGES=" libpam0g libpam-modules libpam-ck-connector libpam-cap - libpam-script libldap-2.4-2 libpam-ldap libnss-ldap @@ -37,6 +36,7 @@ REQUIRED_LIBRARIES=" static umich_ldap libnfsidmap + pam_script " REQUIRED_DIRECTORIES=" /lib @@ -52,3 +52,5 @@ REQUIRED_SYSTEM_FILES=" /lib/security /lib/${ARCH_TRIPLET}/security " +REQUIRED_PAM_SCRIPT_VERSION="1.1.6" +REQUIRED_PAM_SCRIPT_URL="http://downloads.sourceforge.net/project/pam-script/pam-script-${REQUIRED_PAM_SCRIPT_VERSION}.tar.gz" diff --git a/remote/modules/pam/pam.conf.zypper b/remote/modules/pam/pam.conf.zypper index 403cd59f..9319e78c 100644 --- a/remote/modules/pam/pam.conf.zypper +++ b/remote/modules/pam/pam.conf.zypper @@ -1,29 +1,36 @@ REQUIRED_INSTALLED_PACKAGES=" pam_ldap pam + pam_krb5 pam-devel nss_ldap pam-modules libopenssl-devel openldap2-client nfsidmap + nfs-client glibc + pam-devel " REQUIRED_CONTENT_PACKAGES=" pam_ldap pam + pam_krb5 pam-devel nss_ldap pam-modules 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/vmchooser/data/opt/openslx/bin/clc.bash b/remote/modules/vmchooser/data/opt/openslx/bin/clc.bash new file mode 100755 index 00000000..f5c989f4 --- /dev/null +++ b/remote/modules/vmchooser/data/opt/openslx/bin/clc.bash @@ -0,0 +1,306 @@ +#!/bin/bash + +# region header + +# Copyright Torben Sickert 16.12.2012 + +# License +# This library written by Torben Sickert stand under a creative commons +# naming 3.0 unported license. +# see http://creativecommons.org/licenses/by/3.0/deed.de + +# vim: set tabstop=4 shiftwidth=4 expandtab: +# vim: foldmethod=marker foldmarker=region,endregion: + +# Dependencies: + +# vmware or virtualbox + +# Notes: + +# USE "sudo bin/vmware-vmx --new-sn JJ237-G52E2-08X0C-C3306-0WCQ1" +# To activate wmware workstation! + +# Abbreviation for "createLinkedClone". +__NAME__='clc' + +# endregion + +# Provides the main module scope. +function clc() { + +# region configuration + + # region private properties + + # region command line arguments + + local _VERBOSE='no' + local _SUPPORTED_HYPERVISOR=('VMware' 'virtualBox') + # NOTE: This value will be determined automatically. If no hypervisor + # could be detected this value will be used as default. + # The first value from supported Machines is taken as default. + local _HYPERVISOR="$_SUPPORTED_HYPERVISOR" + local _PERSISTENT_SHORT_DESCRIPTION_SUFFIX=' --persistent--' + + # endregion + + local _STANDARD_OUTPUT=/dev/null + local _ERROR_OUTPUT=/dev/null + local _BASIC_IMAGE_CONFIGURATION_FILE_PATH='' + local _TARGET_PATH='' + local _CREATE_PERSISTENT_CONFIG='no' + + # endregion + +# endregion + +# region functions + + # region command line interface + + # Prints a description about how to use this program. + function clcPrintUsageMessage() { + cat << EOF + $__NAME__ Generates a linked clone from given machine description file in + given target location. +EOF + return $? + } + + # Prints a description about how to use this program by providing examples. + function clcPrintUsageExamples() { + cat << EOF + # Getting a help message. + >>> $0 --help + + # Creating a linked clone. + >>> $0 /path/to/config.xml ~/.persistentLinkedClones/ + + # Creating a linked clone in verbose mode. + >>> $0 /path/to/config.xml ~/.persistentLinkedClones/ --verbose + + # Creating a linked clone in verbose mode with debugging output. + >>> $0 /path/to/config.xml ~/.persistentLinkedClones/ --verbose --debug + + # Creating a linked clone in verbose mode with debugging output. + >>> $0 /path/to/config.xml ~/.persistentLinkedClones/ -v -d +EOF + return $? + } + + # Prints descriptions about each available command line option. + function clcPrintCommandLineOptionDescriptions() { + # NOTE; All letters are used for short options. + cat << EOF + -h --help Shows this help message. + + -v --verbose Tells you what is going on (default: "$_VERBOSE"). + + -d --debug Gives you any output from all tools which are used + (default: "$_DEBUG"). + + -c --create-persistent-config If set an xml file for persistent openslx + boot will be created (default: "$_CREATE_PERSISTENT_CONFIG"). +EOF + return $? + } + + # Provides a help message for this module. + function clcPrintHelpMessage() { + echo -e \ + "\nUsage: $0 BASIC_IMAGE_CONFIGURATION_FILE_PATH TARGET_PATH [options]\n" && \ + clcPrintUsageMessage "$@" && \ + echo -e '\nExamples:\n' && \ + clcPrintUsageExamples "$@" && \ + echo -e '\nOption descriptions:\n' && \ + clcPrintCommandLineOptionDescriptions "$@" && \ + echo && \ + return $? + } + + # Provides the command line interface and interactive questions. + function clcCommandLineInterface() { + while true; do + case "$1" in + -h|--help) + shift + clcPrintHelpMessage "$0" + exit 0 + ;; + -v|--verbose) + shift + _VERBOSE='yes' + ;; + -d|--debug) + shift + _DEBUG='yes' + _STANDARD_OUTPUT=/dev/stdout + _ERROR_OUTPUT=/dev/stderr + ;; + -c|--create-persistent-config) + shift + _CREATE_PERSISTENT_CONFIG='yes' + ;; + + '') + shift + break 2 + ;; + *) + if [[ ! "$_BASIC_IMAGE_CONFIGURATION_FILE_PATH" ]]; then + _BASIC_IMAGE_CONFIGURATION_FILE_PATH="$1" + elif [[ ! "$_TARGET_PATH" ]]; then + _TARGET_PATH="$1" + else + clcLog 'critical' \ + "Given argument: \"$1\" is not available." '\n' + clcPrintHelpMessage "$0" + return 1 + fi + shift + ;; + esac + done + if [[ ! "$_BASIC_IMAGE_CONFIGURATION_FILE_PATH" ]] || \ + [[ ! "$_TARGET_PATH" ]]; then + clcLog 'critical' \ + "You have to provide a basic image configuration file and a destination path." + clcPrintHelpMessage "$0" + return 1 + fi + local supportedVirtualMachine + for supportedVirtualMachine in ${_SUPPORTED_HYPERVISOR[*]}; do + if [[ "$(clcGetXMLValue 'virtualMachine' | \ + grep --ignore-case "$supportedVirtualMachine")" ]]; then + _HYPERVISOR="$supportedVirtualMachine" + clcLog 'debug' "Detected \"$_HYPERVISOR\" as hypervisor." + break + fi + done + clcLog 'info' "Using \"$_HYPERVISOR\" as hypervisor." && \ + return $? + } + + # Grabs a value from currently loaded xml file. + function clcGetXMLValue() { + grep --ignore-case --only-matching "<$1 param=.*" \ + "$_BASIC_IMAGE_CONFIGURATION_FILE_PATH" | awk -F '"' '{ print $2 }' + return $? + } + + # Handles logging messages. Returns non zero and exit on log level error to + # support chaining the message into toolchain. + function clcLog() { + local loggingType='info' + local message="$1" + if [ "$2" ]; then + loggingType="$1" + message="$2" + fi + if [ "$_VERBOSE" == 'yes' ] || [ "$loggingType" == 'error' ] || \ + [ "$loggingType" == 'critical' ]; then + if [ "$3" ]; then + echo -e -n "$3" + fi + echo -e "${loggingType}: $message" + fi + if [ "$loggingType" == 'error' ]; then + exit 1 + fi + } + + # endregion + + # region tools + + # Returns the minimal vmx vmware configuration file content to create a + # snapshot. + function clcGetTemporaryVMXContent() { + cat << EOF +.encoding = "UTF-8" +config.version = "8" +virtualHW.version = "7" +ide0:0.present = "TRUE" +ide0:0.fileName = "$1" +displayName = "" +EOF + return $? + } + + # Creates a snapshot from VMware generated virtual machine. + function clcCreateVMwareSnapshot() { + local temporaryConfigurationPath="$(mktemp --directory)/" \ + 1>"$_STANDARD_OUTPUT" 2>"$_ERROR_OUTPUT" && \ + local temporaryConfigurationFilePath="$(mktemp --suffix '.vmx')" \ + 1>"$_STANDARD_OUTPUT" 2>"$_ERROR_OUTPUT" && \ + clcGetTemporaryVMXContent "/var/lib/virt/vmware/$(clcGetXMLValue 'image_name')" \ + 1>"$temporaryConfigurationFilePath" 2>"$_ERROR_OUTPUT" && \ + mv "$temporaryConfigurationFilePath" "$temporaryConfigurationPath" \ + 1>"$_STANDARD_OUTPUT" 2>"$_ERROR_OUTPUT" && \ + clcLog "Needed files generated in \"$temporaryConfigurationPath\" generated." && \ + vmrun snapshot "$temporaryConfigurationPath"*.vmx \ + persistentUserSnapshot 1>"$_STANDARD_OUTPUT" \ + 2>"$_ERROR_OUTPUT" && \ + mv "$temporaryConfigurationPath"*.vmdk "$_TARGET_PATH" \ + 1>"$_STANDARD_OUTPUT" 2>"$_ERROR_OUTPUT" + local result=$? + if [[ "$_DEBUG" == 'no' ]]; then + rm --recursive "$temporaryConfigurationPath" 1>"$_STANDARD_OUTPUT" \ + 2>"$_ERROR_OUTPUT" + fi + return $result + } + + # Creates a snapshot from virtualBox generated virtual machine. + function clcCreateVirtualBoxSnapshot() { + local temporaryConfigurationPath="$(mktemp --directory)" \ + 1>"$_STANDARD_OUTPUT" 2>"$_ERROR_OUTPUT" && \ + VBoxManage clonevm TODO ->(VMNAME) --snapshot base --options link \\ + --basefolder "$temporaryConfigurationPath" \ + 1>"$_STANDARD_OUTPUT" 2>"$_ERROR_OUTPUT" && \ + mv "${temporaryConfigurationPath}/Snapshots/"*.vmdk "$_TARGET_PATH" \ + 1>"$_STANDARD_OUTPUT" 2>"$_ERROR_OUTPUT" && \ + rm --recursive "$temporaryConfigurationPath" 1>"$_STANDARD_OUTPUT" \ + 2>"$_ERROR_OUTPUT" && \ + return $? + } + + # Creates a persistent version of given config file. + function clcCreatePersistentConfig() { + cp "$_BASIC_IMAGE_CONFIGURATION_FILE_PATH" "$_TARGET_PATH" && \ + 1>"$_STANDARD_OUTPUT" 2>"$_ERROR_OUTPUT" && \ + sed --in-place --regexp-extended \ + "s/(< *short_description[^>]*param=\"[^\"]*)(\")/\\1$_PERSISTENT_SHORT_DESCRIPTION_SUFFIX\\2/g" \ + "$_TARGET_PATH" 1>"$_STANDARD_OUTPUT" 2>"$_ERROR_OUTPUT" + return $? + } + + # endregion + +# endregion + +# region controller + + clcCommandLineInterface "$@" || return $? + if [[ "$_CREATE_PERSISTENT_CONFIG" == 'yes' ]]; then + clcCreatePersistentConfig || \ + clcLog 'error' 'Creating persitent config failed.' + else + "clcCreate${_HYPERVISOR}Snapshot" || \ + clcLog 'error' 'Creating Linked Clone failed.' + fi + clcLog 'Program has successfully finished.' && \ + return $? + +# endregion + +} + +# region footer + +if [[ "$0" == *"${__NAME__}.bash" ]]; then + "$__NAME__" "$@" +fi + +# endregion diff --git a/remote/modules/vmchooser/data/opt/openslx/bin/run-virt.sh b/remote/modules/vmchooser/data/opt/openslx/bin/run-virt.sh index f338cd37..bf642ed0 100755 --- a/remote/modules/vmchooser/data/opt/openslx/bin/run-virt.sh +++ b/remote/modules/vmchooser/data/opt/openslx/bin/run-virt.sh @@ -110,13 +110,34 @@ filecheck () ### Get XML file and dir ################################################################################ +## Added for persistent support. +diskmode='nonpersistent' +xmlfile="$1" +if [[ "$(grep --extended-regexp '< *persistent *param=".+"' "$1")" ]]; then + imageFilePath=$(grep -io '<image_name param=.*"' "$1" \ + | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }') + diskmode='persistent' && \ + # TODO path shouldn't be hardcoded. + xmlfile="/var/lib/virt/vmware/$(sed 's/-persistent$//g' <<< "$(sed 's/vmdk$/xml/g' <<< "$(basename "$imageFilePath")")")" && \ + # NOTE: We have to make sure that this folder is present to prevent + # getting an empty string by "readlink". + mkdir --parents ~/.persistentVirtualMachines/ && \ + userBranchFilePath="$(readlink --canonicalize ~/.persistentVirtualMachines/$(basename "$imageFilePath"))" + # Create linked clone if not exists. + if [ ! -f "$userBranchFilePath" ]; then + # TODO path shouldn't be hardcoded. + /opt/openslx/plugin-repo/vmchooser/clc.bash "$xmlfile" \ + "$userBranchFilePath" --debug --verbose + fi +fi +## + # absolute or relative path? -xmlfile=$1 if ls ${xmlfile} 2>/dev/null | grep '/' >/dev/null 2>&1; then xmlpath=$(dirname ${xmlfile}) xmlfile=$(basename ${xmlfile}) else - xmlpath=${path} + xmlpath=${vmchooser_xmlpath} fi # full path xmlfile="${xmlpath}/${xmlfile%.xml}.xml" @@ -170,6 +191,11 @@ writelog "VM config:" # Name of the virt image imgname=$(grep -io '<image_name param=.*"' ${xmlfile} \ | sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }') +## Added for persistent support. +if [[ "$userBranchFilePath" ]]; then + imgname="$userBranchFilePath" +fi +## # Imagename /w full path if echo ${imgname} 2>/dev/null | grep -q '^/' >/dev/null 2>&1; then @@ -181,6 +207,10 @@ if echo ${imgname} 2>/dev/null | grep -q '^/' >/dev/null 2>&1; then elif echo ${xmlfile} 2>/dev/null | grep -q '^/tmp/' >/dev/null 2>&1; then vmpath=$imgname imgname=$(basename ${imgname}) +## Added for persistent support. +elif [[ "$userBranchFilePath" ]]; then + vmpath="$userBranchFilePath" +## # Else use same path as xml else imgpath=${xmlpath} @@ -335,30 +365,6 @@ hddrv="ide" audio="true" remotedesktopport="590${VM_ID}" -# Display resolution within the host system -hostres=$(xvidtune -show 2>/dev/null| grep -ve "^$") -xres=$(echo "${hostres}" | awk '{print $3}') -yres=$(echo "${hostres}" | awk '{print $7}') - -# Resolution defined via xml parameter: fullscreen, full/X*Y/depth; windowed, -# win/X*Y/depth -userres=$(grep -io '<screen param=.*"' ${xmlfile} | awk -F '"' '{ print $2 }' | \ - tr "A-Z" "a-z") -case "${userres}" in - full*) - res=$(echo "${hostres}" | awk -F "/" '{print $2}') - uxres=${res%\**} - uyres=${#*\*} - userres="full" - ;; - win*) - res=$(echo "${hostres}" | awk -F "/" '{print $2}') - uxres=${res%\**} - uyres=${#*\*} - userres="win" - ;; -esac - # Enable 3D enable3d=$(grep -i "<enable3d param=.*" ${xmlfile} 2>/dev/null | \ @@ -399,10 +405,9 @@ fi # Copy guest configuration (with added information) config.xml to be accessed # via virtual floppy -# fixme -> to be changed (vmchooser adapts the file content!?) -#TODO: wozu echo? -#echo "Please fix the config.xml generation" -cp ${xmlfile} /etc/openslx/vmchooser/fd-loop/config.xml +cp "$xmlfile" "/etc/openslx/vmchooser/fd-loop/config.xml" +# Add another file with resolution information +xrandr | grep -o -E 'current\s*[0-9]+\s*x\s*[0-9]+' | cut -c 8- | sed -r 's/(\s|\t|\n)//g' | head -n 1 > "/etc/openslx/vmchooser/fd-loop/hostres.txt" # Get all virtual machine specific stuff from the respective include file if [ -e /etc/openslx/${xmlvirt}/run-virt.include ] ; then diff --git a/remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh b/remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh index ded5d114..67e49d3e 100755 --- a/remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh +++ b/remote/modules/vmchooser/data/opt/openslx/bin/xmlfilter.sh @@ -33,18 +33,32 @@ if [ -f ${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf ]; then . ${OPENSLX_DEFAULT_CONFDIR}/plugins/vmchooser/vmchooser.conf fi -for FILE in $(find $1 -iname "*.xml"); do +function handlePersistentVM() { + if [[ "$(grep --extended-regexp \ + "<persistent param=\"(|.+:)$USER(|:.+)\"" "$1")" ]]; then + # If this virtual machine is useable as persistent version for current + # user we provide an additional persistent version. + local persistentConfigVersionFilePath="$(mktemp --directory)/$(basename "${1}-persistent")" + /opt/openslx/plugin-repo/vmchooser/clc.bash "$1" \ + "$persistentConfigVersionFilePath" --create-persistent-config && \ + echo "$persistentConfigVersionFilePath" + fi +} + +for FILE in $(find -L "$1" -iname "*.xml"); do # filter all xmls which aren't set active - if [ $(grep "<active param=.*true.*" ${FILE} | wc -l) -eq 1 ]; then - if [ -n ${vmchooser_env} ]; then + if [ $(grep "<active param=.*true.*" "$FILE" | wc -l) -eq 1 ]; then + if [ -n "${vmchooser_env}" ]; then # filter all xmls with pool-param not equal to vmchooser::env - if [ $(grep "<pools param=\"${vmchooser_env}\"" ${FILE} | wc -l) -eq 1 ];\ + if [ $(grep "<pools param=\"${vmchooser_env}\"" "$FILE" | wc -l) -eq 1 ] then - echo ${FILE}; + handlePersistentVM "$FILE" + echo "$FILE" fi else + handlePersistentVM "$FILE" # if there is no pool set, just take all available xmls - echo -e ${active} + echo "$FILE" fi fi done diff --git a/remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include b/remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include index 9b0fea91..45ff2d72 100644 --- a/remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include +++ b/remote/modules/vmplayer/data/etc/openslx/vmware/run-virt.include @@ -351,7 +351,6 @@ esac local FORCE3D="" if [ -n "$SLX_VMWARE_3D" ]; then FORCE3D='mks.gl.allowBlacklistedDrivers = "TRUE"' - enable3d="TRUE" fi # serial/parallel port defined (e.g. "ttyS0, lp0" or "autodetect") diff --git a/remote/modules/vmplayer/vmplayer.build b/remote/modules/vmplayer/vmplayer.build index a4dd8a29..4c0d46e6 100644 --- a/remote/modules/vmplayer/vmplayer.build +++ b/remote/modules/vmplayer/vmplayer.build @@ -60,7 +60,7 @@ build() { post_copy() { # FIXME: gconftool is copied without dependencies - tarcopy "$(find /usr/lib/ -name gconv -type d)" "$TARGET_BUILD_DIR" + tarcopy "$(find /usr/lib/ /usr/lib64 -name gconv -type d)" "$TARGET_BUILD_DIR" #Update Icon cache for vmplayer gtk-update-icon-cache-3.0 "${TARGET_BUILD_DIR}/usr/share/icons/hicolor/" || pwarning "update-icon-cache-3.0 failed." #fix vmware-usbarbotrator bug @@ -69,7 +69,6 @@ post_copy() { } build_modules() { - pdebug "PAtCHIGN" # need to be in src cd "$MODULE_DIR/src" || perror "Could not cd to '$MODULE_DIR/src'" local VMWARE_MODCONFIG="$MODULE_DIR/src/vmware-vmx/bin/vmware-modconfig" @@ -133,9 +132,9 @@ EOF tar cf "vmblock.tar" "vmblock-only/" || perror "repacking of vmblock.tar failed." cd - - pinfo "KOMPALIERE VMWARE KERNEL MODULE" + pinfo "KOMPILIERE VMWARE KERNEL MODULE" for MOD in vsock vmblock vmmon vmnet vmci; do - pinfo "Kompaliere $MOD" + pinfo "Kompiliere $MOD" [ -s "/lib/modules/$UTS_RELEASE/vmplayer/$MOD.ko" ] && unlink "/lib/modules/$UTS_RELEASE/vmplayer/$MOD.ko" "$VMWARE_MODCONFIG" --console --build-mod -k "$UTS_RELEASE" "$MOD" "$(which gcc)" "$MODULES_DIR/kernel/ksrc/include" "vmplayer" "$MOD" [ ! -s "/lib/modules/$UTS_RELEASE/vmplayer/$MOD.ko" ] && perror "Error compiling via $VMWARE_MODCONFIG" 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/modules/xorg/xorg.conf.zypper b/remote/modules/xorg/xorg.conf.zypper index 4041f4bd..b48452fb 100644 --- a/remote/modules/xorg/xorg.conf.zypper +++ b/remote/modules/xorg/xorg.conf.zypper @@ -32,6 +32,8 @@ REQUIRED_CONTENT_PACKAGES=" xkbprint setxkbmap xkbevd + libpixman-1-0 + xrandr " REQUIRED_LIBRARIES=" libI810XvMC @@ -41,6 +43,7 @@ REQUIRED_LIBRARIES=" vmwgfx_dri i915_dri i965_drv_video + libpixman-1 " REQUIRED_BINARIES=" Xorg gtf @@ -52,7 +55,8 @@ REQUIRED_BINARIES=" Xorg xkbwatch xkbbell xkbevd - vmmouse_detect" + vmmouse_detect + xrandr" REQUIRED_DIRECTORIES=" /usr/lib/udev /usr/$LIB64/xorg diff --git a/remote/rootfs/rootfs-stage31/data/init b/remote/rootfs/rootfs-stage31/data/init index 346ccc13..6a718c46 100755 --- a/remote/rootfs/rootfs-stage31/data/init +++ b/remote/rootfs/rootfs-stage31/data/init @@ -98,7 +98,6 @@ fi [ $DEBUG -ge 3 ] && drop_shell "Requested Debug Shell: squashfs/nfs mounted, before aufs." echo "Building aufs..." -mv /mnt/modprobing /dev/shm/uniontmp #mount -t overlayfs -o lowerdir=/rorootfs,upperdir=/dev/shm/uniontmp overlayfs /mnt mount -n -t aufs -o br:/dev/shm/uniontmp:/rorootfs=ro none /mnt || drop_shell "Problem building aufs." mkdir -p /mnt/uniontmp /mnt/tmp @@ -107,9 +106,9 @@ mount -n --move /dev/shm/uniontmp /mnt/uniontmp || drop_shell "Problem moving un [ $DEBUG -ge 2 ] && drop_shell "Requested Debug Shell: after aufs'ing." # Download config if available -/mnt/opt/openslx/bin/activate-sysconfig /mnt +/mnt/opt/openslx/bin/activate-sysconfig /mnt 2> /dev/null if [ ! -e /mnt/opt/openslx/config ]; then - sleep 0.5 + sleep 1 /mnt/opt/openslx/bin/activate-sysconfig /mnt fi if [ -e /mnt/opt/openslx/config ]; then diff --git a/remote/rootfs/rootfs-stage31/rootfs-stage31.build b/remote/rootfs/rootfs-stage31/rootfs-stage31.build index d547d7a4..d9f28636 100644 --- a/remote/rootfs/rootfs-stage31/rootfs-stage31.build +++ b/remote/rootfs/rootfs-stage31/rootfs-stage31.build @@ -19,7 +19,10 @@ build() { } post_copy() { + pinfo "Generating rootfs for Stage 3.1 ..." generate_rootfs + + # copy kernel, modules and firmware copy_kernel_modules copy_firmware copy_kernel diff --git a/remote/rootfs/rootfs-stage32/data/etc/hosts b/remote/rootfs/rootfs-stage32/data/etc/hosts new file mode 100644 index 00000000..631cf753 --- /dev/null +++ b/remote/rootfs/rootfs-stage32/data/etc/hosts @@ -0,0 +1,8 @@ +127.0.0.1 localhost + +# The following lines are desirable for IPv6 capable hosts +::1 ip6-localhost ip6-loopback +fe00::0 ip6-localnet +ff00::0 ip6-mcastprefix +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/analyse-disk b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/analyse-disk index 06528171..978b341b 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/analyse-disk +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/analyse-disk @@ -14,7 +14,6 @@ ############################################################################# -export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/bin:/opt/openslx/sbin:/opt/openslx/usr/bin:/opt/openslx/usr/sbin" # General formatter for the /tmp partition on a local harddisk diskfm () { @@ -58,6 +57,7 @@ fdisk -l | sed -n "/^\/dev\//p" > "/etc/disk.partition" # Check for standard swap partitions and make them available to the system for hdpartnr in $(sed -n -e "/ 82 /p" "/etc/disk.partition" | sed -e "s/[[:space:]].*//"); do echo -e "$hdpartnr\tswap\t\tswap\t\tdefaults\t 0 0" >> "/etc/fstab" + swapon "$hdpartnr" done # We use special non assigned partition type (id44) for harddisk scratch diff --git a/remote/rootfs/rootfs-stage32/data/usr/sbin/penv b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/penv index ca5a23ac..ca5a23ac 100755 --- a/remote/rootfs/rootfs-stage32/data/usr/sbin/penv +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/penv diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script index 08d59eba..1bbf6e80 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script @@ -29,6 +29,14 @@ rebuild_resolv_conf () { sort -u /run/udhcpc/*.resolv > "$RESOLV_CONF" } +escape_search() { + echo "$@" | sed -e 's/[]\/()$*.^|[]/\\&/g' +} + +escape_replace() { + echo "$@" | sed -e 's/[\/&]/\\&/g' +} + case "$1" in bound|renew) ip addr add "$ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//)" dev "$interface" @@ -39,7 +47,7 @@ case "$1" in # Update resolver configuration file CONF="" if [ -n "$domain" ]; then - printf -v CONF "domain $domain\n" + printf -v CONF "domain $domain\nsearch $domain\n" elif [ -n "$SLX_NET_DOMAIN" ]; then printf -v CONF "domain $SLX_NET_DOMAIN\nsearch $SLX_NET_DOMAIN\n" fi @@ -81,6 +89,32 @@ case "$1" in fi fi + # Hostname in /etc/hosts + touch /etc/hosts + if [ -n "$dns_host" ]; then + short="${dns_host%%.*}" + [ "x$short" = "x$dns_host" ] && short="" + sed -i -r "s/\s$(escape_search "$dns_host")(\s|$)/ /g" /etc/hosts + [ -n "$short" ] && sed -i -r "s/\s$(escape_search "$short")(\s|$)/ /g" /etc/hosts + if grep -q -E "^$ip\s" /etc/hosts; then + sed -i "s/^$(escape_search "$ip")\s/$(escape_replace "$ip $dns_host $short ")/g" /etc/hosts + else + echo "$ip $dns_host $short" >> /etc/hosts + fi + fi + if [ -n "$hostname" -a "x$hostname" != "x$dns_host" ]; then + short="${hostname%%.*}" + [ "x$short" = "x$hostname" ] && short="" + sed -i -r "s/\s$(escape_search "$hostname")(\s|$)/ /g" /etc/hosts + [ -n "$short" ] && sed -i -r "s/\s$(escape_search "$short")(\s|$)/ /g" /etc/hosts + if grep -q -E "^$ip\s" /etc/hosts; then + sed -i "s/^$(escape_search "$ip")\s/$(escape_replace "$ip $hostname $short ")/g" /etc/hosts + else + echo "$ip $hostname $short" >> /etc/hosts + fi + fi + sed -i -r '/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\s*$/d' /etc/hosts + # We consider the network setup to be complete if an interface is being configured that # has a default route and some dns servers set. if [ -n "$router" ] && [ -n "$dns" ] && [ ! -e "/run/udhcpc/network-ready" ]; then diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.build b/remote/rootfs/rootfs-stage32/rootfs-stage32.build index 39c96ccc..93094f72 100644 --- a/remote/rootfs/rootfs-stage32/rootfs-stage32.build +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.build @@ -104,21 +104,12 @@ post_copy() { sed -i -r 's/^blacklist.*pcspkr/#&/g' "$TARGET_BUILD_DIR/etc/modprobe.d/blacklist.conf" echo "minilinux-$(hostname)" > "${TARGET_BUILD_DIR}/etc/hostname" - # check for kernel modules, if not present copy from system - if [ ! -d ${TARGET_BUILD_DIR}/lib/modules ]; then - pinfo "Copying modules for kernel ${KERNEL_VERSION}..." - copy_kernel_modules - else - pinfo "Not copying kernel modules from system, as '${TARGET_BUILD_DIR}/lib/modules' already exists." - fi - # check for firmware, if not present copy from system - if [ ! -d ${TARGET_BUILD_DIR}/lib/firmware ]; then - pinfo "Copying firmware for kernel ${KERNEL_VERSION}..." - copy_firmware - else - pinfo "Not copying firmware from system, as '${TARGET_BUILD_DIR}/lib/firmware' already exists." - fi + + # copy kernel, modules and firmware + copy_kernel_modules + copy_firmware + copy_kernel # Try to fetch distro logo if [ ! -s "$TARGET_BUILD_DIR/etc/distro.png" ]; then @@ -134,6 +125,5 @@ post_copy() { fi fi - copy_kernel } diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper index f52db58f..4d51fc15 100644 --- a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper @@ -31,6 +31,7 @@ REQUIRED_FILES=" /etc/networks /etc/netconfig /usr/share/X11/app-defaults/Xvidtune + /etc/fonts/fonts.conf " REQUIRED_KERNEL_MODULES=" kernel/drivers/cpufreq kernel/drivers/memstick diff --git a/remote/setup_target b/remote/setup_target index 1638f392..804f43bc 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -227,6 +227,26 @@ generate_target() { pinfo "Activated modules in '${TARGET}':" pinfo "\t$(echo ${MODULES})" + # we need a bit of special logic for kernel specifically + # to check if the built version is corresponding to the + # current kernel version. If not we had a kernel update + # and need to ask the user what to do + if [[ "$MODULES" == *kernel* ]]; then + # if so, check what kernels have been built + if [ -e "${MODULES_DIR}/kernel/ksrc/KVERSION" ]; then + local BUILT_KERNEL_VERSION=$(cat "${MODULES_DIR}/kernel/ksrc/KVERSION") + if [[ "${BUILT_KERNEL_VERSION}" != "${KERNEL_CURRENT_VERSION}" ]]; then + pinfo "The built kernel (${BUILT_KERNEL_VERSION}) is older than the running one (${KERNEL_CURRENT_VERSION})!" + # cleaning the module is enough as it forces to rebuild. + [[ "${AUTO_UPDATE_KERNEL}" == 1 ]] && pinfo "Auto-Udpate Kernel..." && clean_kernel_module --force + fi + else + # KVERSION is not found. + pdebug "KVERSION not found under remote/modules/kernel/ksrc/KVERSION" + pdebug "Ignoring. If errors arise, either write your KVERSION manually or clean the kernel." + fi + fi + # copy basic libs pinfo "Copying libc and ld-linux used by ${SHELL}" tarcopy "$(list_basic_libs)" "${TARGET_BUILD_DIR}" @@ -255,11 +275,6 @@ process_module() { pinfo ">>>>>>>>>>>>>>>>> Processing module [ $MODULE ]" TOOL_STR="[${MODULE}]" if [ -d "${MODULE_DIR}" ]; then - - #[ "x$DEBUG" != "x1" ] \ - # && echo "Logging to ${TOOL_DIR}/${TOOL}/stage32.log" \ - # && exec 6>&1 > ${TOOL_DIR}/${TOOL}/stage32.log - # TODO: Make above work with the new logging system (add function to logging.inc to switch logfile) cd "${MODULE_DIR}" || perror "Module dir '${MODULE_DIR}' seems to exist, but cd to it failed." pinfo "## Reading config" read_config @@ -299,10 +314,8 @@ process_module() { copy_static_data pinfo "## Post copy" post_copy - # reset pipes - #[ "x$DEBUG" != "x1" ] && exec 1>&6 6>&- - # TODO - calc_size #sets MODULE_BUILD_SIZE + # set MODULE_BUILD_SIZE + calc_size pinfo "Module completed. Total size: ${MODULE_BUILD_SIZE}" else pwarning "Module directory for '$MODULE' not found." @@ -310,10 +323,8 @@ process_module() { } post_process_target() { - local TOOL_STR="$TOOL_STR post_process_target:" - - #move systemd files from /lib to /etc/lib + # move systemd files from /lib to /etc/lib pinfo "move systemd files from /lib/systemd to /etc/systemd" if [ -d "${TARGET_BUILD_DIR}/lib/systemd" ]; then cd "${TARGET_BUILD_DIR}/lib" @@ -404,12 +415,17 @@ clean_module() { } clean_kernel_module() { + local CLEAN=0 + if [ "x$1" == "x--force" ]; then + CLEAN=1 + else + pinfo "It will take a long time to rebuild, are you sure? [y/N]" + read USER_INPUT + [ "x$USER_INPUT" == "xy" ] && CLEAN=1 + fi + pinfo "Cleaning kernel module (including sources and compiled stuff)." - pinfo "It will take a long time to rebuild, are you sure? [y/N]" - read USER_INPUT - if [ "x$USER_INPUT" == "xy" ]; then - pinfo "Confirmed, going on..." - # clean kernel module + if [[ $CLEAN == 1 ]]; then cd "${TARGET_DIR}/kernel" || perror "Could not cd to ${TARGET_DIR}/kernel" if [ -e build ]; then rm -rf build || perror "Could not delete ${TARGET_DIR}/kernel/build" diff --git a/remote/targets/stage32-opensuse/nscd b/remote/targets/stage32-opensuse/nscd new file mode 120000 index 00000000..d7e411d2 --- /dev/null +++ b/remote/targets/stage32-opensuse/nscd @@ -0,0 +1 @@ +../../modules/nscd
\ No newline at end of file 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 diff --git a/remote/targets/stage32/nscd b/remote/targets/stage32/nscd new file mode 120000 index 00000000..d7e411d2 --- /dev/null +++ b/remote/targets/stage32/nscd @@ -0,0 +1 @@ +../../modules/nscd
\ No newline at end of file |
