diff options
author | Jonathan Bauer | 2018-02-14 13:15:54 +0100 |
---|---|---|
committer | Jonathan Bauer | 2018-02-14 13:15:54 +0100 |
commit | 780e9ebdf01db68760d95d86d09f8bc37d676dba (patch) | |
tree | 6ada795174dd2b8fc4a76ead45026e670eb8e399 | |
parent | [lightdm-greeter-bwlp] fix path (diff) | |
parent | [run-virt] relax /tmp mount detection regex (diff) | |
download | mltk-780e9ebdf01db68760d95d86d09f8bc37d676dba.tar.gz mltk-780e9ebdf01db68760d95d86d09f8bc37d676dba.tar.xz mltk-780e9ebdf01db68760d95d86d09f8bc37d676dba.zip |
Merge branch 'master' into install-mode
295 files changed, 6423 insertions, 548 deletions
diff --git a/core/bin/setup_target b/core/bin/setup_target index f8f90801..da4c6678 100755 --- a/core/bin/setup_target +++ b/core/bin/setup_target @@ -534,10 +534,24 @@ clean_module() { local TARGET=${1%:*} local MODULE=${1#*:} + local MODULE_DIR="${TARGET}/${MODULE}" local MODULE_WORK_DIR="${ROOT_DIR}/tmp/work/${MODULE}" + if ! [ -d "$MODULE_DIR" ]; then + pwarning "No such module '$MODULE' in current target '$TARGET'" + pwarning "Check your spelling" + if [ -d "$MODULE_WORK_DIR" ]; then + pwarning "Continuing anyways since the according work dir exists..." + else + return 1 + fi + fi + # if kernel is to be cleaned, do it separately and return - [ "x$MODULE" == "xkernel" ] && clean_kernel_module "${TARGET}:${MODULE}" && return + if [ "x$MODULE" == "xkernel" ]; then + clean_kernel_module "${TARGET}:${MODULE}" + return + fi pinfo "Cleaning '$1'..." rm -rf -- "${MODULE_WORK_DIR}/build" || perror "Could not delete build path" @@ -548,6 +562,7 @@ clean_module() { # These are not in use anymore, but leave the cleanup here for upgraders rm -f -- "${MODULE_WORK_DIR}/.built" rm -f -- "${MODULE_WORK_DIR}/.fetched_source" + return 1 } clean_kernel_module() { diff --git a/core/includes/chroot.inc b/core/includes/chroot.inc index 21134931..f04dd446 100644 --- a/core/includes/chroot.inc +++ b/core/includes/chroot.inc @@ -22,6 +22,36 @@ declare -rg CHROOT_BINDDIR="${CHROOT_TEMPDIR}/rootbind" declare -rg CHROOT_LOWERDIR="/" declare -rg CHROOT_BINDMOUNTS="/dev /proc /sys /run" +# Helper for the helper to detect overlay filesystem name +chroot_detect_overlayfs() { + declare -g OVERLAYFS_FSTYPES="$(grep -oE '\boverlay(fs)?$' /proc/filesystems)" + pinfo "OVERLAYFS: $OVERLAYFS_FSTYPES" + if [ "$(<<< $OVERLAYFS_FSTYPES wc -w)" -ge 1 ]; then + # more than one overlayfs support in /proc/filesystems + # either one should work, will try them all later + pdebug "Found overlayfs types: $OVERLAYFS_FSTYPES" + readonly OVERLAYFS_FSTYPES + return 0 + fi + unset OVERLAYFS_FSTYPES + return 1 +} +# Helper to make sure we can use overlayfs +chroot_init_overlayfs() { + # check if we already support it + chroot_detect_overlayfs && return 0 + + # nothing found, try to load kernel module + pwarning "No overlayfs found in /proc/filesystems, trying to load module..." + for NAME in overlay overlayfs; do + if modprobe "${NAME}"; then + chroot_detect_overlayfs && break + fi + done + if [ -z "$OVERLAYFS_FSTYPES" ]; then + perror "Could not initialize overlayfs!" + fi +} # Helper function to setup the directory structure chroot_prepare_dirs() { @@ -70,21 +100,31 @@ chroot_prepare_mounts() { # checking overlay-modinfo (which may fail if overlayfs is not incorporated as module) or kernel versions, we simply try to # mount 'old school' first and then, if that fails, the new way to mount with workdir. See differences in mount syntax below. pinfo "Now mounting overlayfs. Trying old mount syntax (up to Kernel 3.13) ..." - mount -t overlayfs overlayfs -o lowerdir="${CHROOT_BINDDIR}",upperdir="${CHROOT_UPPERDIR}" "${CHROOT_MOUNTDIR}" 2>/dev/null - if [ $? -ne 0 ]; then - pinfo "Old mount syntax failed. Trying new mount syntax (Kernel 3.19+) ..." - # We have to use a overlayfs workdir which _must_ be in the same filesystem as CHROOT_UPPERDIR. So - # we traverse to the directory below CHROOT_UPPERDIR and mkdir/mktemp a workdir there. In the possible - # case that CHROOT_UPPERDIR is the root dir of a filesystem there's nothing we can do but exit. - CHROOT_WORKDIR="$(mktemp -d $(dirname ${CHROOT_UPPERDIR})/workdirXXX)" \ - || perror "Could not mkdir overlayfs workdir $CHROOT_WORKDIR for new overlayfs mount syntax." - # Now we try to mount the overlayfs in the new fashion: - mount -t overlayfs overlayfs -o lowerdir="$CHROOT_LOWERDIR",upperdir="${CHROOT_UPPERDIR}",workdir="${CHROOT_WORKDIR}" "${CHROOT_MOUNTDIR}" \ - || perror "Could not mount (overlayfs) $CHROOT_LOWERDIR, $CHROOT_UPPERDIR to $CHROOT_BINDDIR." - pinfo "New overlayfs mount syntax has worked, commencing." - else - pinfo "Old overlayfs mount syntax has worked, commencing." - fi + for OVERLAYFS_NAME in ${OVERLAYFS_FSTYPES}; do + mount -t "${OVERLAYFS_NAME}" "${OVERLAYFS_NAME}" \ + -o lowerdir="${CHROOT_LOWERDIR}",upperdir="${CHROOT_UPPERDIR}" \ + "${CHROOT_MOUNTDIR}" 2>/dev/null + if [ $? -ne 0 ]; then + pinfo "Old mount syntax failed. Trying new mount syntax (Kernel 3.19+) ..." + # We have to use a overlayfs workdir which _must_ be in the same filesystem as CHROOT_UPPERDIR. So + # we traverse to the directory below CHROOT_UPPERDIR and mkdir/mktemp a workdir there. In the possible + # case that CHROOT_UPPERDIR is the root dir of a filesystem there's nothing we can do but exit. + CHROOT_WORKDIR="$(dirname ${CHROOT_UPPERDIR})/workdir-$MODULE" + mkdir -p "$CHROOT_WORKDIR" + if [ -z "$CHROOT_WORKDIR" ] || ! [ -d "$CHROOT_WORKDIR" ]; then + perror "Could not mkdir overlayfs workdir $CHROOT_WORKDIR for new overlayfs mount syntax." + fi + # Now we try to mount the overlayfs in the new fashion: + lsof -n > /tmp/bbboboboooo + mount -v -t "${OVERLAYFS_NAME}" "${OVERLAYFS_NAME}" \ + -o lowerdir="${CHROOT_BINDDIR}",upperdir="${CHROOT_UPPERDIR}",workdir="${CHROOT_WORKDIR}" \ + "${CHROOT_MOUNTDIR}" \ + || perror "Could not mount (overlayfs) $CHROOT_BINDDIR, $CHROOT_UPPERDIR, ${CHROOT_WORKDIR} to $CHROOT_MOUNTDIR." + pinfo "New overlayfs mount syntax has worked, commencing." + else + pinfo "Old overlayfs mount syntax has worked, commencing." + fi + done # mount pseudo-filesystems for DIR in $CHROOT_BINDMOUNTS; do @@ -122,10 +162,11 @@ chroot_gen_autoexec() { chroot_handle_whiteouts() { local WHITEOUT_LIST="${CHROOT_UPPERDIR}/overlay.whiteout.list" - rm -f -- "$WHITEOUT_LIST=" - #mkdir -p "$(dirname "$WHITEOUT_LIST")" || perror "Could not create $(dirname "$WHITEOUT_LIST")" + rm -f -- "$WHITEOUT_LIST" + mkdir -p "$(dirname "$WHITEOUT_LIST")" || perror "Could not create $(dirname "$WHITEOUT_LIST")" + touch "$WHITEOUT_LIST" || perror "Could not touch whiteout list $WHITEOUT_LIST" pdebug "Searching for overlayfs-whiteouts ..." - for WHITEOUT in $(find "$CHROOT_UPPERDIR" -lname "(overlay-whiteout)"); do + for WHITEOUT in $(find "$CHROOT_UPPERDIR" \( -type c -perm 0000 \) -o -lname "(overlay-whiteout)"); do pdebug "Whiteout found: $WHITEOUT" echo "/./${WHITEOUT#$CHROOT_UPPERDIR}" >> "$WHITEOUT_LIST" rm -f -- "$WHITEOUT" || perror "Could not delete whiteout $WHITEOUT!" @@ -158,6 +199,8 @@ chroot_run() { local CHROOT_UPPERDIR="$1" mkdir -p "$1" + # init overlayfs + chroot_init_overlayfs || perror "Failed to initialize overlayfs with $?." # first prepare the dir structure chroot_prepare_dirs || perror "'chroot_prepare_dirs' failed with $?." chroot_prepare_mounts || perror "'chroot_prepare_mounts' failed with $?." @@ -208,7 +251,7 @@ chroot_umount() { # check if MOUNT is mounted if ! chroot_check_mount_point "${MOUNT}"; then # still mounted - if umount -l "${MOUNT}"; then + if umount "${MOUNT}"; then pdebug "Successfully umounted '${MOUNT}'." else pwarning "Could not umount '${MOUNT}'! Trying again..." @@ -223,27 +266,40 @@ chroot_umount() { fi # better be safe than sorry - chroot_check_mount_point "$MOUNT" || perror "'$MOUNT' is still mounted, exiting before something bad happens..." } # Helper to cleanup the temporary mounts chroot_cleanup_mounts() { + local exe FILE pid tries + local DOKILL= + for tries in 1 2 0; do + for exe in /proc/*/exe; do + pid=${exe#/proc/} + pid=${pid%/exe} + FILE=$(readlink -f "$exe") + if [ "${FILE#$CHROOT_TEMPDIR}" != "$FILE" ]; then + pwarning "Killing $FILE ($pid)" + kill $DOKILL "$pid" + DOKILL="-9" + kill "$pid" + fi + done + [ -z "$DOSLEEP" ] && break + sleep "$tries" + done if [[ "$(mount | grep -c $CHROOT_TEMPDIR)" -gt 0 ]]; then # No point in unmounting then... + for tries in 1 2 3 4 5; do + for DIR in $CHROOT_BINDMOUNTS; do + umount "${CHROOT_MOUNTDIR}/${DIR}" + done + umount "${CHROOT_MOUNTDIR}" + umount "${CHROOT_BINDDIR}" + done for DIR in $CHROOT_BINDMOUNTS; do - chroot_umount "${CHROOT_MOUNTDIR}/${DIR}" + chroot_check_mount_point "$CHROOT_MOUNTDIR/$DIR" || perror "'$CHROOT_MOUNTDIR/$DIR' is still mounted, exiting before something bad happens..." done - chroot_umount "${CHROOT_MOUNTDIR}" - chroot_umount "${CHROOT_BINDDIR}" else pinfo "Nothing chroot-related is mounted - exiting." fi - # In case of 'new' overlayfs mount - should perhaps be handled via flag... - if [ -d "${CHROOT_WORKDIR}" ]; then - # Too much of a coward to rm -rf somewhere. Both directories should be empty so we use rmdir. - rmdir "${CHROOT_WORKDIR}/work" && pinfo "rmdir-ed CHROOT_WORKDIR/work ${CHROOT_WORKDIR}/work needed for new overlayfs mount syntax." \ - || pinfo "Could not rmdir CHROOT_WORKDIR/work ${CHROOT_WORKDIR}/work - clean it by hand." - rmdir "${CHROOT_WORKDIR}" && pinfo "rmdir-ed CHROOT_WORKDIR ${CHROOT_WORKDIR} needed for new overlayfs mount syntax." \ - || pinfo "Could not rmdir CHROOT_WORKDIR ${CHROOT_WORKDIR} needed for new overlayfs mount syntax - clean by hand." - fi } diff --git a/core/includes/packagemanager.inc b/core/includes/packagemanager.inc index 9fcb4b87..6bc5d22a 100644 --- a/core/includes/packagemanager.inc +++ b/core/includes/packagemanager.inc @@ -71,7 +71,9 @@ list_content_package(){ [ -z "$FILES" ] && pwarning "list_packet_files empty for packet ${PACKAGE}." && continue pdebug "Packet $PACKAGE has $(echo $FILES | wc -w) files..." for FILE in $FILES; do - [ "$OP" "$FILE" ] && echo "$FILE" + if [ "$OP" "$FILE" ] || [ -h "$FILE" ]; then + echo "$FILE" + fi done } # diff --git a/core/includes/qt.inc b/core/includes/qt.inc index 8cc0c1d4..d98ffb59 100644 --- a/core/includes/qt.inc +++ b/core/includes/qt.inc @@ -18,7 +18,7 @@ activate_qt() { local QTS="$(echo "$QT_CANDIDATES" | wc -w)" if [ "$QTS" -eq 1 ]; then # we found it, lets activate it and hope for the best - ln -sf "/usr/share/qtchooser/$QT_CANDIDATES" "/usr/share/qtchooser/default.conf" \ + ln -sf "$QT_CANDIDATES" "/usr/share/qtchooser/default.conf" \ || perror "Could not link 'default.conf' to '/usr/share/qtchooser/$QT_CANDIDATES'" elif [ "$QTS" -eq 0 ]; then perror "No qt ${QT_VERSION} config found in /usr/share/qtchooser" diff --git a/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter b/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter index 4ec0e191..fdc2416d 100755 --- a/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter +++ b/core/modules/beamergui/data/opt/openslx/scripts/beamergui-mode_setter @@ -8,19 +8,17 @@ ################################################################################ # Add or remove additional modes here. declare -a MODES -MODES=("${MODES[@]}" "1280x800 83.50 1280 1352 1480 1680 800 803 809 831 -hsync +vsync") -MODES=("${MODES[@]}" "1440x1050 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync") -MODES=("${MODES[@]}" "1680x1200 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync") -MODES=("${MODES[@]}" "1920x1200 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync") +MODES=("${MODES[@]}" "1024x768 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync") +MODES=("${MODES[@]}" "1152x864 81.75 1152 1216 1336 1520 864 867 871 897 -hsync +vsync") MODES=("${MODES[@]}" "1280x720 74.50 1280 1344 1472 1664 720 723 728 748 -hsync +vsync") +MODES=("${MODES[@]}" "1280x800 83.50 1280 1352 1480 1680 800 803 809 831 -hsync +vsync") +MODES=("${MODES[@]}" "1280x1024 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync") MODES=("${MODES[@]}" "1368x768 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync") +MODES=("${MODES[@]}" "1440x1050 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync") MODES=("${MODES[@]}" "1600x900 118.25 1600 1696 1856 2112 900 903 908 934 -hsync +vsync") +MODES=("${MODES[@]}" "1680x1050 146.25 1680 1784 1960 2240 1050 1053 1059 1089 -hsync +vsync") MODES=("${MODES[@]}" "1920x1080 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync") -MODES=("${MODES[@]}" "800x600 38.25 800 832 912 1024 600 603 607 624 -hsync +vsync") -MODES=("${MODES[@]}" "1024x768 63.50 1024 1072 1176 1328 768 771 775 798 -hsync +vsync") -MODES=("${MODES[@]}" "1152x864 81.75 1152 1216 1336 1520 864 867 871 897 -hsync +vsync") -MODES=("${MODES[@]}" "1280x960 101.25 1280 1360 1488 1696 960 963 967 996 -hsync +vsync") -MODES=("${MODES[@]}" "1280x1024 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync") +MODES=("${MODES[@]}" "1920x1200 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync") ################################################################################ CONFIGFILE="/opt/openslx/beamergui/beamer.conf" @@ -67,7 +65,7 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then fi # Either of them a projector? - BEAMER= + B_INDEX= MAYBEAMER= SMALL= TF=$(mktemp) @@ -98,15 +96,15 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then fi # Set beamer if any match if [ -n "$FOUND" ]; then - BEAMER=$i + B_INDEX=$i continue fi fi # Classic test by what X(randr) figured out - WIDTH=$( <<<"$XRANDR" grep -E "^${OUTPUTNAMES[$i]}.*[0-9]+mm x [0-9]+mm" | head -n 1 | grep -o -E ' [0-9]+mm x' | grep -o -E '[0-9]+' ) + WIDTH=$( <<<"$XRANDR" grep -m 1 -E "^${OUTPUTNAMES[$i]}.*[0-9]+mm x [0-9]+mm" | grep -o -E ' [0-9]+mm x' | grep -o -E '[0-9]+' ) if [ -z "$WIDTH" ] || [ "$WIDTH" -eq 0 ] || [ "$WIDTH" -gt 900 ]; then echo "Screen $i is beamer, width is '$WIDTH'" - BEAMER=$i + B_INDEX=$i elif [ -n "$WIDTH" ] && [ "$WIDTH" -gt 700 ]; then MAYBEAMER=$i elif [ -n "$WIDTH" ] && [ "$WIDTH" -lt 550 ]; then @@ -114,17 +112,20 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then fi done rm -f -- "$TF" - if [ -z "$BEAMER" ] && [ -n "$MAYBEAMER" ] && [ -n "$SMALL" ]; then + if [ -z "$B_INDEX" ] && [ -n "$MAYBEAMER" ] && [ -n "$SMALL" ]; then # This is a hack on top of the other hack; we already treat outputs reporting a sufficiently large width # as beamers, as we have encountered such devices in the wild. However, we might have just a large TV connected # that is intended to be used just like a beamer to present the screen to the audience. So if we have a screen # that is at least 70cm wide and the other one is no wider than 55cm we treat this as a beamer setup aswell. # The reasoning here is that if it were a dual screen setup, the screens should be roughly the same size. echo "Treating $MAYBEAMER as beamer as size difference is big enough" - BEAMER=$MAYBEAMER + B_INDEX=$MAYBEAMER fi - if [ -n "$BEAMER" ]; then - echo "${OUTPUTNAMES[$BEAMER]} is a beamer. " + if [ -n "$B_INDEX" ]; then + BEAMER=${OUTPUTNAMES[$B_INDEX]} + OTHER=${OUTPUTNAMES[$(( 1 - B_INDEX ))]} + + echo "$BEAMER is a beamer. " # Create all modes, so that X knows them by name "<width>x<height>" # Add the modes to the outputs, this means that, if this action is @@ -149,26 +150,24 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then # Finally, if the EDID is present, apply a proper resolution. # Find out whether the beamer transmits reliable EDID data. # The data in xrandr should be reliable if the EDID is present. - if <<<"$XRANDRV" grep -Pzo \ - "\n${OUTPUTNAMES[$BEAMER]}\N*\n(\s+\N*\n)+" \ - | grep EDID > /dev/null ; then - echo "${OUTPUTNAMES[$BEAMER]} [Beamer] provides EDID." - - # If the breamer transmits the EDID there shall be a preferred resolution. - OPTIMALRES=$( <<<"$XRANDRV" grep -Pzo "\n${OUTPUTNAMES[$BEAMER]}\N*\n(\s+\N*\n)+" \ - | grep preferred | awk '{print $1}' ) + SUCCESS= + # If the beamer transmits the EDID there shall be a preferred resolution. + OPTIMALRES=$( <<<"$XRANDRV" grep -Pzo "\n$BEAMER\N*\n(\s+\N*\n)+" | grep -m 1 -a preferred | awk '{print $1}' ) + if [ -n "$OPTIMALRES" ] && <<<"$XRANDRV" grep -Pzo "\n$BEAMER\N*\n(\s+\N*\n)+" | grep -q EDID; then + echo "$BEAMER [Beamer] provides EDID, says $OPTIMALRES is optimal." # (try to) make sure the display has the preferred mode of the beamer added to it, in case it wasn't in our list from above - xrandr --current --addmode "${OUTPUTNAMES[$((1-$BEAMER))]}" "$OPTIMALRES" + xrandr --current --addmode "$OTHER" "$OPTIMALRES" # Apply the optimal resolution tho either of the outputs. The beamer has # to be the secondary output. if xrandr \ - --output "${OUTPUTNAMES[$((1-$BEAMER))]}" --mode "$OPTIMALRES" \ + --output "$OTHER" --mode "$OPTIMALRES" \ --primary \ - --output "${OUTPUTNAMES[$BEAMER]}" --mode "$OPTIMALRES" \ - --same-as "${OUTPUTNAMES[$((1-$BEAMER))]}" + --output "$BEAMER" --mode "$OPTIMALRES" \ + --same-as "$OTHER" then echo "Applied optimal resolution successfully." + SUCCESS=1 fi elif [[ -f "$CONFIGFILE" ]]; then @@ -178,36 +177,44 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then # Get local ip . /opt/openslx/config - # Try to get a probed mode - PROBEDMODE=$( <<<"$CONFIGFILE" grep "^\s*$SLX_PXE_CLIENT_IP" | cut -d '=' -f2 ) + # Try to get a forced mode from config + FORCED_MODE=$( <"$CONFIGFILE" grep -m 1 "^\\s*${SLX_PXE_CLIENT_IP}\\s*=" | cut -d '=' -f2 ) - # If a probed mode was found, .. - if [[ -n "$PROBEDMODE" ]]; then - echo "Probed mode found in config file." + # If a mode was found, .. + if [[ -n "$FORCED_MODE" ]]; then + echo "Forced mode found in config file." # Apply the probed mode from the config file if xrandr \ - --output "${OUTPUTNAMES[$((1-$BEAMER))]}" --mode "$PROBEDMODE" \ + --output "$OTHER" --mode "$FORCED_MODE" \ --primary \ - --output "${OUTPUTNAMES[$BEAMER]}" --mode "$PROBEDMODE" \ - --same-as "${OUTPUTNAMES[$((1-$BEAMER))]}" + --output "$BEAMER" --mode "$FORCED_MODE" \ + --same-as "$OTHER" then - echo "Applied probed mode successfully." + echo "Applied forced mode $FORCED_MODE successfully." + SUCCESS=1 fi else echo -e "\e[31mERROR: Beamer provides no EDID and no probed mode given in $CONFIGFILE.\e[0m" fi - else + fi + if [ -z "$SUCCESS" ]; then # Apply a fallback mode - echo -e "\e[31mERROR: Beamer provides no EDID and no config file found in $CONFIGFILE. Falling back to 1024x768.\e[0m" - xrandr \ - --output "${OUTPUTNAMES[$((1-$BEAMER))]}" --mode "1024x768" \ - --primary \ - --output "${OUTPUTNAMES[$BEAMER]}" --mode "1024x768" \ - --same-as "${OUTPUTNAMES[$((1-$BEAMER))]}" + # Maybe the screen has EDID, use its preferred resolution + OPTIMALRES=$( <<<"$XRANDRV" grep -Pzo "\n$OTHER\N*\n(\s+\N*\n)+" \ + | grep -m 1 -a preferred | awk '{print $1}' ) + for res in "$OPTIMALRES" "1280x800" "1280x720"; do + [ -z "$res" ] && continue + echo -e "\e[31mERROR: Beamer provides no EDID and no config found in $CONFIGFILE. Falling back to ${OPTIMALRES}.\e[0m" + xrandr \ + --output "$OTHER" --mode "$res" \ + --primary \ + --output "$BEAMER" --mode "$res" \ + --same-as "$OTHER" && break + done fi - else + else # $B_INDEX is empty # In case of two monitors just sort the outputs lexicographically and apply - # the preffered resolution + # the preferred resolution echo "Dualhead setup deteced. Sorting outputs lexicographically." readarray -t OUTPUTNAMES \ < <(for a in "${OUTPUTNAMES[@]}"; do echo "$a"; done | sort) @@ -221,7 +228,10 @@ if [ ${#OUTPUTNAMES[@]} -eq 2 ]; then echo "Successfully applied preferred modes on outputs in sorted order." fi fi + else echo -e "\e[32mOther than two outputs.\e[0m" fi +exit 0 + diff --git a/core/modules/beamergui/module.build b/core/modules/beamergui/module.build index 36175c34..a4735e85 100644 --- a/core/modules/beamergui/module.build +++ b/core/modules/beamergui/module.build @@ -6,19 +6,11 @@ fetch_source() { build() { local SRCDIR="${MODULE_WORK_DIR}/src/" - if [[ "$SYS_DISTRIBUTION" == "opensuse" && "$SYS_VERSION" == "13.2" ]]; then - QMAKE="/usr/$LIB64/qt4/bin/qmake" - else - QMAKE="$(which qmake-qt4)" - fi - - # first activate qt 4 - activate_qt 4 mkdir -p "$MODULE_BUILD_DIR/opt/openslx/bin" cd "${MODULE_BUILD_DIR}/opt/openslx/bin" || perror "Could not cd!" - pinfo "Running qmake" - "$QMAKE" "$SRCDIR/src/beamergui.pro" -r -spec linux-g++ || perror "'qmake-qt4' failed (e.g. not installed)." + pinfo "Running cmake" + cmake "$SRCDIR" || perror "'cmake $SRCDIR' failed." pinfo "Running make" make || perror "'make' failed." diff --git a/core/modules/beamergui/module.conf.ubuntu b/core/modules/beamergui/module.conf.ubuntu index c7c4e2c1..57fc742a 100644 --- a/core/modules/beamergui/module.conf.ubuntu +++ b/core/modules/beamergui/module.conf.ubuntu @@ -1,9 +1,12 @@ #!/bin/bash REQUIRED_INSTALLED_PACKAGES=" -libqt4-dev -libxrandr-dev + libqt5gui5 + libxrandr-dev + qt5-qmake + qtbase5-dev + qtbase5-dev-tools + qttools5-dev-tools " REQUIRED_CONTENT_PACKAGES=" -libqt4-dev -libxrandr-dev + libxrandr-dev " diff --git a/core/modules/busybox/module.build b/core/modules/busybox/module.build index ccaa29f8..6b93563b 100644 --- a/core/modules/busybox/module.build +++ b/core/modules/busybox/module.build @@ -1,7 +1,9 @@ #!/bin/bash fetch_source() { - git clone --depth 1 "${REQUIRED_GIT}" --branch "$REQUIRED_BRANCH" src || perror "Could not clone busybox git" + if ! [ -d "src/.git" ]; then + git clone --depth 1 "${REQUIRED_GIT}" --branch "$REQUIRED_BRANCH" src || perror "Could not clone busybox git" + fi cd src || perror "Could not cd to src" # Patch image centering and background filling if not patched yet if ! grep -q "bcenter_image" "miscutils/fbsplash.c"; then @@ -10,6 +12,9 @@ fetch_source() { if ! grep -q "bfill_background" "miscutils/fbsplash.c"; then git apply "${MODULE_DIR}/fbsplash-fillbg.patch" || perror "Could not apply busybox patch for fbsplash background filling" fi + if ! grep -q 'suspend.*"no"' "util-linux/rtcwake.c"; then + git apply "${MODULE_DIR}/rtcwake-compat.patch" || perror "Could not apply busybox patch for rtcwake compat with util-linux" + fi cd .. || perror "cd .. failed" } diff --git a/core/modules/busybox/openslx-busybox-config b/core/modules/busybox/openslx-busybox-config index 9f9db09b..3b58a9fa 100644 --- a/core/modules/busybox/openslx-busybox-config +++ b/core/modules/busybox/openslx-busybox-config @@ -599,7 +599,7 @@ CONFIG_FEATURE_MOUNT_FSTAB=y CONFIG_RDATE=y # CONFIG_RDEV is not set # CONFIG_READPROFILE is not set -# CONFIG_RTCWAKE is not set +CONFIG_RTCWAKE=y # CONFIG_SCRIPT is not set # CONFIG_SCRIPTREPLAY is not set # CONFIG_SETARCH is not set diff --git a/core/modules/busybox/rtcwake-compat.patch b/core/modules/busybox/rtcwake-compat.patch new file mode 100644 index 00000000..5b6ca615 --- /dev/null +++ b/core/modules/busybox/rtcwake-compat.patch @@ -0,0 +1,167 @@ +diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c +index 8aee0cf..6d6e168 100644 +--- a/util-linux/rtcwake.c ++++ b/util-linux/rtcwake.c +@@ -122,7 +122,7 @@ int rtcwake_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; + int rtcwake_main(int argc UNUSED_PARAM, char **argv) + { + unsigned opt; +- const char *rtcname = NULL; ++ const char *rtcname = "/dev/rtc0"; + const char *suspend = "standby"; + const char *opt_seconds; + const char *opt_time; +@@ -134,6 +134,9 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) + int utc = -1; + int fd; + ++ bool is_disable = false; ++ bool is_general_alarm = false; ++ + #if ENABLE_LONG_OPTS + static const char rtcwake_longopts[] ALIGN1 = + "auto\0" No_argument "a" +@@ -147,9 +150,10 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) + applet_long_options = rtcwake_longopts; + #endif + /* Must have -s or -t, exclusive */ +- opt_complementary = "s:t:s--t:t--s"; ++ opt_complementary = "s--t:t--s"; + opt = getopt32(argv, "alud:m:s:t:", &rtcname, &suspend, &opt_seconds, &opt_time); + ++ + /* this is the default + if (opt & RTCWAKE_OPT_AUTO) + utc = -1; +@@ -159,13 +163,16 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) + if (opt & RTCWAKE_OPT_SECONDS) { + /* alarm time, seconds-to-sleep (relative) */ + seconds = xatou(opt_seconds); +- } else { +- /* RTCWAKE_OPT_TIME */ ++ } else if (opt & RTCWAKE_OPT_TIME) { + /* alarm time, time_t (absolute, seconds since 1/1 1970 UTC) */ + if (sizeof(alarm_time) <= sizeof(long)) + alarm_time = xatol(opt_time); + else + alarm_time = xatoll(opt_time); ++ } else if (strcmp(suspend, "disable") == 0) { ++ is_disable = true; ++ } else { ++ bb_show_usage(); + } + + if (utc == -1) +@@ -177,43 +184,51 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) + /* this RTC must exist and (if we'll sleep) be wakeup-enabled */ + fd = rtc_xopen(&rtcname, O_RDONLY); + +- if (strcmp(suspend, "on") != 0) +- if (!may_wakeup(rtcname)) +- bb_error_msg_and_die("%s not enabled for wakeup events", rtcname); ++ if (!is_disable) { + +- /* relative or absolute alarm time, normalized to time_t */ +- sys_time = time(NULL); +- { +- struct tm tm_time; +- rtc_read_tm(&tm_time, fd); +- rtc_time = rtc_tm2time(&tm_time, utc); +- } ++ if (strcmp(suspend, "on") != 0) ++ if (!may_wakeup(rtcname)) ++ bb_error_msg_and_die("%s not enabled for wakeup events", rtcname); ++ ++ /* relative or absolute alarm time, normalized to time_t */ ++ sys_time = time(NULL); ++ { ++ struct tm tm_time; ++ rtc_read_tm(&tm_time, fd); ++ rtc_time = rtc_tm2time(&tm_time, utc); ++ } ++ ++ if (opt & RTCWAKE_OPT_TIME) { ++ /* Correct for RTC<->system clock difference */ ++ alarm_time += rtc_time - sys_time; ++ if (alarm_time < rtc_time) ++ /* ++ * Compat message text. ++ * I'd say "RTC time is already ahead of ..." instead. ++ */ ++ bb_error_msg_and_die("time doesn't go backward to %s", ctime(&alarm_time)); ++ } else ++ alarm_time = rtc_time + seconds + 1; ++ ++ is_general_alarm = (rtc_time + (24 * 60 * 60)) > alarm_time; + +- if (opt & RTCWAKE_OPT_TIME) { +- /* Correct for RTC<->system clock difference */ +- alarm_time += rtc_time - sys_time; +- if (alarm_time < rtc_time) +- /* +- * Compat message text. +- * I'd say "RTC time is already ahead of ..." instead. +- */ +- bb_error_msg_and_die("time doesn't go backward to %s", ctime(&alarm_time)); +- } else +- alarm_time = rtc_time + seconds + 1; +- +- setup_alarm(fd, &alarm_time, rtc_time); +- sync(); ++ setup_alarm(fd, &alarm_time, rtc_time); ++ sync(); + #if 0 /*debug*/ +- printf("sys_time: %s", ctime(&sys_time)); +- printf("rtc_time: %s", ctime(&rtc_time)); ++ printf("sys_time: %s", ctime(&sys_time)); ++ printf("rtc_time: %s", ctime(&rtc_time)); + #endif +- printf("wakeup from \"%s\" at %s", suspend, ctime(&alarm_time)); +- fflush_all(); +- usleep(10 * 1000); ++ printf("wakeup from \"%s\" at %s", suspend, ctime(&alarm_time)); ++ fflush_all(); ++ usleep(10 * 1000); ++ } + +- if (strcmp(suspend, "on") != 0) +- xopen_xwrite_close(SYS_POWER_PATH, suspend); +- else { ++ if (is_disable) { ++ printf("disabling current alarm\n"); ++ } else if (strcmp(suspend, "no") == 0) { ++ printf("just setting alarm, no powersaving mode requested\n"); ++ goto at_exit; ++ } else if (strcmp(suspend, "on") == 0) { + /* "fake" suspend ... we'll do the delay ourselves */ + unsigned long data; + +@@ -224,10 +239,27 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) + break; + } + } while (!(data & RTC_AF)); ++ } else { ++ xopen_xwrite_close(SYS_POWER_PATH, suspend); + } + +- xioctl(fd, RTC_AIE_OFF, 0); ++ if (!is_general_alarm || is_disable) { ++ struct linux_rtc_wkalrm wake; ++ if (ioctl(fd, RTC_WKALM_RD, &wake) < 0) { ++ printf("read rtc alarm failed\n"); ++ } else { ++ wake.enabled = 0; ++ if (ioctl(fd, RTC_WKALM_SET, &wake) < 0) { ++ printf("disable rtc alarm interrupt failed\n"); ++ } ++ } ++ ++ } ++ if (is_general_alarm || is_disable) { ++ xioctl(fd, RTC_AIE_OFF, 0); ++ } + ++at_exit:; + if (ENABLE_FEATURE_CLEAN_UP) + close(fd); + diff --git a/core/modules/cups/module.conf.ubuntu.17 b/core/modules/cups/module.conf.ubuntu.17 new file mode 100644 index 00000000..2c394fad --- /dev/null +++ b/core/modules/cups/module.conf.ubuntu.17 @@ -0,0 +1,23 @@ +#!/bin/bash +REQUIRED_INSTALLED_PACKAGES=" + cups + cups-daemon + cups-filters + cups-core-drivers + cups-filters-core-drivers + ghostscript + libgs9-common +" +REQUIRED_CONTENT_PACKAGES=" + cups + cups-daemon + cups-filters + cups-core-drivers + cups-filters-core-drivers + ghostscript + libgs9-common +" +REQUIRED_DIRECTORIES+=" + /usr/share/color +" + diff --git a/core/modules/dbus/module.conf.ubuntu.17 b/core/modules/dbus/module.conf.ubuntu.17 new file mode 100644 index 00000000..159cc642 --- /dev/null +++ b/core/modules/dbus/module.conf.ubuntu.17 @@ -0,0 +1,10 @@ +#!/bin/bash +REQUIRED_CONTENT_PACKAGES=" + dbus + dbus-x11 +" +REQUIRED_FILES+=" +" +REQUIRED_DIRECTORIES=" + /usr/share/dbus-1 +" diff --git a/core/modules/debug-report-bwlp/data/opt/openslx/bin/debug_report b/core/modules/debug-report-bwlp/data/opt/openslx/bin/debug_report index 0a361c6d..3f59bce4 100755 --- a/core/modules/debug-report-bwlp/data/opt/openslx/bin/debug_report +++ b/core/modules/debug-report-bwlp/data/opt/openslx/bin/debug_report @@ -89,9 +89,23 @@ echo -n "." systemctl status > "generated/systemctl-status-out" 2> "generated/systemctl-status-err" echo -n "." +systemd-analyze plot > "generated/systemd-plot.svg" 2> "generated/systemd-plot.err" +echo -n "." + ps auxf > "generated/ps-out" 2> "generated/ps-err" echo -n "." +if [ -z "$DISPLAY" ]; then + DISPLAY=:0 + XAUTHORITY=$(ps a | grep " $DISPLAY " | grep -o -- '-auth.*$' | grep -m1 -v grep | awk '{print $2}') +fi +if [ -n "$XAUTHORITY" ]; then + export DISPLAY + export XAUTHORITY + xrandr --verbose > "generated/xrandr-out" 2> "generated/xrandr-err" + echo -n "." +fi + find generated/ -type f -name "*-err" -size 0 -delete > /dev/null 2>/dev/null echo "..fertig!" diff --git a/core/modules/dhcpc-busybox/data/etc/systemd/system/udhcpc@.service b/core/modules/dhcpc-busybox/data/etc/systemd/system/udhcpc@.service index 6c2061a0..d797dd4b 100644 --- a/core/modules/dhcpc-busybox/data/etc/systemd/system/udhcpc@.service +++ b/core/modules/dhcpc-busybox/data/etc/systemd/system/udhcpc@.service @@ -4,7 +4,7 @@ After=systemd-tmpfiles-setup.service [Service] Type=forking -PIDFile=/run/udhcpc/udhcpc.%I.pid -ExecStart=/opt/openslx/scripts/systemd-udhcpc++ %I -ExecStopPost=/opt/openslx/bin/rm /run/udhcpc/udhcpc.%I.pid +PIDFile=/run/udhcpc/udhcpc.%i.pid +ExecStart=/opt/openslx/scripts/systemd-udhcpc++ %i +ExecStopPost=/opt/openslx/bin/rm /run/udhcpc/udhcpc.%i.pid diff --git a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx index 13de9ff4..d0fb2410 100755 --- a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx +++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx @@ -112,8 +112,8 @@ case "$1" in # Search domains if [ -n "$search" ]; then printf -v CONF "${CONF}search $search\n" - elif [ -n "$SLX_SEARCH_DOMAIN" ]; then - printf -v CONF "${CONF}search $SLX_SEARCH_DOMAIN\n" + elif [ -n "$SLX_NET_SEARCH" ]; then + printf -v CONF "${CONF}search $SLX_NET_SEARCH\n" elif [ -n "$SLX_NET_DOMAIN" ]; then printf -v CONF "${CONF}search $SLX_NET_DOMAIN\n" fi diff --git a/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/dnbd3-proxy.service b/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/dnbd3-proxy.service new file mode 100644 index 00000000..5896a1db --- /dev/null +++ b/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/dnbd3-proxy.service @@ -0,0 +1,11 @@ +[Unit] +Description=DNBD3 proxy server +After=setup-dnbd3-proxy.service + +[Service] +User=dnbd3 +ExecStart=/opt/openslx/scripts/systemd-dnbd3_proxy +Restart=always +RestartSec=3 +TimeoutStopSec=10 +LimitNOFILE=65536 diff --git a/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/dnbd3-proxy.target b/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/dnbd3-proxy.target new file mode 100644 index 00000000..2d96a143 --- /dev/null +++ b/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/dnbd3-proxy.target @@ -0,0 +1,4 @@ +[Unit] +Description=DNBD3 server running +Requires=multi-user.target +After=multi-user.target diff --git a/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/dnbd3-proxy.target.requires/dnbd3-proxy.service b/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/dnbd3-proxy.target.requires/dnbd3-proxy.service new file mode 100644 index 00000000..5c401615 --- /dev/null +++ b/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/dnbd3-proxy.target.requires/dnbd3-proxy.service @@ -0,0 +1,10 @@ +[Unit] +Description=DNBD3 proxy server +After=network.target multi-user.target setup-dnbd3-proxy.service + +[Service] +User=dnbd3 +ExecStart=/opt/openslx/bin/dnbd3-server -n -c /etc/dnbd3 +Restart=always +RestartSec=1 +TimeoutStopSec=10 diff --git a/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/dnbd3-proxy.target.requires/setup-dnbd3-proxy.service b/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/dnbd3-proxy.target.requires/setup-dnbd3-proxy.service new file mode 100644 index 00000000..194db999 --- /dev/null +++ b/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/dnbd3-proxy.target.requires/setup-dnbd3-proxy.service @@ -0,0 +1,7 @@ +[Unit] +Description=Setup DNBD3 proxy server +After=network.target multi-user.target + +[Service] +Type=oneshot +ExecStart=/opt/openslx/scripts/systemd-setup_dnbd3_proxy diff --git a/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/setup-dnbd3-proxy.service b/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/setup-dnbd3-proxy.service new file mode 100644 index 00000000..a7e6daa4 --- /dev/null +++ b/core/modules/dnbd3-proxy-mode/data/etc/systemd/system/setup-dnbd3-proxy.service @@ -0,0 +1,8 @@ +[Unit] +Description=DNBD3 proxy server config generator +After=setup-partitions.service + +[Service] +Type=oneshot +ExecStart=/opt/openslx/scripts/systemd-setup_dnbd3_proxy +RemainAfterExit=true diff --git a/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-dnbd3_proxy b/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-dnbd3_proxy new file mode 100755 index 00000000..4fbe1e6b --- /dev/null +++ b/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-dnbd3_proxy @@ -0,0 +1,12 @@ +#!/bin/ash + +ERRLOG="/run/dnbd3-proxy.err" + +if [ -s "$ERRLOG" ]; then + exec $(which dnbd3-server) -n --errormsg "$(cat "$ERRLOG")" -c /etc/dnbd3-server +fi + +exec $(which dnbd3-server) -n -c /etc/dnbd3-server + +exit 1 + diff --git a/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy b/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy new file mode 100755 index 00000000..d39cbbc2 --- /dev/null +++ b/core/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy @@ -0,0 +1,166 @@ +#!/bin/ash +# This scripts runs as root and prepares the configuration +# for the dnbd3 server (...) + +ERRLOG="/run/dnbd3-proxy.err" + +[ -s "$ERRLOG" ] && exit 0 # already ran and failed, don't do it again + +errormsg () { + echo "$@" >> "$ERRLOG" + slxlog -s -e "dnbd3-setup" "$@" +} + +# Get size of disk/device at given path, in kb +disksize () { + df -k "$1" | tail -n 1 | awk '{print $2}' +} + +# Creates the DNBD3 server configuration under DNBD3_CONF_DIR +DNBD3_CONF_DIR="/etc/dnbd3-server" +if ! mkdir -p "${DNBD3_CONF_DIR}"; then + errormsg "Failed to create '${DNBD3_CONF_DIR}'." +fi + +# Checks if the persistent partition (MBR-ID 45 / GPT-LABEL OpenSLX-ID45) +# is present, fallback to /tmp +DNBD3_BASE_DIR="/opt/openslx/persistent" +if grep -q "^/dev/.* ${DNBD3_BASE_DIR} .*rw" /proc/mounts \ + && [ -k "${DNBD3_BASE_DIR}/data" ] \ + && [ "$(disksize "${DNBD3_BASE_DIR}/data")" -gt 40000000 ]; then + # setup_partitions creates a data folder in ID45 + DNBD3_BASE_DIR="${DNBD3_BASE_DIR}/data" +else + # try /tmp fallback + DNBD3_BASE_DIR="/tmp" + if ! grep -q '^/dev/.* '"${DNBD3_BASE_DIR}"' .*rw' /proc/mounts \ + || [ "$(disksize "${DNBD3_BASE_DIR}")" -lt 40000000 ]; then + # no sane fallback possible + errormsg "Neither a persistent part (ID45) nor /tmp (ID44) are available, or they are < 40GB" + fi +fi +# now try to create the actual folder used by the server +DNBD3_DATA_DIR="${DNBD3_BASE_DIR}/dnbd3" +if ! mkdir -p "${DNBD3_DATA_DIR}"; then + for i in 0 1 2 3 4 5 $RANDOM $RANDOM; do + if mkdir -p "${DNBD3_BASE_DIR}/dnbd3.$i"; then + DNBD3_DATA_DIR="${DNBD3_BASE_DIR}/dnbd3.$i" + break + fi + done +fi + +if [ ! -d "${DNBD3_DATA_DIR}" ]; then + errormsg "Failed to create '${DNBD3_BASE_DIR}(.[0-$i])'" +fi +if ! chown -R dnbd3:dnbd3 "${DNBD3_DATA_DIR}"; then + errormsg "Failed to chown '${DNBD3_DATA_DIR}' to dnbd3." +fi +if ! chmod -R go-w,u+rwX "${DNBD3_DATA_DIR}"; then + errormsg "Failed to chmod '${DNBD3_DATA_DIR}' to dnbd3." +fi + +# Done with sanity checks, now create configs: server.conf & alt-servers +# Using the information given by the server in /opt/openslx/config +. /opt/openslx/config + +DNBD3_BGR="false" +DNBD3_LOOKUP="false" +DNBD3_SERVER_PENALTY=2000 # no BGR = don't like other servers connecting so much +if [ -n "${SLX_DNBD3_BGR}" ]; then + DNBD3_BGR="true" + DNBD3_SERVER_PENALTY=500 # much better + # Only do chained lookup of image if we're a global proxy with BGR + [ -z "${SLX_DNBD3_WHITELIST}" ] && DNBD3_LOOKUP="true" +fi +DNBD3_PORT=5003 +rm -f "${DNBD3_CONF_DIR}/server.conf" +# Refer to http://git.openslx.org/dnbd3.git/tree/conf for configuration options +cat << EOF > "${DNBD3_CONF_DIR}/server.conf" +[dnbd3] +listenPort=${DNBD3_PORT} +basePath=${DNBD3_DATA_DIR} +serverPenalty=${DNBD3_SERVER_PENALTY} +clientPenalty=0 +isProxy=true +backgroundReplication=${DNBD3_BGR} +lookupMissingForProxy=${DNBD3_LOOKUP} +removeMissingImages=false +uplinkTimeout=5000 +clientTimeout=15000 + +[logging] +consoleMask=ERROR WARNING MINOR INFO +EOF + +MY_IPS=$(ip a | grep '^\s*inet\s' | awk '{print $2}') + +# helper to echo given list of IPs to ${DNBD3_CONF_DIR}/alt-servers +# optionally takes a single char prefix as first param and +# adds it to the IP (for private dnbd3 servers) +# Also sets FOUND_SAT if satellite IP was seen +add_alt_server() { + local PRE= + [ "x$1" = "x-" ] && PRE='-' && shift + for ALT in "$@"; do + for ip in $MY_IPS; do + [ "x$ALT" = "x${ip%/*}" ] && return 0 # Ignore self + done + echo "${PRE}${ALT}" >> "${DNBD3_CONF_DIR}/alt-servers" + [ "x${ALT}" = "x${SLX_PXE_SERVER_IP}" ] && FOUND_SAT="oui" + done + return 0 +} + +rm -f "${DNBD3_CONF_DIR}/alt-servers" +FOUND_SAT= +add_alt_server ${SLX_DNBD3_PUBLIC} +add_alt_server '-' ${SLX_DNBD3_PRIVATE} +# To this day, only the sat IP is in SLX_KCL_SERVERS afaik +[ -z "${FOUND_SAT}" ] && add_alt_server ${SLX_KCL_SERVERS} +chmod -R a+Xr "${DNBD3_CONF_DIR}" + +# create rpc.acl to allow the satellite only +rm -f "${DNBD3_CONF_DIR}/rpc.acl" +for SRV in ${SLX_KCL_SERVERS}; do + echo "$SRV ALL" >> "${DNBD3_CONF_DIR}/rpc.acl" +done + +rm -f "/opt/openslx/iptables/rules.d/99-dnbd3" +# now create iptables helper rules +if [ -n "${SLX_DNBD3_WHITELIST}" ]; then + DNBD3_IPTABLES_CONF="$(mktemp)" + echo '#!/bin/ash' > "${DNBD3_IPTABLES_CONF}" + for CIDR in ${SLX_DNBD3_WHITELIST}; do + echo "iptables -I ipt-helper-INPUT 1 -i br0 -p tcp -s ${CIDR} --dport ${DNBD3_PORT} -j ACCEPT" + done >> "${DNBD3_IPTABLES_CONF}" + echo "iptables -A ipt-helper-INPUT -i br0 -p tcp --dport ${DNBD3_PORT} -j REJECT" >> "${DNBD3_IPTABLES_CONF}" + chmod +x "${DNBD3_IPTABLES_CONF}" + mv -f "$DNBD3_IPTABLES_CONF" "/opt/openslx/iptables/rules.d/99-dnbd3" +fi + +( + echo "*******************" + echo "*** DNBD3 Proxy ***" + echo "*******************" +) | tee -a "/etc/issue" >> "/opt/openslx/etc/issue.template" + +# Create a crontab for rebooting - if everything is fine, once a weekend, +# on failure, reboot every night, hoping things will get better (...) +M=$(( RANDOM % 60 )) +H=$(( RANDOM % 5 )) +if [ -s "$ERRLOG" ]; then + W="*" +else + W="0" +fi +cat > "/etc/cron.d/dnbd3-reboot" <<EOF +# OpenSLX: Reboot proxy at night +SHELL=/bin/ash +PATH=/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin + +$M $H * * $W root reboot +EOF + +exit 0 + diff --git a/core/modules/dnbd3-proxy-mode/module.build b/core/modules/dnbd3-proxy-mode/module.build new file mode 100644 index 00000000..a2c0bd22 --- /dev/null +++ b/core/modules/dnbd3-proxy-mode/module.build @@ -0,0 +1,13 @@ +#!/bin/bash +fetch_source() { + : +} + +build() { + : +} + +post_copy() { + add_group "dnbd3" + USER="dnbd3" GROUP="dnbd3" add_user +} diff --git a/core/modules/dnbd3-proxy-mode/module.conf b/core/modules/dnbd3-proxy-mode/module.conf new file mode 100644 index 00000000..3ba16fc0 --- /dev/null +++ b/core/modules/dnbd3-proxy-mode/module.conf @@ -0,0 +1,2 @@ +#!/bin/bash +# Nothing - static module diff --git a/core/modules/dnbd3/module.build b/core/modules/dnbd3/module.build index f1df5549..ff614dd4 100644 --- a/core/modules/dnbd3/module.build +++ b/core/modules/dnbd3/module.build @@ -34,14 +34,15 @@ build() { cmake \ -DBUILD_FUSE_CLIENT=ON \ -DBUILD_KERNEL_MODULE=ON \ - -DBUILD_SERVER=OFF \ + -DBUILD_SERVER=ON \ -DBUILD_STRESSTEST=OFF \ "$MODULE_WORK_DIR/src/dnbd3" || perror "Could not cmake" make dnbd3-client || perror "Could not make dnbd3-client" make dnbd3-fuse || perror "Could not make dnbd3-fuse" - chown root:root "dnbd3-client" "dnbd3-fuse" + make dnbd3-server || perror "Could not make dnbd3-server" + chown root:root "dnbd3-client" "dnbd3-fuse" "dnbd3-server" chmod +xs "dnbd3-client" - chmod +x "dnbd3-fuse" + chmod +x "dnbd3-fuse" "dnbd3-server" cd "$MODULE_WORK_DIR" COPYLIST="list_dpkg_output" diff --git a/core/modules/dnbd3/module.conf b/core/modules/dnbd3/module.conf index 0fd2e58c..cdcb757c 100644 --- a/core/modules/dnbd3/module.conf +++ b/core/modules/dnbd3/module.conf @@ -9,6 +9,7 @@ REQUIRED_BINARIES=" dnbd3-client dnbd3-fuse fusermount + dnbd3-server " REQUIRED_DIRECTORIES=" /lib/modules diff --git a/core/modules/dnbd3/module.conf.ubuntu b/core/modules/dnbd3/module.conf.ubuntu index a6d63345..9794054b 100644 --- a/core/modules/dnbd3/module.conf.ubuntu +++ b/core/modules/dnbd3/module.conf.ubuntu @@ -1,12 +1,13 @@ #!/bin/bash REQUIRED_CONTENT_PACKAGES=" - cmake - fuse + cmake + fuse " REQUIRED_INSTALLED_PACKAGES=" - cmake - zlib1g-dev - libfuse-dev - fuse + cmake + zlib1g-dev + libfuse-dev + fuse + libjansson-dev " diff --git a/core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service b/core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service index ca31c695..1f893ab1 100644 --- a/core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service +++ b/core/modules/hardware-stats/data/etc/systemd/system/hardware-stats.service @@ -1,7 +1,7 @@ [Unit] Description=Gather statistics about this machine and send to boot server DefaultDependencies=no -After=tmp.target +After=tmp.target mount-vm-store.service Wants=tmp.target [Service] diff --git a/core/modules/hardware-stats/data/etc/systemd/system/shutdown-usage-log.service b/core/modules/hardware-stats/data/etc/systemd/system/shutdown-usage-log.service index fc65fe9f..ef51e6f2 100644 --- a/core/modules/hardware-stats/data/etc/systemd/system/shutdown-usage-log.service +++ b/core/modules/hardware-stats/data/etc/systemd/system/shutdown-usage-log.service @@ -1,5 +1,5 @@ [Unit] -Description=Gather statistics about this machine and send to boot server +Description=Tell server we're shuttong down DefaultDependencies=no Before=shutdown.target RefuseManualStart=yes diff --git a/core/modules/hardware-stats/data/etc/systemd/system/sleep.target.wants/stats-resume.service b/core/modules/hardware-stats/data/etc/systemd/system/sleep.target.wants/stats-resume.service new file mode 120000 index 00000000..d22600a3 --- /dev/null +++ b/core/modules/hardware-stats/data/etc/systemd/system/sleep.target.wants/stats-resume.service @@ -0,0 +1 @@ +../stats-resume.service
\ No newline at end of file diff --git a/core/modules/hardware-stats/data/etc/systemd/system/sleep.target.wants/stats-suspend.service b/core/modules/hardware-stats/data/etc/systemd/system/sleep.target.wants/stats-suspend.service new file mode 120000 index 00000000..b9132bba --- /dev/null +++ b/core/modules/hardware-stats/data/etc/systemd/system/sleep.target.wants/stats-suspend.service @@ -0,0 +1 @@ +../stats-suspend.service
\ No newline at end of file diff --git a/core/modules/hardware-stats/data/etc/systemd/system/stats-resume.service b/core/modules/hardware-stats/data/etc/systemd/system/stats-resume.service new file mode 100644 index 00000000..77228f4a --- /dev/null +++ b/core/modules/hardware-stats/data/etc/systemd/system/stats-resume.service @@ -0,0 +1,11 @@ +[Unit] +Description=Tell server we woke up from suspend +DefaultDependencies=no +After=systemd-suspend.service systemd-hybrid-sleep.service systemd-hibernate.service +RefuseManualStart=true + +[Service] +Type=oneshot +ExecStart=/opt/openslx/scripts/systemd-hws_standby resume +RemainAfterExit=no + diff --git a/core/modules/hardware-stats/data/etc/systemd/system/stats-suspend.service b/core/modules/hardware-stats/data/etc/systemd/system/stats-suspend.service new file mode 100644 index 00000000..cd0706cd --- /dev/null +++ b/core/modules/hardware-stats/data/etc/systemd/system/stats-suspend.service @@ -0,0 +1,11 @@ +[Unit] +Description=Tell server we're about to suspend the system +DefaultDependencies=no +Before=sleep.target +RefuseManualStart=true + +[Service] +Type=oneshot +ExecStart=/opt/openslx/scripts/systemd-hws_standby suspend +RemainAfterExit=no + diff --git a/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats b/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats index 9e959ecb..af475741 100755 --- a/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats +++ b/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hardware_stats @@ -49,12 +49,13 @@ cleanup() { done < "/tmp/hw-delete-list" } -fdisk() { +slxfdisk() { local binary RET for binary in "/opt/openslx/sbin/fdisk" "busybox fdisk" "fdisk"; do $binary "$@" RET=$? [ "$RET" = "127" ] && continue # command not found + [ "$RET" = "1" ] && [ "$binary" = "busybox fdisk" ] && continue # maybe applet not found return $RET done return 127 @@ -76,16 +77,20 @@ if [ "${#BOOTIF}" -ne "20" ]; then fi fi MAC=${BOOTIF:3} +echo "Determined MAC=$MAC" # 2) Get machine UUID, with fallback to MAC address if it fails for some reason, or if the UUID is blacklisted UUID=$(cat /etc/system-uuid) if [ -z "$UUID" ] || [ "${#UUID}" -ne "36" ]; then UUID=$(dmidecode -q -s system-uuid | grep -v '^#' | head -n 1 | tr '[a-z]' '[A-Z]') + echo "$UUID" > /etc/system-uuid fi if [ "${#UUID}" -ne "36" ]; then echo "Determined UUID (${UUID}) has not expected length of 36, falling back to MAC..." - UUID="000000000000000-$BOOTIF" + UUID="000000000000001-$BOOTIF" + echo "$UUID" > /etc/system-uuid fi +echo "UUID=$UUID" # 3) Uptime in seconds UPTIME=$(grep -o -E '^[0-9]+' /proc/uptime) @@ -105,9 +110,11 @@ fi if [ -z "$CPUCORES" ] || [ "$CPUCORES" = "0" ]; then CPUCORES=$(grep -E -e '^core id\s*:' -e '^physical\s*:' /proc/cpuinfo | xargs -l2 echo | sort -u | wc -l) fi +echo "$CPUCORES real cores, $VCORES with HT" # 5) CPU model name CPUMODEL=$(grep -m1 '^model name\s*:' /proc/cpuinfo | sed 's/^model name\s*:\s*//;s/\s\s*/ /g;s/^ //;s/ $//') +echo "$CPUMODEL" # 6) RAM RAM=$(grep -m1 '^MemTotal:' /proc/meminfo | awk '{print $2}') @@ -119,11 +126,13 @@ if [ -z "$RAM" ] || [ "$RAM" -lt 500 ]; then RAM=$(( $RAM + $c )) done fi +echo "$RAM MB RAM" # 7) 64bit virtualization support VT="UNSUPPORTED" VIRTTYPE=$(grep -m1 '^flags\s*:' /proc/cpuinfo | grep -wo -e svm -e vmx) [ -n "$VIRTTYPE" ] && modprobe msr +echo "Virtualization technology: $VIRTTYPE" if [ "$VIRTTYPE" = "vmx" ]; then # intel BIT1=$(rdmsr --bitfield 0:0 0x3a 2>/dev/null || echo "fail") @@ -145,6 +154,7 @@ elif [ "$VIRTTYPE" = "svm" ]; then # amd VT="DISABLED" fi fi +echo "$VIRTTYPE is $VT" # 8) ID44 partition size ID44=0 @@ -155,8 +165,8 @@ if [ -n "${df_size}" ] && [ "${df_dev:0:5}" = "/dev/" ]; then ID44=$(( df_size / 1024 )) fi if [ "$ID44" = 0 ]; then - # fdisk fallback - for c in $(fdisk -l | grep -E '[0-9]+[\-\+]?\s+44\s+' | awk '{print $1}'); do + # slxfdisk fallback + for c in $(slxfdisk -l | grep -E '[0-9]+[\-\+]?\s+44\s+' | awk '{print $1}'); do val=$(blockdev --getsize64 "$c") [ -z "$val" ] && continue [ "$val" -gt "$ID44" ] && ID44=$val @@ -164,10 +174,11 @@ if [ "$ID44" = 0 ]; then # blockdev reports bytes, convert to MB ID44=$(( $ID44 / 1058576 )) # we'd rather underreport fi +echo "Temp partition: $ID44 MB" # 9) check smart values FDISK=$(mktemp) -fdisk -l > "$FDISK" +slxfdisk -l > "$FDISK" BADSECTORS=0 if which smartctl; then ALLSMART=$(mktemp) @@ -198,6 +209,7 @@ if which smartctl; then done rm -f -- "$FILE" fi +echo "SMART: $OVERALL - $REALLOC reallocated, $PENDING pending" # A) Read system model and manufacturer dmidec() { @@ -222,6 +234,7 @@ MODEL="$HW_MODEL" if [ "$HW_MANUF" != "Unknown" ]; then MODEL="$MODEL ($HW_MANUF)" fi +echo "System model: $MODEL" # n) Dump raw data to a file DATAFILE=$(mktemp) @@ -250,6 +263,7 @@ fi cat >> "$DATAFILE" <<-EOF ######################### EOF +echo "Created report file" [ -n "$ALLSMART" ] && rm -f -- "$ALLSMART" @@ -274,28 +288,73 @@ HW_CORES='${CPUCORES}' HW_THREADS='${VCORES}' HORST +# Build warning logfile (for lightdm) +buildlogfile() { + . /run/hwinfo + exec 4> /run/hw-warnings.log + CONTACT_RZ= + if [ "$HW_KVM" = "DISABLED" ]; then + echo "ff0000" "* 64Bit-Gast-Support (VT-x oder AMD-V) ist im BIOS deaktiviert. 64Bit VMs können nicht gestartet werden." >&4 + CONTACT_RZ=jau + elif [ "$HW_KVM" = "UNSUPPORTED" ]; then + echo "000000" "* CPU hat keinen 64Bit-Gast-Support (VT-x oder AMD-V). 64Bit VMs können nicht gestartet werden." >&4 + fi + if [ -n "$HW_MBRAM" ] && [ "$HW_MBRAM" -lt 3400 ]; then + local GB=$(( ( HW_MBRAM + 300 ) / 1024 )) + echo "000000" "* Dieser PC hat wenig RAM (${GB}GB). Die Leistung von VM-Sitzungen wird nicht optimal sein." >&4 + fi + if [ "$HW_ID44" = "0" ]; then + echo "000000" "* Keine ID44-Partition gefunden. VMs bekommen wenig RAM zugewiesen." >&4 + if [ "$HW_HDDCOUNT" = "0" ]; then + echo "000000" " Keine Festplatte erkannt; eine Festplatte wird empfohlen, wenn Sie VMs nutzen wollen." >&4 + elif [ -n "$HW_HDDCOUNT" ]; then + CONTACT_RZ=klar + fi + if [ -n "$HW_MBRAM" ] && [ "$HW_MBRAM" -lt 4500 ]; then + echo "ff0000" " Da der PC wenig RAM hat, ist die Einrichtung einer ID44-Partition dringend zu empfehlen." >&4 + fi + elif [ -n "$HW_ID44" ] && [ "$HW_ID44" -lt 10000 ]; then + echo "000000" "* Die ID44-Partition ist sehr klein. VM-Sitzungen könnten nach einiger Zeit aus Speichermangel abstürzen." >&4 + CONTACT_RZ=fjeden + fi + if [ -n "$SLX_VM_NFS" ] && ! systemctl status mount-vm-store >/dev/null; then + echo "ff0000" "* Der VM-Store konnte nicht eingehängt werden. VMs können nicht gestartet werden." >&4 + echo "ff0000" " Versuchen Sie das Problem zu lösen, indem Sie den Computer neu starten." >&4 + fi + if [ -n "$CONTACT_RZ" ]; then + echo "000000" " -- " >&4 + echo "000000" " -- Wenden Sie sich ggf. an den bwLehrpool-Support Ihres Rechenzentrums -- " >&4 + fi +} + +buildlogfile & + # Fire away for DELAY in 1 1 0; do + echo "Submitting to $SLX_REMOTE_LOG" if curl --data-urlencode "type=~poweron" --data-urlencode "uuid=$UUID" --data-urlencode "macaddr=$MAC" \ --data-urlencode "uptime=$UPTIME" --data-urlencode "realcores=$CPUCORES" --data-urlencode "mbram=$RAM" \ --data-urlencode "kvmstate=$VT" --data-urlencode "cpumodel=$CPUMODEL" --data-urlencode "id44mb=$ID44" \ --data-urlencode "badsectors=$BADSECTORS" --data-urlencode "systemmodel=$MODEL" \ --data-urlencode "data@$DATAFILE" "$SLX_REMOTE_LOG" | grep -q "RESULT=0"; then + echo "Success" rm -f -- "$DATAFILE" START=$(( $RANDOM % 5 )) + DELAY=$(( $RANDOM % 15 )) cat > "/etc/cron.d/usage_stats" <<-EOF # Update usage statistics on server SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/openslx/sbin:/opt/openslx/bin - ${START}-59/5 * * * * root /opt/openslx/scripts/cron-system_usage_update + ${START}-59/5 * * * * root sleep ${DELAY}; /opt/openslx/scripts/cron-system_usage_update EOF touch "/etc/cron.d" # Sometimes, aufs doesn't update the mtime of dirs when creating files, # so cron would not rescan the cron directory cleanup exit 0 fi + echo "Failed..." sleep "$DELAY" done diff --git a/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hws_standby b/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hws_standby new file mode 100755 index 00000000..a92a004d --- /dev/null +++ b/core/modules/hardware-stats/data/opt/openslx/scripts/systemd-hws_standby @@ -0,0 +1,28 @@ +#!/bin/ash + +# Running as root? +touch "/run" || exit 2 + +ACTION=$1 + +if [ "x$ACTION" != "xresume" ] && [ "x$ACTION" != "xsuspend" ]; then + echo "Expecting resume or suspend as argument!" >&2 + exit 1 +fi + +. /opt/openslx/config + +UUID=$(cat /etc/system-uuid) + +for DELAY in 1 1 2 3 5 8 0; do + echo "Submitting to $SLX_REMOTE_LOG" + if curl --data-urlencode "type=~$ACTION" --data-urlencode "uuid=$UUID" "$SLX_REMOTE_LOG" | grep -q "RESULT=0"; then + echo "Success" + exit 0 + fi + echo "Failed..." + sleep "$DELAY" +done +echo "Giving up" >&2 +exit 1 + diff --git a/core/modules/idleaction/data/etc/systemd/system/basic.target.wants/idleaction-set_normal.service b/core/modules/idleaction/data/etc/systemd/system/basic.target.wants/idleaction-set_normal.service new file mode 120000 index 00000000..f6ff1d6b --- /dev/null +++ b/core/modules/idleaction/data/etc/systemd/system/basic.target.wants/idleaction-set_normal.service @@ -0,0 +1 @@ +../idleaction-set_normal.service
\ No newline at end of file diff --git a/core/modules/idleaction/data/etc/systemd/system/idleaction-set_normal.service b/core/modules/idleaction/data/etc/systemd/system/idleaction-set_normal.service new file mode 100644 index 00000000..af4df557 --- /dev/null +++ b/core/modules/idleaction/data/etc/systemd/system/idleaction-set_normal.service @@ -0,0 +1,10 @@ +[Unit] +Description=Setup next rtcwake +DefaultDependencies=no +RefuseManualStart=true + +[Service] +Type=oneshot +ExecStart=/opt/openslx/scripts/systemd-idleaction_init +RemainAfterExit=no + diff --git a/core/modules/idleaction/data/etc/systemd/system/idleaction-set_suspend.service b/core/modules/idleaction/data/etc/systemd/system/idleaction-set_suspend.service new file mode 100644 index 00000000..747d8a4c --- /dev/null +++ b/core/modules/idleaction/data/etc/systemd/system/idleaction-set_suspend.service @@ -0,0 +1,11 @@ +[Unit] +Description=Reset idletime and setup next rtcwake before suspend +DefaultDependencies=no +RefuseManualStart=true +Before=sleep.target + +[Service] +Type=oneshot +ExecStart=/opt/openslx/scripts/systemd-idleaction_init suspend +RemainAfterExit=no + diff --git a/core/modules/idleaction/data/etc/systemd/system/shutdown.target.wants/idleaction-set_normal.service b/core/modules/idleaction/data/etc/systemd/system/shutdown.target.wants/idleaction-set_normal.service new file mode 120000 index 00000000..f6ff1d6b --- /dev/null +++ b/core/modules/idleaction/data/etc/systemd/system/shutdown.target.wants/idleaction-set_normal.service @@ -0,0 +1 @@ +../idleaction-set_normal.service
\ No newline at end of file diff --git a/core/modules/idleaction/data/etc/systemd/system/sleep.target.wants/idleaction-set_suspend.service b/core/modules/idleaction/data/etc/systemd/system/sleep.target.wants/idleaction-set_suspend.service new file mode 120000 index 00000000..51286428 --- /dev/null +++ b/core/modules/idleaction/data/etc/systemd/system/sleep.target.wants/idleaction-set_suspend.service @@ -0,0 +1 @@ +../idleaction-set_suspend.service
\ No newline at end of file diff --git a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script index b7617940..5ae2432c 100755 --- a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script +++ b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script @@ -2,12 +2,26 @@ . /opt/openslx/config || exit 1 +CRONFILE="/etc/cron.d/idleaction-shutdown_schedule" + # If existent, no session is open. Will contain timestamp of last activity. # If not existent, at least one user is logged in -CRONFILE="/etc/cron.d/idleaction-shutdown_schedule" -IDLEHINT="/dev/shm/idlehint" +IDLEHINT="/run/openslx/idlehint" NOW=$(date +%s) +get_sessions() { + local LEGEND State Class + LEGEND= + loginctl --help 2>&1 | grep -q -- '--no-legend' && LEGEND="--no-legend" + for SESSION in $(loginctl $LEGEND | awk '{print $1}'); do + unset Display Remote State + eval $(loginctl -p State -p Class show-session "$SESSION") + if [ "$State" = "active" -o "$State" = "online" ] && [ "$Class" = "user" ]; then + echo "$SESSION" + fi + done +} + # # 1) Check for idle timeout # @@ -15,9 +29,9 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then # Logout timeout is set, see which users we should kick IS_IDLE=yes # get all sessions - SESSIONS=$(loginctl | awk '{print $1}') + SESSIONS=$(get_sessions) if [ -n "$SESSIONS" ]; then - TMP="/dev/shm/idlecheck.tmp" + TMP="/run/openslx/idlecheck.tmp" # Iterate over sessions for ses in $SESSIONS; do # Get information @@ -34,7 +48,9 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then # Now that we have DISPLAY and XAUTHORITY set, xprintidle should work if [ -z "$IDLE" ]; then # Try user's xauth - USRHOME=$(/usr/bin/getent passwd "$NAME" | awk -F ':' '{print $6}') + USERID=$(id -u "$NAME") + [ -z "$USERID" ] && USERID="$NAME" + USRHOME=$(/usr/bin/getent passwd "$USERID" | awk -F ':' '{print $6}') export XAUTHORITY="$USRHOME/.Xauthority" [ -f "$XAUTHORITY" ] && IDLE=$(xprintidle) fi @@ -76,10 +92,10 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then rm -f -- "$IDLEHINT" fi else - # No logout timeout is set, take shortcut for shutdown timeout (if set) - if [ -n "$SLX_SHUTDOWN_TIMEOUT" ]; then - SESSIONS=$(loginctl | wc -l) - if [ "$SESSIONS" = "0" ]; then + # No logout timeout is set, take shortcut for shutdown/suspend timeout (if set) + if [ -n "$SLX_SHUTDOWN_TIMEOUT" ] || [ -n "$SLX_SYSTEM_STANDBY_TIMEOUT" ]; then + SESSIONS=$(get_sessions) + if [ -z "$SESSIONS" ]; then [ ! -e "$IDLEHINT" ] && echo "$NOW" > "$IDLEHINT" else rm -f -- "$IDLEHINT" @@ -88,19 +104,26 @@ else fi # -# 2) Check for no-session-shutdown timeout +# 2) Check for no-session shutdown/suspend timeout # -if [ -n "${SLX_SHUTDOWN_TIMEOUT}" ] && [ "${SLX_SHUTDOWN_TIMEOUT}" -gt 0 ] && [ -e "$IDLEHINT" ]; then +if [ -e "$IDLEHINT" ]; then IDLE=$(cat "$IDLEHINT") [ "$IDLE" -gt "$NOW" ] && IDLE="$NOW" IDLE=$(( $NOW - $IDLE )) - if [ "$IDLE" -gt "$SLX_SHUTDOWN_TIMEOUT" ]; then - poweroff + if [ -n "${SLX_SHUTDOWN_TIMEOUT}" ] && [ "${SLX_SHUTDOWN_TIMEOUT}" -gt 0 ] && [ "$IDLE" -gt "$SLX_SHUTDOWN_TIMEOUT" ]; then + poweroff & + exit 0 + elif [ -n "${SLX_SYSTEM_STANDBY_TIMEOUT}" ] && [ "${SLX_SYSTEM_STANDBY_TIMEOUT}" -gt 0 ] && [ "$IDLE" -gt "$SLX_SYSTEM_STANDBY_TIMEOUT" ]; then + rm -f -- "$IDLEHINT" + if ! systemctl suspend; then + slxlog --sync "idleaction-no-suspend" "Client does not support standby/suspend, doing nothing" + fi + exit 0 fi fi # -# 3) Check for hard scheduled shutdown +# 3) Check for hard scheduled shutdown/reboot # # A cron file is created dynamically here so there's everything # in one module and you don't need to repack config.tgz @@ -111,28 +134,33 @@ invalid_time () return 0 } -if [ -n "$SLX_SHUTDOWN_SCHEDULE" -o -n "$SLX_REBOOT_SCHEDULE" ] && [ ! -e "$CRONFILE" ]; then - echo "# OpenSLX: Trigger poweroff at certain time of day" > "$CRONFILE" - echo "SHELL=/bin/ash" >> "$CRONFILE" - echo "PATH=/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin" >> "$CRONFILE" - echo "" >> "$CRONFILE" - for time in $SLX_SHUTDOWN_SCHEDULE; do - HOUR=${time%%:*} - MINUTE=${time##*:} - [ -z "$HOUR$MINUTE" ] && invalid_time && continue - [ "$HOUR" -lt 0 -o "$HOUR" -gt 23 ] && invalid_time && continue - [ "$MINUTE" -lt 0 -o "$MINUTE" -gt 59 ] && invalid_time && continue - echo "$MINUTE $HOUR * * * root /opt/openslx/scripts/idleaction-scheduled_action poweroff" >> "$CRONFILE" - done - # do it again for SLX_REBOOT_SCHEDULE - for time in $SLX_REBOOT_SCHEDULE; do +write_crontab () +{ + local ACTION time HOUR MINUTE + [ $# -lt 1 ] && return + ACTION=$1 + shift + for time in $*; do HOUR=${time%%:*} MINUTE=${time##*:} - [ -z "$HOUR$MINUTE" ] && invalid_time && continue + [ -z "$HOUR" -o -z "$MINUTE" ] && invalid_time && continue [ "$HOUR" -lt 0 -o "$HOUR" -gt 23 ] && invalid_time && continue [ "$MINUTE" -lt 0 -o "$MINUTE" -gt 59 ] && invalid_time && continue - echo "$MINUTE $HOUR * * * root /opt/openslx/scripts/idleaction-scheduled_action reboot" >> "$CRONFILE" + echo "$MINUTE $HOUR * * * root /opt/openslx/scripts/idleaction-scheduled_action $ACTION --time $time" >> "$CRONFILE" done +} + +if [ -n "$SLX_SHUTDOWN_SCHEDULE" -o -n "$SLX_REBOOT_SCHEDULE" ] && [ ! -e "$CRONFILE" ]; then + echo "# OpenSLX: Trigger poweroff/reboot at certain time of day" > "$CRONFILE" + echo "SHELL=/bin/ash" >> "$CRONFILE" + echo "PATH=/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin" >> "$CRONFILE" + echo "" >> "$CRONFILE" + write_crontab "poweroff" "$SLX_SHUTDOWN_SCHEDULE" + write_crontab "reboot" "$SLX_REBOOT_SCHEDULE" + # Might want to re-set rtcwake timestamp periodically + if [ -n "$SLX_WAKEUP_SCHEDULE" ]; then + echo "0 * * * * root /opt/openslx/scripts/systemd-idleaction_init" >> "$CRONFILE" + fi touch "/etc/cron.d" # Aufs bug where it won't update dir mtime when creating the file within fi diff --git a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_action b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_action index 5c5f2a06..57ffcc04 100755 --- a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_action +++ b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_action @@ -1,7 +1,7 @@ #!/bin/ash -if [ "$(whoami)" != "root" ]; then - echo "Only root can call this" +if ! touch "/run"; then + echo "Only root can call this" >&2 exit 1 fi @@ -12,15 +12,45 @@ if [ "$1" = "--detach" ]; then fi if [ $# -lt 1 ]; then - echo "$0 [--detach] <reboot|poweroff> [delay_minutes]" + echo "$0 [--detach] <reboot|poweroff> [delay_minutes]" >&2 exit 2 fi +DELAY= +TS= MODE=$1 -DELAY=$2 +shift + +while [ $# -gt 0 ]; do + if [ "$1" == "--time" ]; then + TS=$2 + shift + elif [ "$1" == "--delay" ]; then + DELAY=$2 + shift + else + break + fi + shift +done +[ -n "$1" ] && DELAY=$1 + +if [ -n "$TS" ]; then + # Sanity check for trigger by cron + # Sleep first so the clock has time to get adjusted + sleep 10 + NOW=$(date +%s) + SHOULD=$(date -d "today $TS" +%s) + DIFF=$(( NOW - SHOULD )) + DIFF=${DIFF#-} # DIFF = Abs($DIFF) + if [ "$DIFF" -gt 90 ]; then + echo "Timestamp mismatch, ignoring request." >&2 + exit 4 + fi +fi if [ "$MODE" != "reboot" ] && [ "$MODE" != "poweroff" ]; then - slxlog "idleaction-failed-call" "Invalid call to idleaction-scheduled_action. Mode '$MODE' unknown." + slxlog --echo "idleaction-failed-call" "Invalid call to idleaction-scheduled_action. Mode '$MODE' unknown." >&2 exit 3 fi @@ -56,7 +86,7 @@ runaction () { MESSAGE="Dieser Rechner wird in $MINUTES Minute(n) abgeschaltet, bitte beenden Sie Ihre Sitzung. The system will power off in $MINUTES minute(s). Please save your work and end the session." fi - for d in $(who | awk '{print $2}' | sort -u); do + for d in $(who | awk '{print $2 " " $NF}' | sort -u); do if [ "${d:0:1}" = ":" ]; then # X11 export DISPLAY=$d diff --git a/core/modules/idleaction/data/opt/openslx/scripts/systemd-idleaction_init b/core/modules/idleaction/data/opt/openslx/scripts/systemd-idleaction_init new file mode 100755 index 00000000..7c3afa00 --- /dev/null +++ b/core/modules/idleaction/data/opt/openslx/scripts/systemd-idleaction_init @@ -0,0 +1,70 @@ +#!/bin/ash + +if [ "$1" = "test" ]; then + shift + TEST=1 + SCHEDULE="$@" +else + SCHEDULE= + TEST= + . /opt/openslx/config +fi + +# Figure out the next rtcwake +SCHEDULE="$SCHEDULE $SLX_WAKEUP_SCHEDULE" +if [ "x$1" = "xsuspend" ]; then + # If we're about to suspend, consider reboot and shutdown too - we + # need to wake up to execute these + SCHEDULE="$SCHEDULE $SLX_SHUTDOWN_SCHEDULE $SLX_REBOOT_SCHEDULE" + # Delete this so the idle timeout will be reset + # Otherwise a user might wake the PC up right before + # cron fires the idle action check, which could + # shut the machine down right away because the timestamp + # from the file looks quite old + rm -f -- /run/openslx/idlehint +fi # suspend == true + +SCHEDULE=$( echo ${SCHEDULE} ) # poor man's trim + +NEXT= +if [ -n "$SCHEDULE" ]; then + # Time-math in ash - yay + TODAY=$(date +%Y-%m-%d) + # Use tomorrow instead of adding 86400 seconds so it (hopefully) works when DST changes + TOMORROW=$(date --date="+1 day" +%Y-%m-%d) + NOW=$(date +%s) + for t in $SCHEDULE; do + HOUR=${t%%:*} + MINUTE=${t##*:} + [ -z "$HOUR" -o -z "$MINUTE" ] && continue + [ "$HOUR" -lt 0 -o "$HOUR" -gt 23 ] && continue + [ "$MINUTE" -lt 0 -o "$MINUTE" -gt 59 ] && continue + # wake up 2 minutes early; for the shutdown/reboot times this is required + # so the actual cronjob for the shutdown/reboot will run. + # Otherwise, since the wakeup will take some seconds, the actual cronjob + # will not trigger, since it lies a few seconds in the past. + # For the scheduled wakeups this would't be needed, but two minutes + # early shouldn't hurt anyone. + TS=$(date --date "-2 minutes $TODAY $t" +%s) + [ "$TS" -le "$NOW" ] && TS=$(date --date "-2 minutes $TOMORROW $t" +%s) + if [ -z "$NEXT" ] || [ "$NEXT" -gt "$TS" ]; then + NEXT="$TS" + fi + done +fi + +if [ -n "$TEST" ]; then + echo -n "Next wakeup: " + date -d "@$NEXT" + exit 0 +fi + +if [ -n "$NEXT" ]; then + # Set -l and hope it does the right thing on DST + rtcwake -l -m no -t "$NEXT" +else + rtcwake -m disable +fi + +exit 0 + diff --git a/core/modules/pam/data/etc/pam.d/kdm b/core/modules/kdm/data/etc/pam.d/kdm index e6a4ec9b..e6a4ec9b 100644 --- a/core/modules/pam/data/etc/pam.d/kdm +++ b/core/modules/kdm/data/etc/pam.d/kdm diff --git a/core/modules/pam/data/etc/pam.d/kdm-np b/core/modules/kdm/data/etc/pam.d/kdm-np index dc10e5b5..dc10e5b5 100644 --- a/core/modules/pam/data/etc/pam.d/kdm-np +++ b/core/modules/kdm/data/etc/pam.d/kdm-np diff --git a/core/modules/kernel-vanilla/module.build b/core/modules/kernel-vanilla/module.build index 19615309..0665b25c 100644 --- a/core/modules/kernel-vanilla/module.build +++ b/core/modules/kernel-vanilla/module.build @@ -83,6 +83,7 @@ build() { cd - 2> /dev/null # copy most recent firmware + mkdir -p "${MODULE_BUILD_DIR}/lib/firmware" cp -r ./fw/* "${MODULE_BUILD_DIR}/lib/firmware/" || perror "Could not copy linux-firmware to '${MODULE_BUILD_DIR}/lib/firmware/'" # copy kernel to build diff --git a/core/modules/kernel-vanilla/module.conf b/core/modules/kernel-vanilla/module.conf index 844f5db2..19e55c47 100644 --- a/core/modules/kernel-vanilla/module.conf +++ b/core/modules/kernel-vanilla/module.conf @@ -2,5 +2,5 @@ REQUIRED_BINARIES="" REQUIRED_LIBRARIES="" REQUIRED_DIRECTORIES="" -REQUIRED_KERNEL="4.9.40" +REQUIRED_KERNEL="4.14.6" REQUIRED_GIT="git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git" diff --git a/core/modules/kernel-vanilla/module.conf.ubuntu b/core/modules/kernel-vanilla/module.conf.ubuntu new file mode 100644 index 00000000..a55bf629 --- /dev/null +++ b/core/modules/kernel-vanilla/module.conf.ubuntu @@ -0,0 +1,4 @@ +REQUIRED_INSTALLED_PACKAGES=" + libelf-dev +" + diff --git a/core/modules/lightdm-greeter-bwlp/data/etc/lightdm/lightdm.conf.d/10-openslx.conf b/core/modules/lightdm-greeter-bwlp/data/etc/lightdm/lightdm.conf.d/10-openslx.conf index 039a0400..8fbb9e25 100644 --- a/core/modules/lightdm-greeter-bwlp/data/etc/lightdm/lightdm.conf.d/10-openslx.conf +++ b/core/modules/lightdm-greeter-bwlp/data/etc/lightdm/lightdm.conf.d/10-openslx.conf @@ -1,7 +1,15 @@ [SeatDefaults] greeter-hide-users=true greeter-session=qt-lightdm-greeter + +greeter-allow-guest=true +allow-guest=true +guest-wrapper=/opt/openslx/lightdm/guest-session + session-wrapper=/etc/X11/Xsession display-setup-script=/etc/X11/Xsetup session-cleanup-script=/etc/X11/Xreset +[LightDM] +guest-account-script=/opt/openslx/lightdm/guest-account + diff --git a/core/modules/lightdm-greeter-bwlp/data/etc/lightdm/qt-lightdm-greeter.conf b/core/modules/lightdm-greeter-bwlp/data/etc/lightdm/qt-lightdm-greeter.conf index a1d19f07..b0d7e2aa 100644 --- a/core/modules/lightdm-greeter-bwlp/data/etc/lightdm/qt-lightdm-greeter.conf +++ b/core/modules/lightdm-greeter-bwlp/data/etc/lightdm/qt-lightdm-greeter.conf @@ -13,7 +13,11 @@ ; Can be given in pixels, e.g. loginform-offset-y=60px, or in percentage of screen width, e.g. loginform-offset-y=20%. [General] -;greeter-icon-theme=oxygen -greeter-background-image=/opt/openslx/lightdm/bwlp-background.png loginform-offset-x=50% loginform-offset-y=50% +greeter-banner-image=/opt/openslx/lightdm/bwlp-banner.svg +greeter-bottom-left-logo-path=/etc/branding.svg +greeter-background-gradient=e8e6e7 ffffff e8e6e7 ffd78b +greeter-message-file=/run/hw-warnings.log +auto-login-check-cmd=/opt/openslx/lightdm/is-autologin-enabled + diff --git a/core/modules/lightdm-greeter-bwlp/data/etc/polkit-1/localauthority/50-local.d/enable-lightdm-poweroptions.pkla b/core/modules/lightdm-greeter-bwlp/data/etc/polkit-1/localauthority/50-local.d/enable-lightdm-poweroptions.pkla new file mode 100644 index 00000000..ad458b91 --- /dev/null +++ b/core/modules/lightdm-greeter-bwlp/data/etc/polkit-1/localauthority/50-local.d/enable-lightdm-poweroptions.pkla @@ -0,0 +1,6 @@ +[Enable Lightdm PowerOptions] +Identity=unix-user:lightdm +Action=org.freedesktop.login1.reboot;org.freedesktop.login1.reboot-multiple-sessions;org.freedesktop.login1.power-off;org.freedesktop.login1.power-off-multiple-sessions;org.freedesktop.login1.suspend;org.freedesktop.login1.suspend-multiple-sessions;org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions +ResultAny=yes +ResultInactive=no +ResultActive=yes diff --git a/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/bwlp-background.png b/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/bwlp-background.png Binary files differdeleted file mode 100644 index e52de595..00000000 --- a/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/bwlp-background.png +++ /dev/null diff --git a/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/bwlp-banner.svg b/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/bwlp-banner.svg new file mode 100644 index 00000000..11016a9e --- /dev/null +++ b/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/bwlp-banner.svg @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" width="787.34906" height="183.04515" id="svg2985" xml:space="preserve" sodipodi:docname="bwlp-banner.svg" inkscape:version="0.92.1 r15371"><sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1920" inkscape:window-height="1200" id="namedview23" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="0.58423899" inkscape:cx="282.41867" inkscape:cy="117.38768" inkscape:window-x="1920" inkscape:window-y="0" inkscape:window-maximized="0" inkscape:current-layer="svg2985"/><metadata id="metadata2991"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title/></cc:Work></rdf:RDF></metadata><defs id="defs2989"><clipPath id="clipPath3001"><path d="M 0,8356.66 V 0 h 4518.7 v 8356.66 z" id="path3003" inkscape:connector-curvature="0"/></clipPath></defs><g transform="matrix(1.7424242,0,0,-1.7424242,0,1456.0847)" id="g2993" style="stroke-width:0.71739131"><g id="g3598" style="stroke-width:0.71739131"><path d="M 71.6785,784.102 H 33.4789 v 15.545 h 30.4273 v 15.061 H 79.452 v -22.834 c 0,-4.294 -3.4786,-7.772 -7.7735,-7.772" id="path3009" style="fill:#f9a72b;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="M 92.0914,730.614 H 77.2445 v 36.3 c 0.1778,4.161 3.6028,7.444 7.7688,7.444 H 168.667 V 758.812 H 92.4629 l -0.3715,-28.198" id="path3011" style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="M 66.1566,743.461 H 50.5035 l -0.1539,15.351 H 0 v 15.546 h 58.384 c 2.1047,0 4.1203,-0.854 5.5867,-2.369 1.4629,-1.513 2.25,-3.554 2.1816,-5.661 l 0.0043,-22.867" id="path3013" style="fill:#f9a72b;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="M 125.361,784.008 H 96.5371 c -4.2922,0 -7.7742,3.481 -7.7742,7.775 v 43.473 h 15.5481 v -35.7 h 21.05 v -15.548" id="path3015" style="fill:#f9a72b;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="m 153.667,815.973 c -7.762,0 -10.206,-7.619 -10.206,-14.159 0,-6.756 1.94,-14.16 10.206,-14.16 7.691,0 10.207,7.404 10.207,14.16 0,6.756 -2.013,14.159 -10.207,14.159 z m -10.35,-32.2 h -7.043 c 0.143,2.157 0.359,4.313 0.359,5.749 v 46.144 h 6.828 v -20.699 h 0.144 c 2.084,4.312 6.612,5.965 11.213,5.965 11.212,0 16.244,-9.344 16.244,-19.118 0,-9.273 -4.313,-19.119 -15.022,-19.119 -5.248,0 -9.991,1.797 -12.435,6.827 h -0.144 l 0.144,-0.359 -0.288,-5.39" id="path3017" style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="m 233.448,819.854 -12.722,-36.081 h -7.763 l -8.409,29.684 h -0.143 l -9.344,-29.684 h -7.979 l -11.931,36.081 h 7.403 l 8.697,-29.038 h 0.144 l 8.985,29.038 h 8.84 l 8.122,-28.462 h 0.144 l 8.984,28.462 h 6.972" id="path3019" style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="m 239.055,783.773 v 51.893 h 4.6 v -48.012 h 17.178 v -3.881 h -21.778" id="path3021" style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="m 286.346,804.473 c 0,8.05 -1.294,12.865 -8.193,12.865 -6.9,0 -8.195,-4.815 -8.195,-12.865 z m -16.388,-3.45 v -2.803 c 0,-5.032 1.367,-11.715 8.195,-11.715 5.39,0 8.049,3.449 7.977,8.337 h 4.529 c -0.504,-8.769 -5.247,-11.788 -12.506,-11.788 -6.253,0 -12.507,2.516 -12.507,13.512 v 8.914 c 0,10.493 4.386,15.308 12.507,15.308 12.506,0 12.506,-8.984 12.506,-19.765 h -20.701" id="path3023" style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="m 298.493,783.773 v 51.893 h 4.312 v -20.052 h 0.145 c 2.085,3.018 4.887,5.174 8.766,5.174 8.987,0 9.921,-6.683 9.921,-11.428 v -25.587 h -4.313 v 25.372 c 0,4.241 -1.654,8.193 -6.685,8.193 -3.882,0 -7.834,-2.658 -7.834,-10.78 v -22.785 h -4.312" id="path3025" style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="m 335.002,815.183 h 0.145 c 1.797,3.449 5.606,5.605 9.99,5.605 v -4.383 c -6.109,0.502 -10.135,-3.163 -10.135,-9.273 v -23.359 h -4.312 v 36.297 h 4.312 v -4.887" id="path3027" style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="m 354.842,798.723 c 0,-8.266 3.739,-12.218 7.691,-12.218 5.965,0 6.971,3.952 7.331,4.815 0.719,1.797 0.863,8.338 0.863,10.638 0,7.187 0,15.38 -7.689,15.38 -3.307,0 -8.196,-3.162 -8.196,-12.146 z m -0.143,16.963 0.143,0.072 c 2.3,3.521 5.895,5.03 8.768,5.03 11.356,0 11.43,-9.918 11.43,-14.662 v -8.122 c 0,-9.416 -3.236,-14.95 -12.507,-14.95 -2.66,0 -5.318,1.294 -7.547,4.744 l -0.144,0.073 v -17.826 h -4.312 v 50.025 h 4.169 v -4.384" id="path3029" style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="m 401.2,791.32 c 0.718,1.797 0.863,8.338 0.863,10.638 0,10.708 -1.079,15.38 -8.195,15.38 -7.116,0 -8.195,-4.672 -8.195,-15.38 0,-2.3 0.145,-8.841 0.864,-10.638 0.359,-0.863 1.366,-4.815 7.331,-4.815 5.965,0 6.972,3.952 7.332,4.815 z m -19.839,6.684 v 8.625 c 0,4.6 0.071,14.159 12.507,14.159 12.435,0 12.507,-9.559 12.507,-14.159 v -8.625 c 0,-9.416 -3.235,-14.95 -12.507,-14.95 -9.271,0 -12.507,5.534 -12.507,14.95" id="path3031" style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="m 433.113,791.32 c 0.718,1.797 0.862,8.338 0.862,10.638 0,10.708 -1.079,15.38 -8.194,15.38 -7.116,0 -8.195,-4.672 -8.195,-15.38 0,-2.3 0.145,-8.841 0.863,-10.638 0.359,-0.863 1.366,-4.815 7.332,-4.815 5.965,0 6.972,3.952 7.332,4.815 z m -19.839,6.684 v 8.625 c 0,4.6 0.071,14.159 12.507,14.159 12.434,0 12.506,-9.559 12.506,-14.159 v -8.625 c 0,-9.416 -3.235,-14.95 -12.506,-14.95 -9.273,0 -12.507,5.534 -12.507,14.95" id="path3033" style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/><path d="m 447.557,783.773 h 4.31289 v 51.893 H 447.557 Z" id="path3035" style="fill:#888687;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.71739131" inkscape:connector-curvature="0"/></g></g></svg> diff --git a/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/guest-account b/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/guest-account new file mode 100755 index 00000000..30a23f24 --- /dev/null +++ b/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/guest-account @@ -0,0 +1,5 @@ +#!/bin/ash +# Run as root, intended to setup the guest account +# and echo its name at the end. +# we use the existing demo user, so not much to do +echo "demo" diff --git a/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/guest-session b/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/guest-session new file mode 100755 index 00000000..eb3205aa --- /dev/null +++ b/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/guest-session @@ -0,0 +1,18 @@ +#!/bin/ash + +. /opt/openslx/config + +GUESTDIR="/opt/openslx/lightdm/autologin.d" +if [ -d "$GUESTDIR" ]; then + for file in $GUESTDIR/*; do + if [ -s "$file" ]; then + . "$file" || slxlog "xsession-autologin" "Could not source $file" "$file" + fi + done +fi + + +# Normal session mode +exec "$@" +exit 0 + diff --git a/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/is-autologin-enabled b/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/is-autologin-enabled new file mode 100755 index 00000000..4d6146e5 --- /dev/null +++ b/core/modules/lightdm-greeter-bwlp/data/opt/openslx/lightdm/is-autologin-enabled @@ -0,0 +1,5 @@ +#!/bin/ash + +. /opt/openslx/config + +[ -n "${SLX_AUTOLOGIN%OFF}" ] diff --git a/core/modules/lightdm/data/etc/pam.d/lightdm b/core/modules/lightdm/data/etc/pam.d/lightdm new file mode 100644 index 00000000..af8fd569 --- /dev/null +++ b/core/modules/lightdm/data/etc/pam.d/lightdm @@ -0,0 +1,11 @@ +# +# /etc/pam.d/lightdm - specify the PAM behaviour of lightdm +# +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 +account include common-account +password include common-password +session include common-session +session required pam_limits.so diff --git a/core/modules/lightdm/data/etc/pam.d/lightdm-autologin b/core/modules/lightdm/data/etc/pam.d/lightdm-autologin new file mode 100644 index 00000000..2f81f96c --- /dev/null +++ b/core/modules/lightdm/data/etc/pam.d/lightdm-autologin @@ -0,0 +1,11 @@ +# +# /etc/pam.d/lightdm-autologin - specify the PAM behaviour of lightdm for passwordless logins +# +auth required pam_nologin.so +auth required pam_permit.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 diff --git a/core/modules/lightdm/data/etc/pam.d/lightdm-greeter b/core/modules/lightdm/data/etc/pam.d/lightdm-greeter new file mode 100644 index 00000000..40efa81a --- /dev/null +++ b/core/modules/lightdm/data/etc/pam.d/lightdm-greeter @@ -0,0 +1,9 @@ +# +# /etc/pam.d/lightdm - specify the PAM behaviour of lightdm's greeter +# +auth required pam_permit.so +account include common-account +session include common-session +session required pam_limits.so +session required pam_env.so readenv=1 +session required pam_env.so readenv=1 envfile=/etc/default/locale diff --git a/core/modules/lightdm/data/etc/systemd/system/display-manager.service b/core/modules/lightdm/data/etc/systemd/system/display-manager.service new file mode 120000 index 00000000..4fcfbb14 --- /dev/null +++ b/core/modules/lightdm/data/etc/systemd/system/display-manager.service @@ -0,0 +1 @@ +lightdm.service
\ No newline at end of file diff --git a/core/modules/lightdm/module.conf b/core/modules/lightdm/module.conf index 351219aa..f277fa79 100644 --- a/core/modules/lightdm/module.conf +++ b/core/modules/lightdm/module.conf @@ -7,6 +7,5 @@ REQUIRED_LIBRARIES="" REQUIRED_DIRECTORIES=" /etc/dbus-1 /etc/lightdm - /etc/pam.d /usr/lib " diff --git a/core/modules/lightdm/templates/lightdm.service b/core/modules/lightdm/templates/lightdm.service index c40c40ca..8e7ab620 100644 --- a/core/modules/lightdm/templates/lightdm.service +++ b/core/modules/lightdm/templates/lightdm.service @@ -1,7 +1,8 @@ [Unit] Description=LightDM Display Manager +Conflicts=getty@tty7.service Requires=dev-tty7.device -After=dev-tty7.device systemd-user-sessions.service +After=dev-tty7.device systemd-user-sessions.service setup-slx-addon@nvidia_libs.service setup-slx-addon@vmware.service [Service] ExecStart=/usr/sbin/lightdm diff --git a/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_dsa_key b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_dsa_key new file mode 100644 index 00000000..0132fe84 --- /dev/null +++ b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_dsa_key @@ -0,0 +1,12 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIBugIBAAKBgQDu6vk2uFnUyKt9/In9Rtkq+2zqwd8slm90NUt6JBXyjYsIJwRp +hxRG1sFDho3ogog5hlt+y+UuNPc5QchT/e3O71zt2XbrfK2irr4XBJILuup95AGe +iW/gzMIUD4an8I58yYM9rXhTzvIMwri7jM6EKlCUytafVTdMICVH78Y97QIVAJ9a +Cs8Gxy91XMoHK3zcHutQcIF3AoGAV6p2ISW0pAE+2GbeKUDvraCNXDG37JaMCjZr +S+NB3cN/vJwjy0fPI6CB5o6GcgFhB0cxdgCb60lV8Qz76clx4ZJId8PVxeKp4vSw +kHdSbcRlBpRbe/YJY8ja/ITkvmeiEMncTQByo1t2VXDqHbvgQsllIqbbRWl0B2yV +WO4Uw4gCgYAFCgiy2Ncal0KhsHAJV5dP4imeyd49lONI488RO18wiODhCzGtkbvV +pL/saDZWkm3pUhJ9J0qalIZaJGG0WO6GHiQC5CzH21GF9RgsoNjrMl3gzuZB9FxB +4cg8UyZ2QCqXlRusOCIiZhBdIZzDkK6HlQMMtFGEGg/c9yNgxkPAzQIULLxfDTNh +8Ouz5BhfKWJrZ0XGUsA= +-----END DSA PRIVATE KEY----- diff --git a/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_dsa_key.pub b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_dsa_key.pub new file mode 100644 index 00000000..97af5cb0 --- /dev/null +++ b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_dsa_key.pub @@ -0,0 +1 @@ +ssh-dss AAAAB3NzaC1kc3MAAACBAO7q+Ta4WdTIq338if1G2Sr7bOrB3yyWb3Q1S3okFfKNiwgnBGmHFEbWwUOGjeiCiDmGW37L5S409zlByFP97c7vXO3Zdut8raKuvhcEkgu66n3kAZ6Jb+DMwhQPhqfwjnzJgz2teFPO8gzCuLuMzoQqUJTK1p9VN0wgJUfvxj3tAAAAFQCfWgrPBscvdVzKByt83B7rUHCBdwAAAIBXqnYhJbSkAT7YZt4pQO+toI1cMbfslowKNmtL40Hdw3+8nCPLR88joIHmjoZyAWEHRzF2AJvrSVXxDPvpyXHhkkh3w9XF4qni9LCQd1JtxGUGlFt79gljyNr8hOS+Z6IQydxNAHKjW3ZVcOodu+BCyWUipttFaXQHbJVY7hTDiAAAAIAFCgiy2Ncal0KhsHAJV5dP4imeyd49lONI488RO18wiODhCzGtkbvVpL/saDZWkm3pUhJ9J0qalIZaJGG0WO6GHiQC5CzH21GF9RgsoNjrMl3gzuZB9FxB4cg8UyZ2QCqXlRusOCIiZhBdIZzDkK6HlQMMtFGEGg/c9yNgxkPAzQ== root@stp diff --git a/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_ecdsa_key b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_ecdsa_key new file mode 100644 index 00000000..1fea2717 --- /dev/null +++ b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_ecdsa_key @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGkAgEBBDDwyXBE0s5I7Cci/by2EInEyHyIvfC6IB5U8XF5eZUDlVMxkgBYK0sm +r3Lyuy4XR3CgBwYFK4EEACKhZANiAATwyn0SyUKavp9CfPiv9IRSu8ICK1HekDMf +lB4AIOObT1CMEROVfwh6ur1w980426YSZW+j+bQN5RQVDF7njcsD0eiSeJj8HVrR +3PDpreZJMZVV2mLNYZxuE0kx9ILK12I= +-----END EC PRIVATE KEY----- diff --git a/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_ecdsa_key.pub b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_ecdsa_key.pub new file mode 100644 index 00000000..0ef413ba --- /dev/null +++ b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_ecdsa_key.pub @@ -0,0 +1 @@ +ecdsa-sha2-nistp384 AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzODQAAABhBPDKfRLJQpq+n0J8+K/0hFK7wgIrUd6QMx+UHgAg45tPUIwRE5V/CHq6vXD3zTjbphJlb6P5tA3lFBUMXueNywPR6JJ4mPwdWtHc8Omt5kkxlVXaYs1hnG4TSTH0gsrXYg== root@stp diff --git a/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_rsa_key b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_rsa_key new file mode 100644 index 00000000..b37b5a74 --- /dev/null +++ b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_rsa_key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQC4QG0lNN4NewU8nTxNr/dpF4FGRrVifIDOgTVcfJluYt3c1mfJ +tA2/ujwJ9jUV196P7UJ4QsAlpwd6SlKlxQ/tCTF2Zi2tjNtypIuSwBysxBM0BTRr +L/ntwET2vqdA1wRRRVDMl+l3B3YI1aJBUYqyM72v/yK/jbJiS5hZLp9TXwIDAQAB +AoGAXEGuJPYexWM20Q3t9vxIBrAFQ9n90o2CtWPPAztEXBhW/M/CciWcyMaIb3h/ +RiurvidPpAXQTkofHWV/ko9klDLDAOTsJE+mir61izvdPHqZH13ZJyI+GUN4bQ0a +1hV415OPsiks1jBL+J5sD1dvFZU4nOOeFbIZcmCf/Z5DIlECQQDke7DdNiiy2zls +C1GrCbj0R85h1ZmwZ4GytVkxlik+Ids2aeskxDba5wlEUZutVyGlQuUe6Zm4r2eI +Vq7/47VnAkEAznELdXCd6zYynGz8RYY4zMtLvu+oWePLKX/6P/egkfkloaB13Ohr +yEd//V+cnobL9g5ed5Ggt4WF4AhcvKn/SQJBAJDO1AlfievRhVM02U3Nm6s211aq +Sf3DnC/nP+BtizYVvxl9h8qFkT6rrvPdxQzXbDuRaiVtaD/k63k9dyw25YECQBfF +GGarUuOUV/t+6QUwUTXzaoNPoPjIq8nZfH0FDC4Cm/yiNy/6av6ijPAlpCj0qGNq +gCIQWIsJCsMi81qd0FECQQCfu6wSDszVseas0CAcxjP4MU5lVr6/L8//ZUn9TDJM +WSQelziGbnbsIXq7owCVDxROJ770IqOL4OQZDw5R8Swd +-----END RSA PRIVATE KEY----- diff --git a/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_rsa_key.pub b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_rsa_key.pub new file mode 100644 index 00000000..e6fd0588 --- /dev/null +++ b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/ssh_host_rsa_key.pub @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC4QG0lNN4NewU8nTxNr/dpF4FGRrVifIDOgTVcfJluYt3c1mfJtA2/ujwJ9jUV196P7UJ4QsAlpwd6SlKlxQ/tCTF2Zi2tjNtypIuSwBysxBM0BTRrL/ntwET2vqdA1wRRRVDMl+l3B3YI1aJBUYqyM72v/yK/jbJiS5hZLp9TXw== root@stp diff --git a/core/modules/mgmt-sshd/data/etc/ssh/mgmt/sshd_config b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/sshd_config new file mode 100644 index 00000000..b51a1109 --- /dev/null +++ b/core/modules/mgmt-sshd/data/etc/ssh/mgmt/sshd_config @@ -0,0 +1,33 @@ +Port 9922 +Protocol 2 +HostKey /etc/ssh/mgmt/ssh_host_rsa_key +HostKey /etc/ssh/mgmt/ssh_host_dsa_key +HostKey /etc/ssh/mgmt/ssh_host_ecdsa_key +UsePrivilegeSeparation yes +KeyRegenerationInterval 3600 +SyslogFacility AUTH +LogLevel INFO +LoginGraceTime 30 +PermitRootLogin yes +StrictModes yes +PubkeyAuthentication yes +AuthorizedKeysFile /etc/ssh/mgmt/authorized_keys +IgnoreRhosts yes +RhostsRSAAuthentication no +HostbasedAuthentication no +PermitEmptyPasswords no +ChallengeResponseAuthentication no +PasswordAuthentication no +KerberosAuthentication no +GSSAPIAuthentication no +X11Forwarding yes +X11DisplayOffset 20 +PrintLastLog yes +TCPKeepAlive yes +#Banner /etc/issue.net +#PrintMotd yes +AcceptEnv LANG LC_* +UsePAM yes +UseDNS no +PidFile /run/sshd_mgmt.pid +AllowUsers root diff --git a/core/modules/mgmt-sshd/data/etc/systemd/system/basic.target.wants/mgmt-sshd.service b/core/modules/mgmt-sshd/data/etc/systemd/system/basic.target.wants/mgmt-sshd.service new file mode 120000 index 00000000..a59a869f --- /dev/null +++ b/core/modules/mgmt-sshd/data/etc/systemd/system/basic.target.wants/mgmt-sshd.service @@ -0,0 +1 @@ +../mgmt-sshd.service
\ No newline at end of file diff --git a/core/modules/mgmt-sshd/data/etc/systemd/system/mgmt-sshd.service b/core/modules/mgmt-sshd/data/etc/systemd/system/mgmt-sshd.service new file mode 100644 index 00000000..9c267547 --- /dev/null +++ b/core/modules/mgmt-sshd/data/etc/systemd/system/mgmt-sshd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Management OpenSSH Daemon for OpenSLX + +[Service] +ExecStartPre=-/opt/openslx/scripts/systemd-mgmt_sshd_fw +ExecStart=/usr/sbin/sshd -D -f /etc/ssh/mgmt/sshd_config +ExecReload=/bin/kill -HUP $MAINPID +KillMode=process +Restart=always diff --git a/core/modules/mgmt-sshd/data/opt/openslx/scripts/systemd-mgmt_sshd_fw b/core/modules/mgmt-sshd/data/opt/openslx/scripts/systemd-mgmt_sshd_fw new file mode 100755 index 00000000..1e0758ee --- /dev/null +++ b/core/modules/mgmt-sshd/data/opt/openslx/scripts/systemd-mgmt_sshd_fw @@ -0,0 +1,17 @@ +#!/bin/ash + +FILE="/opt/openslx/iptables/rules.d/99-mgmt-sshd" +[ -s "$FILE" ] && exit 0 + +. /opt/openslx/config + +( + for ip in $SLX_KCL_SERVERS; do + echo "iptables -I ipt-helper-INPUT 1 -s $ip -p tcp --dport 9922 -j ACCEPT" + done + echo "iptables -A ipt-helper-INPUT -p tcp --dport 9922 -j REJECT" +) > "$FILE" +chmod +x "$FILE" + +exit 0 + diff --git a/core/modules/mgmt-sshd/module.build b/core/modules/mgmt-sshd/module.build new file mode 100644 index 00000000..4efccbe9 --- /dev/null +++ b/core/modules/mgmt-sshd/module.build @@ -0,0 +1,12 @@ +#!/bin/bash +fetch_source() { + : +} + +build() { + : +} + +post_copy() { + chmod -R go-rwx "${TARGET_BUILD_DIR}/etc/ssh" +} diff --git a/core/modules/mgmt-sshd/module.conf b/core/modules/mgmt-sshd/module.conf new file mode 100644 index 00000000..75c459a1 --- /dev/null +++ b/core/modules/mgmt-sshd/module.conf @@ -0,0 +1,3 @@ +#!/bin/bash +REQUIRED_MODULES="sshd" + diff --git a/core/modules/nvidia_kernel/module.build b/core/modules/nvidia_kernel/module.build index fb55c8fa..cb82865f 100644 --- a/core/modules/nvidia_kernel/module.build +++ b/core/modules/nvidia_kernel/module.build @@ -6,7 +6,7 @@ fetch_source() { } build() { - local ROOTUPPERDIR="$MODULE_DIR/rootupper" + local ROOTUPPERDIR="$MODULE_WORK_DIR/rootupper" local NVIDIA="$MODULE_WORK_DIR/src/$REQUIRED_NVIDIA" local NVIDIAEXTRACTDIR="$ROOTUPPERDIR/NVIDIA" diff --git a/core/modules/openbox/module.build b/core/modules/openbox/module.build index a02ddc8b..98ff9520 100644 --- a/core/modules/openbox/module.build +++ b/core/modules/openbox/module.build @@ -16,7 +16,6 @@ build() { } post_copy() { - [ ! -d "$TARGET_BUILD_DIR/etc/pango" ] && mkdir -p "$TARGET_BUILD_DIR/etc/pango" # little Workaround, as under e.g. 64bit Suse the binary is called # pango-querymodules-64, not pango-querymodules. @@ -30,8 +29,12 @@ post_copy() { if [[ "$ERR" -eq 0 ]]; then PANGO_QUERYMODULES_ARCH=pango-querymodules-64 else - perror "Could not find either pango-querymodules or pango-querymodules-64!" + pwarning "Could not find either pango-querymodules or pango-querymodules-64!" + pwarning "Newer pango versions (1.37) deprecated this tool. Most likely all is fine." + return 0 fi fi + + [ ! -d "$TARGET_BUILD_DIR/etc/pango" ] && mkdir -p "$TARGET_BUILD_DIR/etc/pango" $PANGO_QUERYMODULES_ARCH > "$TARGET_BUILD_DIR/etc/pango/pango.modules" } diff --git a/core/modules/pam-bwidm/data/opt/openslx/scripts/pam_bwidm b/core/modules/pam-bwidm/data/opt/openslx/scripts/pam_bwidm index 92379719..ae9cdf41 100755 --- a/core/modules/pam-bwidm/data/opt/openslx/scripts/pam_bwidm +++ b/core/modules/pam-bwidm/data/opt/openslx/scripts/pam_bwidm @@ -17,20 +17,35 @@ if [ "x$PAM_TYPE" == "xauth" ]; then [ -z "$USER_PASSWORD" ] && echo "No password given." && exit 1 fi +# sanity check on PAM_USER: contains '@'? +if [ -z "$PAM_USER" ] || [ "x${PAM_USER}" == "x${PAM_USER%@*}" ]; then + # no @ contained, invalid username, abort + #echo "Invalid username '$PAM_USER'. Aborting." + exit 1 +fi + if ! busybox which curl || ! busybox which mktemp; then echo "'curl/mktemp' missing. This script won't work without it." exit 1 fi +# determine proper tmp dir, prefer one in RAM +for TMPDIR in "/run" "/run/user/$(id -u)" "/dev/shm" "/home/$(whoami)" "/tmp"; do + [ -d "$TMPDIR" ] && [ -w "$TMPDIR" ] && [ -r "$TMPDIR" ] && break +done +readonly TMPDIR + # redirect stdout/stderr to temporary logfile -readonly LOGFILE="$(mktemp)" +readonly LOGFILE="$(mktemp -p "$TMPDIR")" # URL to query masterserver for IDPs readonly IDP_QUERY_URL="https://bwlp-masterserver.ruf.uni-freiburg.de/webif/pam.php" readonly IDP_QUERY_CACHE="/run/openslx/bwlp-idp" # everything in a subshell in an effort to hide sensitive information # from this script's environment -( +### +( # +### # redirect stdout and stderr to logfile exec > "${LOGFILE}" 2>&1 @@ -48,13 +63,6 @@ else exit 1 fi -# sanity check on PAM_USER: contains '@'? -if [ -z "$PAM_USER" ] || [ "x${PAM_USER}" == "x${PAM_USER%@*}" ]; then - # no @ contained, invalid username, abort - echo "Invalid username '$PAM_USER'. Aborting." - exit 1 -fi - # valid username, we can already split it here readonly USER_USERNAME="${PAM_USER%@*}" readonly USER_ORGANISATION="${PAM_USER#*@}" @@ -82,9 +90,13 @@ fi mkdir -p /run/openslx # check if we have a (non-zero bytes) cached copy of the list -if [ ! -s "${IDP_QUERY_CACHE}" ]; then +if ! [ -s "${IDP_QUERY_CACHE}" ]; then + if ! [ -w "/run/openslx" ]; then + echo "No IDP info cached, cache path not writable for current user." + exit 7 + fi idpret="$(curl -w "%{http_code}" -o "${IDP_QUERY_CACHE}" --connect-timeout 5 --max-time 15 "$IDP_QUERY_URL")" - if [ "x$idpret" != "x200" ]; then + if [ "x${idpret:0:1}" != "x2" ]; then echo "Could not download the list of identity providers from '$IDP_QUERY_URL'. Aborting." rm -f -- "$IDP_QUERY_CACHE" exit 7 @@ -141,8 +153,8 @@ if [ "x$PAM_TYPE" == "xauth" ]; then RID="_c${RANDOM}a${RANDOM}f${RANDOM}f${RANDOM}e${RANDOM}e${RANDOM}" RID="${RID:0:32}" REQUEST=$(sed "s/%TIMESTAMP%/${NOW}/g;s/%REQUESTID%/${RID}/g" "${SOAP_ENVELOPE}") - NETRC=$(mktemp -p /run/) - [ -z "$NETRC" ] && NETRC="/run/netrc_$$_${USER}_${RANDOM}.tmp" + NETRC=$(mktemp -p "$TMPDIR") + [ -z "$NETRC" ] && NETRC="$TMPDIR/netrc_$$_${USER}_${RANDOM}.tmp" touch "$NETRC" chmod 0600 "$NETRC" # now we are ready to actually send the credentials to the IdP @@ -204,7 +216,9 @@ fi # script should never get to the following line echo "$0 called for unsupported PAM_TYPE '$PAM_TYPE'. Aborting." exit 1 -) +### +) # +# # ## main script mainret=$? if [ "x$mainret" == "x7" ]; then diff --git a/core/modules/pam/data/opt/openslx/scripts/pam_script_auth b/core/modules/pam/data/opt/openslx/scripts/pam_script_auth index e977185e..f7e12acf 100755 --- a/core/modules/pam/data/opt/openslx/scripts/pam_script_auth +++ b/core/modules/pam/data/opt/openslx/scripts/pam_script_auth @@ -6,7 +6,12 @@ export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/o # check if the script runs as root [ "x$(whoami)" != "xroot" ] && exit 0 -PASSWD=$(getent passwd "$PAM_USER") +USER_UID=$(id -u "$PAM_USER") +if [ -n "$USER_UID" ]; then + PASSWD=$(getent passwd "$USER_UID") +else + PASSWD=$(getent passwd "$PAM_USER") +fi USER_NAME=$(echo "$PASSWD" | awk -F ':' '{print $1}') USER_UID=$(echo "$PASSWD" | awk -F ':' '{print $3}') USER_GID=$(echo "$PASSWD" | awk -F ':' '{print $4}') diff --git a/core/modules/pam/data/opt/openslx/scripts/pam_script_ses_close b/core/modules/pam/data/opt/openslx/scripts/pam_script_ses_close index e4a7c1b4..0c0b804f 100755 --- a/core/modules/pam/data/opt/openslx/scripts/pam_script_ses_close +++ b/core/modules/pam/data/opt/openslx/scripts/pam_script_ses_close @@ -29,6 +29,9 @@ fi # do not kill all root processes :) [ "x${PAM_USER}" = "xroot" ] && exit 0 +USERID=$(id -u "$PAM_USER") +[ -z "$USERID" ] && USERID="$PAM_USER" + # Async block: Check if user has no session open anymore, if not # kill any remaining processes belonging to the user and unmount # everything at $USERHOME and below. @@ -41,17 +44,17 @@ fi if [ "$SESSIONCOUNT" = "0" ]; then # last session, close all ghost user processes - pkill -u "${PAM_USER}" + pkill -u "${USERID}" # check if user's processes are still running for TIMEOUT in 1 1 2 FAIL; do - if ! ps -o pid,s -u "$PAM_USER" -U "$PAM_USER" | grep -q -v -E "PID|Z"; then + if ! ps -o pid,s -u "$USERID" -U "$USERID" | grep -q -v -E "PID|Z"; then # nothing running anymore break fi if [ "$TIMEOUT" = "FAIL" ]; then # still something running, send SIGKILL - pkill -9 -u "${PAM_USER}" + pkill -9 -u "${USERID}" else # give some time sleep "${TIMEOUT}" @@ -65,7 +68,7 @@ fi if [ "$SESSIONCOUNT" = "0" ]; then # unmount the home directory structure - USER_HOME=$(getent passwd "$PAM_USER" | awk -F ':' '{print $6}') + USER_HOME=$(getent passwd "$USERID" | awk -F ':' '{print $6}') if [ -n "$USER_HOME" ]; then for TIMEOUT in 0 0 2 2 FAIL; do OK=yes diff --git a/core/modules/pam/module.conf.debian b/core/modules/pam/module.conf.debian index 2ddd1312..f0b76a96 100644 --- a/core/modules/pam/module.conf.debian +++ b/core/modules/pam/module.conf.debian @@ -1,7 +1,5 @@ #!/bin/bash REQUIRED_INSTALLED_PACKAGES=" - libpam-ldap - libnss-ldapd libpam-ck-connector libpam-cap krb5-user @@ -20,8 +18,6 @@ REQUIRED_CONTENT_PACKAGES=" libpam-ck-connector libpam-cap libldap-2.4-2 - libpam-ldapd - libnss-ldapd krb5-user krb5-config libpam-krb5 diff --git a/core/modules/pam/module.conf.ubuntu b/core/modules/pam/module.conf.ubuntu index 6f20bfd1..40974f10 100644 --- a/core/modules/pam/module.conf.ubuntu +++ b/core/modules/pam/module.conf.ubuntu @@ -1,7 +1,5 @@ #!/bin/bash REQUIRED_INSTALLED_PACKAGES=" - libpam-ldap - libnss-ldapd krb5-user krb5-config libpam-krb5 @@ -19,8 +17,6 @@ REQUIRED_CONTENT_PACKAGES=" libpam-modules libpam-cap libldap-2.4-2 - libpam-ldap - libnss-ldapd krb5-user krb5-config libpam-krb5 diff --git a/core/modules/pam/module.conf.ubuntu.16 b/core/modules/pam/module.conf.ubuntu.16 index ff8e294e..378ef1f5 100644 --- a/core/modules/pam/module.conf.ubuntu.16 +++ b/core/modules/pam/module.conf.ubuntu.16 @@ -1,9 +1,7 @@ #!/bin/bash # TODO fix and re-add ncp support ! REQUIRED_INSTALLED_PACKAGES=" - libpam-ldap libpam-cap - libnss-ldapd krb5-user krb5-config libpam-krb5 @@ -20,8 +18,6 @@ REQUIRED_CONTENT_PACKAGES=" libpam-modules-bin libpam-cap libldap-2.4-2 - libpam-ldap - libnss-ldapd krb5-user krb5-config libpam-krb5 diff --git a/core/modules/pam/module.conf.ubuntu.17 b/core/modules/pam/module.conf.ubuntu.17 new file mode 100644 index 00000000..378ef1f5 --- /dev/null +++ b/core/modules/pam/module.conf.ubuntu.17 @@ -0,0 +1,41 @@ +#!/bin/bash +# TODO fix and re-add ncp support ! +REQUIRED_INSTALLED_PACKAGES=" + libpam-cap + krb5-user + krb5-config + libpam-krb5 + libssl-dev + ldap-utils + libnfsidmap2 + nfs-common + libpam0g-dev + cifs-utils +" +REQUIRED_CONTENT_PACKAGES=" + libpam0g + libpam-modules + libpam-modules-bin + libpam-cap + libldap-2.4-2 + krb5-user + krb5-config + libpam-krb5 + ldap-utils + libnfsidmap2 + nfs-common + cifs-utils + keyutils +" +REQUIRED_BINARIES+=" + mount.cifs +" +REQUIRED_DIRECTORIES+=" + $SYS_PAM_MODULES_PATH + /lib + /usr/lib +" +REQUIRED_SYSTEM_FILES+=" + /etc/pam.conf + /etc/default/locale +" diff --git a/core/modules/printergui/data/opt/openslx/iptables/rules.d/50-lpd-redirect-and-fw b/core/modules/printergui/data/opt/openslx/iptables/rules.d/50-lpd-redirect-and-fw index c0b724a2..0a7d0a9a 100755 --- a/core/modules/printergui/data/opt/openslx/iptables/rules.d/50-lpd-redirect-and-fw +++ b/core/modules/printergui/data/opt/openslx/iptables/rules.d/50-lpd-redirect-and-fw @@ -1,8 +1,18 @@ #!/bin/ash -# Close from outside -iptables -A INPUT -i br0 -p tcp --dport 515 -j DROP -iptables -A INPUT -i br0 -p tcp --dport 5515 -j DROP # Redirect from VM to lpd -iptables -t nat -A PREROUTING -s 192.168.0.0/16 -p tcp --dport 515 -j REDIRECT --to-port 5515 +for br in br0 nat1 vsw2; do + [ -d "/sys/class/net/${br}/brif" ] || continue + devs=$(ls -1 "/sys/class/net/${br}/brif/") + for dev in $devs; do + case "$dev" in eth?|eth??|tun?|tun??) continue ;; esac + iptables -t nat -A PREROUTING -m physdev --physdev-in "$dev" -d 192.168.101.1 -p tcp --dport 515 -j REDIRECT --to-port 5515 + iptables -t nat -A PREROUTING -m physdev --physdev-in "$dev" -d 100.100.100.100 -p tcp --dport 515 -j REDIRECT --to-port 5515 + iptables -A INPUT -m physdev --physdev-in "$dev" -p tcp --dport 5515 -j ACCEPT + done +done +# Close from outside +iptables -A INPUT -p tcp --dport 515 -j DROP +iptables -A INPUT -p tcp --dport 5515 -j DROP +exit 0 diff --git a/core/modules/printergui/module.conf.ubuntu b/core/modules/printergui/module.conf.ubuntu index e6d9d864..dc98d2d6 100644 --- a/core/modules/printergui/module.conf.ubuntu +++ b/core/modules/printergui/module.conf.ubuntu @@ -1,6 +1,6 @@ #!/bin/bash REQUIRED_INSTALLED_PACKAGES=" libcups2-dev - libqt4-dev + libqt5gui5 " diff --git a/core/modules/pvs2/data/opt/openslx/lightdm/autologin.d/00-check-pvs-dedicated b/core/modules/pvs2/data/opt/openslx/lightdm/autologin.d/00-check-pvs-dedicated new file mode 100644 index 00000000..420cfc5c --- /dev/null +++ b/core/modules/pvs2/data/opt/openslx/lightdm/autologin.d/00-check-pvs-dedicated @@ -0,0 +1,10 @@ +#!/bin/ash +# This file is SOURCED + +# PVSMGR? +if [ -n "$SLX_PVS_DEDICATED" ]; then + exec /opt/openslx/scripts/setup-pvsmgr +fi + +true + diff --git a/core/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr b/core/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr index 1a56e8d0..9fe09ec3 100755 --- a/core/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr +++ b/core/modules/pvs2/data/opt/openslx/scripts/systemd-pvsmgr @@ -9,14 +9,5 @@ if [ -n "$SLX_PVS_CONFIG_URL" ]; then [ -s "${DST}.new" ] && mv -f "${DST}.new" "${DST}" fi -# If this is a dedicated PVS station, make it launch right away -if [ -n "$SLX_PVS_DEDICATED" ] && cd /opt/openslx/xsessions; then - for file in *.desktop; do - cp -f "/usr/share/xsessions/pvs2mgr.desktop" "$file" - done - # patch autologin into kdmrc - sed -i '/AutoLogin.*=/d;/^\[X-.*-Core\]/a AutoLoginEnable=true\nAutoLoginUser=demo\nAutoLoginAgain=true\nAutoLoginDelay=0' "/etc/kde/kdm/kdmrc" -fi - exit 0 diff --git a/core/modules/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient b/core/modules/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient index 5ff03227..cd932597 100755 --- a/core/modules/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient +++ b/core/modules/pvs2/data/opt/openslx/vmchooser/sessionstart.d/50-PVSclient @@ -2,20 +2,24 @@ # SESSION_TYPE can be either 'VSESSION' or 'XSESSION' -# detect session command of the PVS-Manager session by looking at the xsession file -PVSMGR_SESSION_CMD= -PVSMGR_XSESSION_FILE="pvs2mgr.desktop" -# the second directory should not be needed, but lets be compatible with the old crap...... -for DIR in "/usr/share/xsessions" "/opt/openslx/xsessions/"; do - if [ -f "${DIR}/${PVSMGR_XSESSION_FILE}" ]; then - # extract the exact command string - PVSMGR_SESSION_CMD="$(grep -E "^Exec=.*$" "${DIR}/${PVSMGR_XSESSION_FILE}" |cut -c 6-)" - break +if [ "$SESSION_TYPE" = "XSESSION" ]; then + # detect session command of the PVS-Manager session by looking at the xsession file + # TODO Maybe the vmchooser should just expose the session file's name/path, or we + # can define a new X-Property in the .desktop file that stops pvsclient from starting. + PVSMGR_SESSION_CMD= + PVSMGR_XSESSION_FILE="pvs2mgr.desktop" + # the second directory should not be needed, but lets be compatible with the old crap...... + for DIR in "/usr/share/xsessions" "/opt/openslx/xsessions/"; do + if [ -f "${DIR}/${PVSMGR_XSESSION_FILE}" ]; then + # extract the exact command string + PVSMGR_SESSION_CMD="$(grep -E "^Exec=.*$" "${DIR}/${PVSMGR_XSESSION_FILE}" |cut -c 6-)" + break + fi + done + if [ -n "${PVSMGR_SESSION_CMD}" ]; then + # do not start pvsclient if we are running the pvs manager session + [ "x${SESSION_CMD}" == "x${PVSMGR_SESSION_CMD}" ] && exit 0 fi -done -if [ -n "${PVSMGR_SESSION_CMD}" ]; then - # do not start pvsclient if we are running the pvs manager session - [ "x${SESSION_CMD}" == "x${PVSMGR_SESSION_CMD}" ] && exit 0 fi # Download fresh copy of config file if possible @@ -38,16 +42,16 @@ fi # If the ENV var PVS has been set by vmchooser start pvsclient if [ "$PVS_AUTO_CONNECT" == "TRUE" ]; then - pvsstartup "$PVSCONFIG" --auto & + pvsstartup $PVSCONFIG --auto & else - pvsstartup "$PVSCONFIG" & + pvsstartup $PVSCONFIG & fi # Finally, handle hybrid mode where the pvsmgr is launched on the second desktop # alongside the actual vm. (make sure this is a VSESSION!) if [ "$SESSION_TYPE" == "VSESSION" ]; then { - wt="PVS2-Manager" + wt="PVS2 Manager" pvsmgr "$PVSCONFIG" --manager-only & for i in 100 100 200 200 200 300 500 500 1000; do usleep $(( i * 1000 )) || sleep 1 diff --git a/core/modules/pvs2/module.build b/core/modules/pvs2/module.build index f356e1bc..454bd522 100644 --- a/core/modules/pvs2/module.build +++ b/core/modules/pvs2/module.build @@ -9,9 +9,6 @@ build() { local BUILDDIR="${SRCDIR}/build/" local DESTDIR="${MODULE_BUILD_DIR}/opt/openslx/bin" - # first activate qt 4 - activate_qt 4 - mkdir -p "${DESTDIR}" || perror "Could not mkdir ${DESTDIR}!" mkdir -p "${BUILDDIR}" || perror "Could not mkdir ${BUILDDIR}!" cd "${BUILDDIR}" || perror "Could not cd to ${BUILDDIR}!" diff --git a/core/modules/pvs2/module.conf b/core/modules/pvs2/module.conf index a9a57bfb..bbac8a80 100644 --- a/core/modules/pvs2/module.conf +++ b/core/modules/pvs2/module.conf @@ -8,7 +8,6 @@ REQUIRED_BINARIES=" " REQUIRED_DIRECTORIES=" /opt/openslx/pvs2/ - /usr/lib/ " REQUIRED_LIBRARIES=" " diff --git a/core/modules/pvs2/module.conf.ubuntu b/core/modules/pvs2/module.conf.ubuntu index 2a938b43..05a233bc 100644 --- a/core/modules/pvs2/module.conf.ubuntu +++ b/core/modules/pvs2/module.conf.ubuntu @@ -1,13 +1,13 @@ #!/bin/bash REQUIRED_INSTALLED_PACKAGES=" - libqt4-dev + libqt5gui5 + libqt5x11extras5-dev + qttools5-dev libvncserver-dev xinput wmctrl " REQUIRED_CONTENT_PACKAGES=" - libqt4-svg - libqtgui4 xinput wmctrl " diff --git a/core/modules/pvs2/module.conf.ubuntu.17 b/core/modules/pvs2/module.conf.ubuntu.17 new file mode 100644 index 00000000..19ab75f1 --- /dev/null +++ b/core/modules/pvs2/module.conf.ubuntu.17 @@ -0,0 +1,13 @@ +#!/bin/bash +REQUIRED_INSTALLED_PACKAGES=" + libqt5gui5 + libqt5x11extras5-dev + qttools5-dev-tools + libvncserver-dev + xinput + wmctrl +" +REQUIRED_CONTENT_PACKAGES=" + xinput + wmctrl +" diff --git a/core/modules/qemukvm/module.conf.ubuntu b/core/modules/qemukvm/module.conf.ubuntu index 1f086367..770c62c2 100644 --- a/core/modules/qemukvm/module.conf.ubuntu +++ b/core/modules/qemukvm/module.conf.ubuntu @@ -8,7 +8,6 @@ REQUIRED_CONTENT_PACKAGES=" qemu qemu-kvm qemu-keymaps - qemu-system qemu-system-common qemu-system-x86 qemu-user diff --git a/core/modules/run-virt/data/opt/openslx/scripts/pam_script_auth.d/99-run_virt_credentials b/core/modules/run-virt/data/opt/openslx/scripts/pam_script_auth.d/99-run_virt_credentials index 1db0783c..941f0047 100644 --- a/core/modules/run-virt/data/opt/openslx/scripts/pam_script_auth.d/99-run_virt_credentials +++ b/core/modules/run-virt/data/opt/openslx/scripts/pam_script_auth.d/99-run_virt_credentials @@ -26,7 +26,7 @@ if [ -n "$TEMP_HOME_DIR" ]; then if [ "x$XDOMAIN" != "x#" ]; then # Guess domain if [ -z "$XDOMAIN" ] && [ -n "$PERSISTENT_HOME_DIR" ]; then - XDOMAIN=$(grep -F " ${PERSISTENT_HOME_DIR} " "/proc/mounts" | grep -m1 -F 'domain=' | sed -r 's/^.*[ ,]domain=([^ ,]+)[ ,].*$/\1/g') + XDOMAIN=$(grep -F " ${PERSISTENT_HOME_DIR} " "/proc/mounts" | grep -m1 -F 'domain=' | sed -r 's/^.*[ ,]domain=([^ ,]*)[ ,].*$/\1/g') fi if [ -z "$XDOMAIN" ]; then XDOMAIN=$(<"/etc/ldap.conf" grep -m1 -i '^BASE\s.*DC=' | grep -o -E -i 'DC=([^,;]+)' | head -n 1 | cut -c 4-) diff --git a/core/modules/run-virt/data/opt/openslx/scripts/systemd-mount_vm_store b/core/modules/run-virt/data/opt/openslx/scripts/systemd-mount_vm_store index 58f01038..1059feba 100755 --- a/core/modules/run-virt/data/opt/openslx/scripts/systemd-mount_vm_store +++ b/core/modules/run-virt/data/opt/openslx/scripts/systemd-mount_vm_store @@ -39,9 +39,9 @@ fi > "$OUTFILE" 2>&1 if [ "$RET" -ne "0" ]; then if [ -s "$OUTFILE" ]; then - slxlog --delete "mount-vmstore-fail" "Mounting '$SLX_VM_NFS' failed. VMs will not boot." "$OUTFILE" + slxlog --sync --delete "mount-vmstore-fail" "Mounting '$SLX_VM_NFS' failed. VMs will not boot." "$OUTFILE" else - slxlog "mount-vmstore-fail" "Mounting '$SLX_VM_NFS' failed. VMs will not boot." + slxlog --sync "mount-vmstore-fail" "Mounting '$SLX_VM_NFS' failed. VMs will not boot." rm -f -- "$OUTFILE" fi fi diff --git a/core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env b/core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env index fcce04d6..1bd0db58 100755 --- a/core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env +++ b/core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env @@ -41,6 +41,35 @@ for DIR in /tmp/virt /var/log/samba /run/samba; do fi done +# check if a fallback share is set as SLX_VM_TMP_SOURCE +if [ -n "${SLX_VM_TMP_SOURCE}" ]; then + LOG=$(mktemp) + # use SLX_VM_TMP_TYPE and SLX_VM_TMP_OPTS, if set + for TRY in 1 2 3 STOP; do + [ "x$TRY" = "xSTOP" ] && break + if [ -n "${SLX_VM_TMP_TYPE}" ] && [ -n "${SLX_VM_TMP_OPTS}" ]; then + mount -t ${SLX_VM_TMP_TYPE} -o "${SLX_VM_TMP_OPTS}" "${SLX_VM_TMP_SOURCE}" /tmp/virt + elif [ -n "${SLX_VM_TMP_TYPE}" ]; then + mount -t ${SLX_VM_TMP_TYPE} "${SLX_VM_TMP_SOURCE}" /tmp/virt + elif [ -n "${SLX_VM_TMP_OPTS}" ]; then + mount -o "${SLX_VM_TMP_OPTS}" "${SLX_VM_TMP_SOURCE}" /tmp/virt + else + mount "${SLX_VM_TMP_SOURCE}" /tmp/virt + fi + RET=$? + [ "$RET" = "0" ] && break + sleep $TRY + done > "$LOG" 2>&1 + if [ "$RET" -ne "0" ]; then + if [ -s "$LOG" ]; then + slxlog --delete "mount-vm-tmp-fail" "Mounting of '${SLX_VM_TMP_SOURCE}' failed." "$LOG" + else + slxlog "mount-vm-tmp-fail" "Mounting of '${SLX_VM_TMP_SOURCE}' failed." + rm -f -- "$LOG" + fi + fi +fi + chmod a+rwxt /tmp/virt # enable normal users to setup the extended virtual machine redo file space @@ -109,8 +138,8 @@ echo "HOSTMACADDR='$HOSTMACADDR'" >> "${VMCHOOSER_VIRT_CONF}" # If not, or the host's prefix is the last one in the list, use the first one. # This lays the groundwork to avoid mac addresses collisions in nested operations. MACADDRPREFIX= -for i in $(seq 0 8); do - if [ "x${HOSTMACADDR#00:FF:0$i}" == "x${HOSTMACADDR}" ]; then +for i in 0 1 2 3 4 5 6 7 8; do + if [ "x${HOSTMACADDR#00:FF:0$i}" != "x${HOSTMACADDR}" ]; then # current prefix is indeed part of the host's mac address # use the next prefix if != 9 MACADDRPREFIX="00:FF:0$(( i + 1 ))" @@ -178,17 +207,19 @@ echo "1" >/proc/sys/net/ipv4/conf/nat1/forwarding echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null # iptables masquerade rule is now inserted by /opt/openslx/iptables/rules.d/50-virt-nat1-masquerading +FALLBACK_DOMAIN="virtual.localnet" + getips () { - if [ -n "$1" ]; then - # Output in one line by using echo without quotes - echo $(timeout -t 1 nslookup "$1" 2>/dev/null | grep -A 3 '^Name:' | grep '^Address .*: ' | awk '{print $3}') - fi + [ -z "$1" ] && return + [ "$1" = "$FALLBACK_DOMAIN" ] && return + # Output in one line by using echo without quotes + echo $(timeout -t 2 nslookup "$1" 2>/dev/null | grep -A 4 '^Name:' | grep -E '^Address\s*[0-9]*: ' | awk -F': ' '{print $2}' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | awk '{print $1}') } # read the DNS configuration and configure the udhcpd [ -z "${SLX_DNS}" ] && SLX_DNS="8.8.8.8 8.8.4.4" -[ -z "${SLX_NET_DOMAIN}" ] && SLX_NET_DOMAIN="virtual.site" -[ -z "${SLX_NET_SEARCH}" ] && SLX_NET_SEARCH="virtual.site" +[ -z "${SLX_NET_DOMAIN}" ] && SLX_NET_DOMAIN="$FALLBACK_DOMAIN" +[ -z "${SLX_NET_SEARCH}" ] && SLX_NET_SEARCH="$FALLBACK_DOMAIN" # WINS - if not supplied, try to get it from the search base of our ldap config if [ -z "${SLX_NET_WINS}" ]; then DC=$(grep -m1 -i '^BASE\s*DC=' "/etc/ldap.conf" | grep -o -i 'DC=.*' | sed -r 's/\s*,\s*DC=/./gI;s/^\s*DC=//I') diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc index bb7ae3a1..c93b8021 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/00_vars.inc @@ -21,8 +21,8 @@ SCHLUESSEL=$(head -n 1 "$CONFIGFILE" | cut -f 4 -d$'\t') GLOBALDOMAINUSER=$(head -n 1 "$CONFIGFILE" | cut -f 5 -d$'\t') GLOBALUSER=$(echo "$GLOBALDOMAINUSER" | cut -d '\' -f 2) -REMAPMODE=$(grep 'remapMode=' "$SLXCONFIGFILE" | cut -d '=' -f 2) -CREATEMISSING=$(grep 'createMissingRemap=' "$SLXCONFIGFILE" | cut -d '=' -f 2) +REMAPMODE=$(grep '^remapMode=' "$SLXCONFIGFILE" | cut -d '=' -f 2) +CREATEMISSING=$(grep '^createMissingRemap=' "$SLXCONFIGFILE" | cut -d '=' -f 2) MOUNTOPTSCIFS="-v -t cifs -o uid=$(id --user "$LOCALUSER"),gid=$(id --group "$LOCALUSER"),forceuid,forcegid,file_mode=0700,dir_mode=0700,nobrl,noacl" MOUNTOPTSNFS="-v -t nfs4 -o rw,nosuid,nodev,nolock,intr,hard,sloppy" diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/mnt_shares b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/mnt_shares index 0c94f0aa..cb82ba35 100755 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/mnt_shares +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/mnt_shares @@ -54,7 +54,7 @@ case "$REMAPMODE" in exit 0 ;; *) logger "openslx sharemapper: unknown remapMode in $SLXCONFIGFILE; doing nothing end exiting with error." - exit 1. + exit 1 ;; esac diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe b/core/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe Binary files differindex fc398372..65702c14 100755 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/openslx.exe diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc index 95e90ebf..b3bc1cdf 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/init_core.inc @@ -35,7 +35,7 @@ fi # This variable is empty (but set!) if no hard drive was mounted on /tmp # else it will be non-empty (check with helper function 'notempty'). declare -g TMP_ON_HDD= -if grep -q -E '^/dev/\S+\s/tmp' '/proc/mounts'; then +if ! grep -q -E '\s+/tmp\s+tmpfs\s+' '/proc/mounts'; then writelog "Hard drive partition mounted on /tmp" TMP_ON_HDD=1 readonly TMP_ON_HDD diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc index 48a5cf3c..04f3b22e 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/set_runvirt_hardware_variables.inc @@ -69,6 +69,7 @@ set_virt_memory() { # Suffix template is taken from /opt/openslx/vmchooser/config/virtualization.conf # and will have the VMID inserted as first byte. set_virt_mac() { + local i mac byte # First, determine prefix of the host's MAC address isset HOSTMACADDR || writelog "Host's MAC address was not defined in ${VMCHOOSER_CONF_DIR}/virtualizer.conf" isset MACADDRPREFIX || writelog "No MAC address prefix was defined in ${VMCHOOSER_CONF_DIR}/virtualizer.conf" @@ -83,6 +84,20 @@ set_virt_mac() { slxlog "virt-mac" "Could not properly generate mac address suffix (got $MACADDRSUFFIX)" fi declare -g VM_MAC_ADDR="$MACADDRPREFIX:$MACADDRSUFFIX" + declare -g OTHER_NICS= + # Set up additional NICs if enabled + if [ "$SLX_BRIDGE_OTHER_NICS" = "yes" ]; then + for i in /sys/class/net/br-nic-*/address; do + [ -s "$i" ] || continue + mac=$(tr '[a-f]' '[A-F]' < "$i") + # Calc checksum of mac by summing the bytes mod 256 + byte=$(( $(<<<$mac sed 's/^/ ( 0x/;s/:/ + 0x/g;s/$/ ) % 256/') )) + byte=$(printf "%02X" "$byte") + # (PR:EF:IX):LA:ST:CH - use general prefix for VMs, then last two octets of source mac, plus the checksum + mac="${MACADDRPREFIX}:${mac:12:5}:${byte}" + OTHER_NICS+=" $mac" + done + fi } # Virtual fd/cd/dvd and drive devices, floppy b: for configuration diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc index 61a73bb2..42740059 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/setup_virtual_floppy.inc @@ -83,7 +83,15 @@ setup_virtual_floppy() { # which is coincidentally the one we received from dmsd :) if load_dmsd_resource NETSHARES; then if [ -s "${NETSHARES}" ]; then - cat $NETSHARES >> "${SHARES}" + # try to detect if we are running windows and replace '/' with '\' + # in an attempt to fix an improperly given samba path + cmd=(cat) + if [[ "$( tr '[A-Z]' '[a-z]' <<< ${VM_OS_TYPE})" = *windows* ]]; then + cmd=(tr / '\\') + fi + < $NETSHARES "${cmd[@]}" >> "${SHARES}" + # replace the tag for the username, if present + sed -i 's/%loginuser%/'"${USER}"'/g' "${SHARES}" fi fi @@ -108,8 +116,10 @@ setup_virtual_floppy() { createMissingRemap=${SHARE_CREATE_MISSING_REMAP} remapMode=${SHARE_REMAP_MODE_INI} homeDrive=${SHARE_HOME_DRIVE} + megaDrive=SEGA scriptExt=${EXT} passCreds=${SHARE_CREDENTIAL_PASSTHROUGH} + bootIp=${SLX_PXE_CLIENT_IP} [remap] documents=${SHARE_DOCUMENTS} diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/usb_detector.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/usb_detector.inc index 0fa60aa7..2d8b60dd 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/usb_detector.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt.d/usb_detector.inc @@ -2,8 +2,25 @@ ################################################## # Include: Detect and pass USB devices to the VM # ################################################## -# TODO USB devices -declare -rg PASSTHROUGH_USB_DEVICES="2 0:5 0:6 0:7 0:14 0:16 0:17 239" + +declare -g PASSTHROUGH_USB_DEVICES="2 0:5 0:6 0:7 0:14 0:16 0:17 239" + +# include USB IDs explicitly given by SLX_PASSTHROUGH_USB_ID +# which is expected to be a space-separated list! +. /opt/openslx/config +if [ -n "${SLX_PASSTHROUGH_USB_ID}" ]; then + while IFS= read -ra USB_ID; do + for ID in ${USB_ID[@]}; do + # validate each entry and add them to the list if they pass + if ! [[ "${ID}" =~ ^[0-9a-f]{4}:[0-9a-f]{4}$ ]]; then + writelog "Rejected USB ID: '${ID}'." + continue + fi + PASSTHROUGH_USB_DEVICES+=" ${ID}" + done + done <<< "${SLX_PASSTHROUGH_USB_ID}" +fi +readonly PASSTHROUGH_USB_DEVICES # Helper function that will scan /dev/bus/usb for devices matching specific classes # and then output the corresponding device ids. This can be used for selective @@ -62,7 +79,8 @@ get_usb_devices_int() { [[ "$MATCH" == *";${DC}:${value};"* ]] && OK=yo fi fi - if [ -n "$OK" -a -n "$VENDOR" -a -n "$PRODUCT" ]; then + if [ -n "$OK" -a -n "$VENDOR" -a -n "$PRODUCT" ] || \ + [[ "$MATCH" == *";${VENDOR}:${PRODUCT};"* ]]; then echo "$EXP" | sed "s/%VENDOR%/${VENDOR}/g;s/%PRODUCT%/${PRODUCT}/g" break fi diff --git a/core/modules/run-virt/winres/src/winres.c b/core/modules/run-virt/winres/src/winres.c index 4ed18555..1a28c916 100644 --- a/core/modules/run-virt/winres/src/winres.c +++ b/core/modules/run-virt/winres/src/winres.c @@ -870,7 +870,11 @@ static void postSuccessfulMount(const netdrive_t *d, wchar_t *letter) MultiByteToWideChar(CP_UTF8, 0, d->path, -1, tmp, MAX_PATH); StringCchPrintfW(wTarget, MAX_PATH, L"\"%s\"", tmp); DeleteFileW(wShortcut); - createFolderShortcut(wTarget, wShortcut, letter); + if (letter == NULL || *letter == '\0' || d->path[0] == '\\' || d->path[1] == '\\') { + createFolderShortcut(wTarget, wShortcut, letter); + } else { + createFolderShortcut(letter, wShortcut, letter); + } // Fix paths and kill explorer if it's the home directory if (_folderStatus != FS_OK && strncmp(d->shortcut, "Home-", 5) == 0) { BOOL isVmware = strcmp(d->path, "\\\\vmware-host\\Shared Folders\\home") == 0; diff --git a/core/modules/safe-mode/data/etc/systemd/system/exam-mode.target b/core/modules/safe-mode/data/etc/systemd/system/exam-mode.target new file mode 100644 index 00000000..66438593 --- /dev/null +++ b/core/modules/safe-mode/data/etc/systemd/system/exam-mode.target @@ -0,0 +1,4 @@ +[Unit] +Description=bwLehrpool Klausurmodus +Requires=multi-user.target +After=multi-user.target diff --git a/core/modules/safe-mode/data/etc/systemd/system/exam-mode.target.wants/exam.service b/core/modules/safe-mode/data/etc/systemd/system/exam-mode.target.wants/exam.service new file mode 120000 index 00000000..4ee9b5fa --- /dev/null +++ b/core/modules/safe-mode/data/etc/systemd/system/exam-mode.target.wants/exam.service @@ -0,0 +1 @@ +../exam.service
\ No newline at end of file diff --git a/core/modules/safe-mode/data/etc/systemd/system/exam-mode.target.wants/graphical.target b/core/modules/safe-mode/data/etc/systemd/system/exam-mode.target.wants/graphical.target new file mode 120000 index 00000000..949b0756 --- /dev/null +++ b/core/modules/safe-mode/data/etc/systemd/system/exam-mode.target.wants/graphical.target @@ -0,0 +1 @@ +../graphical.target
\ No newline at end of file diff --git a/core/modules/safe-mode/data/etc/systemd/system/exam.service b/core/modules/safe-mode/data/etc/systemd/system/exam.service index be0809b4..14473a6f 100644 --- a/core/modules/safe-mode/data/etc/systemd/system/exam.service +++ b/core/modules/safe-mode/data/etc/systemd/system/exam.service @@ -1,6 +1,7 @@ [Unit] Description=Sets up safe mode (no magic keys, no tty switch, no openbox menu) DefaultDependencies=no +Before=graphical.target display-manager.target [Service] Type=oneshot diff --git a/core/modules/safe-mode/data/opt/openslx/scripts/systemd-safe_mode b/core/modules/safe-mode/data/opt/openslx/scripts/systemd-safe_mode index ebcee099..0da51848 100755 --- a/core/modules/safe-mode/data/opt/openslx/scripts/systemd-safe_mode +++ b/core/modules/safe-mode/data/opt/openslx/scripts/systemd-safe_mode @@ -19,6 +19,47 @@ disable_magic_keys() { echo 0 > /proc/sys/kernel/sysrq } +change_loginscreen() { + local CF="/etc/lightdm/qt-lightdm-greeter.conf" + sed -r -i 's/#[a-fA-F0-9]{6}/#757575/g' "/opt/openslx/lightdm/bwlp-banner.svg" + sed -r -i '/^greeter-background/d' "$CF" + echo "greeter-background-gradient=f9a72b ffffff" >> "$CF" +} + +systemd_config() { + # Disable ctrl-alt-delete + rm -- "/usr/lib/systemd/system/ctrl-alt-del.target" + # No idleaction + rm -- "/etc/cron.d/openslx-idleaction" + # Ignore everything but power button, no VTs + cat > "${FUTURE_ROOT}/etc/systemd/logind.conf" <<EOF +[Login] +NAutoVTs=0 +ReserveVT=0 +KillUserProcesses=no +HandlePowerKey=poweroff +HandleSuspendKey=ignore +HandleHibernateKey=ignore +HandleLidSwitch=ignore +IdleAction=ignore +EOF + # reload + systemd daemon-reload + systemctl restart systemd-logind +} + +ssh_banner() { + # Visual: ssh banner + echo "+ - - - - KLAUSURMODUS AKTIV - - - - +" >> "/etc/issue.net" + echo "++++++++++++++++++++++++++++++++++++++" >> "/etc/issue.net" +} + disable_tty_switch disable_openbox_menu disable_magic_keys +change_loginscreen +systemd_config +ssh_banner + +exit 0 + diff --git a/core/modules/screen-standby/module.build b/core/modules/screen-standby/module.build index 5fa3a36f..8de1bdd1 100644 --- a/core/modules/screen-standby/module.build +++ b/core/modules/screen-standby/module.build @@ -4,6 +4,16 @@ fetch_source() { } build() { + + for BIN in $REQUIRED_BINARIES; do + BIN_LOCATION=$(which ${BIN}) + if [ ! -z ${BIN_LOCATION} -a -e ${BIN_LOCATION} ]; then + tarcopy "$(get_link_chain ${BIN_LOCATION})" "${MODULE_BUILD_DIR}" + else + perror "'${BIN}' not found on the system." + fi + done + COPYLIST="list_dpkg_output" list_packet_files > "$COPYLIST" tarcopy "$(cat "${COPYLIST}" | sort -u)" "${MODULE_BUILD_DIR}" diff --git a/core/modules/screen-standby/module.conf b/core/modules/screen-standby/module.conf index da54d2dd..1e03a8b8 100644 --- a/core/modules/screen-standby/module.conf +++ b/core/modules/screen-standby/module.conf @@ -1,5 +1,10 @@ #!/bin/bash +REQUIRED_MODULES=" + xorg +" REQUIRED_BINARIES=" + setterm + xset " REQUIRED_LIBRARIES="" REQUIRED_DIRECTORIES=" diff --git a/core/modules/slxbrowser/data/opt/openslx/lightdm/autologin.d/00-check-slxbrowser b/core/modules/slxbrowser/data/opt/openslx/lightdm/autologin.d/00-check-slxbrowser new file mode 100644 index 00000000..4fe45c02 --- /dev/null +++ b/core/modules/slxbrowser/data/opt/openslx/lightdm/autologin.d/00-check-slxbrowser @@ -0,0 +1,10 @@ +#!/bin/ash +# This file is SOURCED + +# Kiosk mode? +if [ -n "$SLX_BROWSER_URL" ]; then + exec /opt/openslx/scripts/kiosk-launch +fi + +true + diff --git a/core/modules/slxbrowser/data/opt/openslx/scripts/kiosk-launch b/core/modules/slxbrowser/data/opt/openslx/scripts/kiosk-launch index ed8a205f..566bbb16 100755 --- a/core/modules/slxbrowser/data/opt/openslx/scripts/kiosk-launch +++ b/core/modules/slxbrowser/data/opt/openslx/scripts/kiosk-launch @@ -9,5 +9,10 @@ xset -dpms openbox & -exec slxbrowser --insecure --fullscreen "$SLX_BROWSER_URL" +[ -n "$SLX_BROWSER_INSECURE" ] && SLX_BROWSER_INSECURE="--insecure" +RELOAD= +[ -n "$SLX_BROWSER_RELOAD_SECS" ] && [ "$SLX_BROWSER_RELOAD_SECS" -gt 0 ] && RELOAD="--reload-interval $SLX_BROWSER_RELOAD_SECS" + +xdotool mousemove 20000 20000 & +exec slxbrowser $SLX_BROWSER_INSECURE $RELOAD --fullscreen "$SLX_BROWSER_URL" diff --git a/core/modules/speedcheck/module.conf.debian b/core/modules/speedcheck/module.conf.debian index 1e09c702..600d3ab3 100644 --- a/core/modules/speedcheck/module.conf.debian +++ b/core/modules/speedcheck/module.conf.debian @@ -1,5 +1,5 @@ #!/bin/bash -REQUIRED_INSTALLED_PACKAGES=" +REQUIRED_INSTALLED_PACKAGES=" cmake - libqt4-dev + libqt5gui5 " diff --git a/core/modules/speedcheck/module.conf.opensuse b/core/modules/speedcheck/module.conf.opensuse deleted file mode 100644 index d3bd2b76..00000000 --- a/core/modules/speedcheck/module.conf.opensuse +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -REQUIRED_INSTALLED_PACKAGES=" - cmake - libqt4-devel -" diff --git a/core/modules/speedcheck/module.conf.ubuntu b/core/modules/speedcheck/module.conf.ubuntu index 1e09c702..4c2251ad 100644 --- a/core/modules/speedcheck/module.conf.ubuntu +++ b/core/modules/speedcheck/module.conf.ubuntu @@ -1,5 +1,5 @@ #!/bin/bash REQUIRED_INSTALLED_PACKAGES=" - cmake - libqt4-dev + cmake + libqt5gui5 " diff --git a/core/modules/sshd/module.build b/core/modules/sshd/module.build index 3420084f..fed20806 100644 --- a/core/modules/sshd/module.build +++ b/core/modules/sshd/module.build @@ -17,5 +17,5 @@ build() { post_copy() { mkdir -p "${TARGET_BUILD_DIR}/var/lib/empty" # suse - chmod go-rwx "${TARGET_BUILD_DIR}/etc/ssh/"* # no space, " before * + chmod -R go-rwx "${TARGET_BUILD_DIR}/etc/ssh" } diff --git a/core/modules/sssd/data/etc/systemd/system/sleep.target.wants/sssd-resume-fix.service b/core/modules/sssd/data/etc/systemd/system/sleep.target.wants/sssd-resume-fix.service new file mode 120000 index 00000000..3a96d5a9 --- /dev/null +++ b/core/modules/sssd/data/etc/systemd/system/sleep.target.wants/sssd-resume-fix.service @@ -0,0 +1 @@ +../sssd-resume-fix.service
\ No newline at end of file diff --git a/core/modules/sssd/data/etc/systemd/system/sssd-resume-fix.service b/core/modules/sssd/data/etc/systemd/system/sssd-resume-fix.service new file mode 100644 index 00000000..bad4e4be --- /dev/null +++ b/core/modules/sssd/data/etc/systemd/system/sssd-resume-fix.service @@ -0,0 +1,11 @@ +[Unit] +Description=Restart sssd after system resume to fix LDAP temporarily being unavailable +DefaultDependencies=no +After=systemd-suspend.service systemd-hybrid-sleep.service systemd-hibernate.service +RefuseManualStart=true + +[Service] +Type=oneshot +ExecStart=/opt/openslx/scripts/systemd-sssd_restart +RemainAfterExit=no + diff --git a/core/modules/sssd/data/opt/openslx/scripts/systemd-patch_sssd_conf b/core/modules/sssd/data/opt/openslx/scripts/systemd-patch_sssd_conf new file mode 100755 index 00000000..dfdfb6de --- /dev/null +++ b/core/modules/sssd/data/opt/openslx/scripts/systemd-patch_sssd_conf @@ -0,0 +1,10 @@ +#!/bin/ash + +LIST="$(< /etc/passwd awk -F: '{printf $1 ","}')" +sed -i "s/^filter_users.*\$/filter_users = ${LIST%,}/g" /etc/sssd/sssd.conf + +LIST="$(< /etc/group awk -F: '{printf $1 ","}')" +sed -i "s/^filter_groups.*\$/filter_groups = ${LIST%,}/g" /etc/sssd/sssd.conf + +exit 0 + diff --git a/core/modules/sssd/templates/sssd-systemd.service b/core/modules/sssd/templates/sssd-systemd.service index 9132d64a..c691759a 100644 --- a/core/modules/sssd/templates/sssd-systemd.service +++ b/core/modules/sssd/templates/sssd-systemd.service @@ -5,10 +5,10 @@ After=syslog.target [Service] EnvironmentFile=-/etc/sysconfig/sssd -ExecStart=%PATH% -D -f +ExecStartPre=/opt/openslx/scripts/systemd-patch_sssd_conf +ExecStart=%PATH% -i -f # These two should be used with traditional UNIX forking daemons # consult systemd.service(5) for more details -Type=forking PIDFile=/var/run/sssd.pid Restart=on-failure diff --git a/core/modules/system-uuid/data/bin/get-uuid b/core/modules/system-uuid/data/bin/get-uuid index 30ef3cf9..ad2cdba4 100755 --- a/core/modules/system-uuid/data/bin/get-uuid +++ b/core/modules/system-uuid/data/bin/get-uuid @@ -13,7 +13,7 @@ fi UUID=$(dmidecode -q -s system-uuid | grep -v '^#' | head -n 1 | tr '[a-z]' '[A-Z]') if [ "${#UUID}" -ne "36" ]; then echo "Determined UUID (${UUID}) has not expected length of 36, falling back to MAC..." - UUID="000000000000000-$BOOTIF" + UUID="000000000000001-$BOOTIF" else # Got UUID, check blacklist DIR="/opt/openslx/bad-uuid.d" diff --git a/core/modules/systemd/data/etc/systemd/system/network-interface@.service b/core/modules/systemd/data/etc/systemd/system/network-interface@.service index ea9cc56e..9da35a5c 100644 --- a/core/modules/systemd/data/etc/systemd/system/network-interface@.service +++ b/core/modules/systemd/data/etc/systemd/system/network-interface@.service @@ -5,5 +5,5 @@ Before=dhcpc@%i.service [Service] Type=simple -ExecStart=/opt/openslx/sbin/ip link set dev %I up +ExecStart=/opt/openslx/sbin/ip link set dev %i up diff --git a/core/modules/systemd/data/usr/lib/udev/rules.d/99-systemd.rules b/core/modules/systemd/data/usr/lib/udev/rules.d/99-systemd.rules index 99cdf676..77ef9615 100644 --- a/core/modules/systemd/data/usr/lib/udev/rules.d/99-systemd.rules +++ b/core/modules/systemd/data/usr/lib/udev/rules.d/99-systemd.rules @@ -33,7 +33,7 @@ SUBSYSTEM=="block", KERNEL!="ram*|loop*", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_T SUBSYSTEM=="net", KERNEL=="eth*", TAG=="openslxignore", GOTO="systemd_end" -SUBSYSTEM=="net", KERNEL=="br0|eth*", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/net/devices/$name", ENV{SYSTEMD_WANTS}="network-interface@$name.service" +SUBSYSTEM=="net", KERNEL=="br0|br-nic-*", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/net/devices/$name", ENV{SYSTEMD_WANTS}="network-interface@$name.service" SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/bluetooth/devices/%k" SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_WANTS}="bluetooth.target" diff --git a/core/modules/systemd/module.build b/core/modules/systemd/module.build index eba706ca..4ed9b57e 100644 --- a/core/modules/systemd/module.build +++ b/core/modules/systemd/module.build @@ -26,6 +26,31 @@ fetch_source () { # However, there were lots of changes after systemd 204, so we didn't update yet # See http://cgit.freedesktop.org/systemd/systemd/tree/NEWS for changes. patch -p0 src/systemd-*/src/core/main.c < ${MODULE_DIR}/systemd-openslx.patch || perror "Failed to apply openslx systemd patch." + # fix mtd_probe.h missing an include for stdint.h, those types probably used to + # be defined elsewhere and that was change with newer libc versions + patch -p0 src/systemd-*/src/udev/mtd_probe/mtd_probe.h < ${MODULE_DIR}/systemd-204-mtd_probe.patch || perror "Failed to apply mtd_probe.h patch." + # systemd-204 requires gperf 3.0.4 for generating internal code, + # starting with ubuntu 17.10, gperf is only available in version 3.1.1. + # launchpad has the correct version: https://launchpad.net/ubuntu/artful/amd64/gperf/3.0.4-2 + if which gperf &> /dev/null; then + LOCAL_GPERF_VER="$(gperf --version | head -1 | awk '{print $3}')" + if [ "x${LOCAL_GPERF_VER}" != "x3.0.4" ]; then + # bad version, no force removal + perror "gperf version '3.0.4' expected but '${LOCAL_GPERF_VER}' is installed. Please remove it and try again." + fi + else + # no gperf installed, install it from launchpad + REQUIRED_GPERF_URL="http://launchpadlibrarian.net/214035609/gperf_3.0.4-2_amd64.deb" + pinfo "Downloading gperf from '${REQUIRED_GPERF_URL}'..." + if ! wget -P "${MODULE_WORK_DIR}" "${REQUIRED_GPERF_URL}"; then + perror "Failed to download '${REQUIRED_GPERF_URL}'." + fi + pinfo "Installing gperf from '${MODULE_WORK_DIR}/${REQUIRED_GPERF_URL##*/}'..." + if ! dpkg -i "${MODULE_WORK_DIR}/${REQUIRED_GPERF_URL##*/}"; then + perror "Failed to install '${MODULE_WORK_DIR}/${REQUIRED_GPERF_URL##*/}'." + fi + fi + elif [ "x${REQUIRED_VERSION#systemd-}" = "x229" ]; then patch -p0 src/systemd-*/src/basic/path-util.h < ${MODULE_DIR}/systemd-openslx-229.patch || perror "Failed to apply openslx systemd patch." else diff --git a/core/modules/systemd/module.conf.ubuntu b/core/modules/systemd/module.conf.ubuntu index 04752c0b..09233f45 100644 --- a/core/modules/systemd/module.conf.ubuntu +++ b/core/modules/systemd/module.conf.ubuntu @@ -1,7 +1,6 @@ #!/bin/bash REQUIRED_INSTALLED_PACKAGES=" intltool - gperf dbus libcap-dev libudev-dev diff --git a/core/modules/systemd/systemd-204-mtd_probe.patch b/core/modules/systemd/systemd-204-mtd_probe.patch new file mode 100644 index 00000000..5486da66 --- /dev/null +++ b/core/modules/systemd/systemd-204-mtd_probe.patch @@ -0,0 +1,10 @@ +--- udev/mtd_probe/mtd_probe.h.pre 2017-11-30 10:22:58.370237301 +0100 ++++ udev/mtd_probe/mtd_probe.h 2017-11-23 17:23:44.437540620 +0100 +@@ -18,6 +18,7 @@ + */ + + #include <mtd/mtd-user.h> ++#include <stdint.h> + + /* Full oob structure as written on the flash */ + struct sm_oob { diff --git a/core/modules/udisks/module.conf.ubuntu.17 b/core/modules/udisks/module.conf.ubuntu.17 new file mode 100644 index 00000000..0a703589 --- /dev/null +++ b/core/modules/udisks/module.conf.ubuntu.17 @@ -0,0 +1,7 @@ +#!/bin/bash +REQUIRED_INSTALLED_PACKAGES=" + udisks2 +" +REQUIRED_CONTENT_PACKAGES=" + udisks2 +" diff --git a/core/modules/vbox-src/LocalConfig.kmk b/core/modules/vbox-src/LocalConfig.kmk new file mode 100644 index 00000000..dc84240b --- /dev/null +++ b/core/modules/vbox-src/LocalConfig.kmk @@ -0,0 +1,8 @@ +VBOX_PATH_APP_PRIVATE_ARCH := /usr/lib/virtualbox +VBOX_PATH_SHARED_LIBS := $(VBOX_PATH_APP_PRIVATE_ARCH) +VBOX_WITH_ORIGIN := +VBOX_WITH_RUNPATH := $(VBOX_PATH_APP_PRIVATE_ARCH) +VBOX_PATH_APP_PRIVATE := /usr/share/virtualbox +VBOX_PATH_APP_DOCS := /usr/share/doc/virtualbox +VBOX_WITH_TESTCASES := +VBOX_WITH_TESTSUITE := diff --git a/core/modules/vbox-src/data/addon-init b/core/modules/vbox-src/data/addon-init new file mode 100755 index 00000000..cd547549 --- /dev/null +++ b/core/modules/vbox-src/data/addon-init @@ -0,0 +1,6 @@ +#!/bin/ash + +systemctl daemon-reload +systemctl start vbox +exit 0 + diff --git a/core/modules/vbox-src/data/etc/systemd/system/graphical.target.wants/vbox.service b/core/modules/vbox-src/data/etc/systemd/system/graphical.target.wants/vbox.service new file mode 120000 index 00000000..b8591bd1 --- /dev/null +++ b/core/modules/vbox-src/data/etc/systemd/system/graphical.target.wants/vbox.service @@ -0,0 +1 @@ +../vbox.service
\ No newline at end of file diff --git a/core/modules/vbox-src/data/etc/systemd/system/vbox.service b/core/modules/vbox-src/data/etc/systemd/system/vbox.service new file mode 100644 index 00000000..6b6347da --- /dev/null +++ b/core/modules/vbox-src/data/etc/systemd/system/vbox.service @@ -0,0 +1,9 @@ +[Unit] +Description=Sets up the virtual box environment +Requires=run-virt-env.service setup-partitions.service network.target +After=run-virt-env.service setup-partitions.service network.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/opt/openslx/scripts/systemd-vbox_env diff --git a/core/modules/vbox-src/data/etc/udev/rules.d/60-vboxdrv.rules b/core/modules/vbox-src/data/etc/udev/rules.d/60-vboxdrv.rules new file mode 100644 index 00000000..59990d74 --- /dev/null +++ b/core/modules/vbox-src/data/etc/udev/rules.d/60-vboxdrv.rules @@ -0,0 +1,7 @@ +KERNEL=="vboxdrv", NAME="vboxdrv", OWNER="root", GROUP="root", MODE="0600" +KERNEL=="vboxdrvu", NAME="vboxdrvu", OWNER="root", GROUP="root", MODE="0666" +KERNEL=="vboxnetctl", NAME="vboxnetctl", OWNER="root", GROUP="root", MODE="0660" +SUBSYSTEM=="usb_device", ACTION=="add", ENV{PATH}="/usr/bin:/bin:/usr/sbin:/sbin:/opt/openslx/bin:/opt/openslx/sbin", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}" +SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ENV{PATH}="/usr/bin:/bin:/usr/sbin:/sbin:/opt/openslx/bin:/opt/openslx/sbin", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}" +SUBSYSTEM=="usb_device", ACTION=="remove", ENV{PATH}="/usr/bin:/bin:/usr/sbin:/sbin:/opt/openslx/bin:/opt/openslx/sbin", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor" +SUBSYSTEM=="usb", ACTION=="remove", ENV{DEVTYPE}=="usb_device", ENV{PATH}="/usr/bin:/bin:/usr/sbin:/sbin:/opt/openslx/bin:/opt/openslx/sbin", RUN+="/usr/lib/virtualbox/VBoxCreateUSBNode.sh --remove $major $minor" diff --git a/core/modules/vbox-src/data/opt/openslx/scripts/pam_script_auth.d/20-vbox b/core/modules/vbox-src/data/opt/openslx/scripts/pam_script_auth.d/20-vbox new file mode 100644 index 00000000..00d7cab2 --- /dev/null +++ b/core/modules/vbox-src/data/opt/openslx/scripts/pam_script_auth.d/20-vbox @@ -0,0 +1,4 @@ +getent group vboxusers || addgroup -S vboxusers +adduser "${PAM_USER}" "vboxusers" +true + diff --git a/core/modules/vbox-src/data/opt/openslx/scripts/systemd-vbox_env b/core/modules/vbox-src/data/opt/openslx/scripts/systemd-vbox_env new file mode 100755 index 00000000..f3267ebd --- /dev/null +++ b/core/modules/vbox-src/data/opt/openslx/scripts/systemd-vbox_env @@ -0,0 +1,61 @@ +#!/bin/ash +# ----------------------------------------------------------------------------- +# Copyright (c) 2007..2013 - RZ Uni FR +# Copyright (c) 2007..2013 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# systemd-vbox_env +# - This is the preparation script for the configuration of VirtualBox. +################################################################################ + +export PATH="$PATH":/opt/openslx/bin:/opt/openslx/sbin + +## sanity checks +VBOX_BASE_DIR="/usr/lib/virtualbox" +VBOX_KMOD_DIR="/lib/modules/vbox" +# VBoxManage should be under /usr/lib/virtualbox +if ! [ -d "${VBOX_BASE_DIR}" -o -x "${VBOX_BASE_DIR}/VBoxManage" -o "${VBOX_KMOD_DIR}" ]; then + echo "Failed to find VirtualBox installation at expected paths." + exit 1 +fi + +# create required standard directories +mkdir -p "/tmp/virt/virtualbox" -m 1777 + +# load required Vbox modules +cd "${VBOX_KMOD_DIR}" +for MOD in *; do + insmod "${MOD}" || slxlog "vbox-setup" "Loading of ${MOD} failed." +done + +# check/create vboxusers group +getent group vboxusers || addgroup -S vboxusers + +chown root:vboxusers /dev/vboxdrv +chmod 666 /dev/vboxdrv +chown root:vboxusers /dev/vboxdrvu +chmod 666 /dev/vboxdrvu +#chown root:vboxusers /dev/vboxusb +#chmod 755 /dev/vboxusb + +# pretty dumb you can just create host-only interfaces, +# but not assign a specific name/number +VBOXMANAGE="${VBOX_BASE_DIR}/VBoxManage" +${VBOXMANAGE} hostonlyif create +ip link set dev vboxnet0 up +brctl addif br0 vboxnet0 + +${VBOXMANAGE} hostonlyif create +ip link set dev vboxnet1 up +brctl addif nat1 vboxnet1 + +${VBOXMANAGE} hostonlyif create +ip link set dev vboxnet2 up +brctl addif vsw2 vboxnet2 diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/empty-diff.vdi.gz b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/empty-diff.vdi.gz Binary files differnew file mode 100644 index 00000000..c6abbd57 --- /dev/null +++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/empty-diff.vdi.gz diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/create_vbox_config.inc b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/create_vbox_config.inc new file mode 100755 index 00000000..e432472f --- /dev/null +++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/create_vbox_config.inc @@ -0,0 +1,48 @@ +################################################################################ +# Include: create main vbox config file and add machine, hdd, ... entries # +################################################################################ +create_vbox_config() { + # generate random machine/floppies UUIDs + declare -rg MACHINE_UUID="$(gen_uuid)" + declare -rg SLX_FLOPPY_UUID="$(gen_uuid)" + + cat <<EOF > "${VBOX_ROOT}/VirtualBox.xml" +<VirtualBox xmlns="http://www.innotek.de/VirtualBox-settings" version="1.12-linux"> + <Global> + <ExtraData> + <ExtraDataItem name="GUI/Input/AutoCapture" value="true"/> + <!-- Host Key: left ctrl + left winkey + left alt --> + <ExtraDataItem name="GUI/Input/HostKeyCombination" value="65507,65513,65515"/> + <ExtraDataItem name="GUI/LastVMSelected" value="${MACHINE_UUID}"/> + <ExtraDataItem name="GUI/HostScreenSaverDisabled" value="false"/> + <ExtraDataItem name="GUI/LicenseAgreed" value="1,2,3,4,5,6,7,8,9"/> + <ExtraDataItem name="GUI/MaxGuestResolution" value="any"/> <!-- auto, width,height --> + <ExtraDataItem name="GUI/UpdateCheckCount" value="2"/> + <ExtraDataItem name="GUI/UpdateDate" value="never"/> + <ExtraDataItem name="GUI/SuppressMessages" value=",remindAboutAutoCapture,confirmInputCapture,remindAboutWrongColorDepth,confirmGoingFullscreen,remindAboutMouseIntegrationOn,remindAboutMouseIntegrationOff,showRuntimeError.warning.DevATA_DISKFULL,remindAboutPausedVMInput,confirmVMReset,showRuntimeError.warning.HostAudioNotResponding,showRuntimeError.warning.ExtPackNoEhci,remindAboutMouseIntegration"/> + <ExtraDataItem name="GUI/TrayIcon/Enabled" value="false"/> + </ExtraData> + <MachineRegistry> + <MachineEntry uuid="{${MACHINE_UUID}}" src="Machines/${VM_CLEANNAME}/${VM_CLEANNAME}.xml"/> + </MachineRegistry> + <MediaRegistry> + <HardDisks> + <HardDisk uuid="{${HDD_UUID}}" location="${VBOX_HDD_LINK}" format="${VBOX_HDD_FORMAT}" type="${VBOX_HDD_TYPE}"> + <HardDisk uuid="{${SNAPSHOT_UUID}}" location="${VBOX_SNAPSHOT_DIR}/{${SNAPSHOT_UUID}}.vdi" format="VDI" autoReset="true"/> + </HardDisk> + </HardDisks> + <FloppyImages> + <Image uuid="{${SLX_FLOPPY_UUID}}" location="${SLX_FLOPPY_IMG}"/> + </FloppyImages> + </MediaRegistry> + <NetserviceRegistry> + <DHCPServers/> + </NetserviceRegistry> + <SystemProperties defaultMachineFolder="${VBOX_MACHINES_DIR}" defaultHardDiskFolder="${VBOX_HDD_DIR}" defaultHardDiskFormat="VDI" remoteDisplayAuthLibrary="VBoxAuth" webServiceAuthLibrary="VBoxAuth" LogHistoryCount="3"/> + <USBDeviceFilters/> + </Global> +</VirtualBox> +EOF +} + +call_post_source create_vbox_config diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/finalize_machine_config.inc b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/finalize_machine_config.inc new file mode 100755 index 00000000..91286a41 --- /dev/null +++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/finalize_machine_config.inc @@ -0,0 +1,86 @@ +################################################################################ +# Include: write final machine configuration file # +################################################################################ +finalize_machine_config() { + # Expected path to the final vbox file + VBOX_MACHINE_CONFIG="${VBOX_MACHINES_DIR}/${VM_CLEANNAME}/${VM_CLEANNAME}.xml" + + # remove ':' from MAC addr for vbox and generate a VDE (virtual device ethernet) + # MAC addr from the first one (put in prefix 00DE) + VM_MAC_ADDR=$(echo ${VM_MAC_ADDR} | sed 's/://g') + VM_VDE_MAC_ADDR=$(echo ${VM_MAC_ADDR} | sed 's/^..../00DE/g') + + # translate network kinds (nat, bridged, host-only) + # TODO: Server should prepare this in returned xml + case "${network_kind}" in + bridge*) + network_kind='HostOnlyInterface name="vboxnet0"' + ;; + host*) + network_kind='HostOnlyInterface name="vboxnet2"' + ;; + *) + network_kind='HostOnlyInterface name="vboxnet1"' + esac + + sed -i "s,%VM_DISK_REDOLOGDIR%,$VBOX_SNAPSHOT_DIR,g" $TMPCONFIG + sed -i "s,%VM_DISK_PATH%,${VBOX_HDD_LINK},g" $TMPCONFIG + sed -i "s/#OpenSLX_MUUID_place_holder/{${MACHINE_UUID}}/g" $TMPCONFIG + sed -i "0,/#OpenSLX_HDDUUID_0_placeholder/ s/#OpenSLX_HDDUUID_0_placeholder/{${HDD_UUID}}/" $TMPCONFIG + sed -i "0,/#OpenSLX_HDDUUID_0_placeholder/ s/#OpenSLX_HDDUUID_0_placeholder/{${SNAPSHOT_UUID}}/" $TMPCONFIG + sed -i 's,#OpenSLX_CPU_place_holder,'"${CPU_CORES}"',g' $TMPCONFIG + sed -i 's,#OpenSLX_MEMORY_place_holder,'"${VM_MEM}"',g' $TMPCONFIG + + # Add a HardDisk node for the snapshot + add_node \ + "/VirtualBox/Machine/MediaRegistry/HardDisks/HardDisk" "HardDisk" \ + "uuid={${SNAPSHOT_UUID}}" \ + "location=$VBOX_SNAPSHOT_DIR/{${SNAPSHOT_UUID}}.vdi" \ + "format=VDI" \ + "type=Normal" + # add storage controller and 2 floppies to it + add_node \ + "/VirtualBox/Machine/StorageControllers" "StorageController" \ + "name=Floppy" \ + "type=I82078" \ + "PortCount=1" \ + "useHostIOCache=true" + add_node \ + '/VirtualBox/Machine/StorageControllers/StorageController[@name="Floppy"]' "AttachedDevice" \ + "type=Floppy" \ + "hotpluggable=false" \ + "port=0" \ + "device=0" + add_node \ + '/VirtualBox/Machine/StorageControllers/StorageController[@name="Floppy"]' "AttachedDevice" \ + "type=Floppy" \ + "hotpluggable=false" \ + "port=0" \ + "device=1" + + # add the slx floppy to the second drive + add_node \ + '/VirtualBox/Machine/StorageControllers/StorageController/AttachedDevice[@device="1"]' "Image" \ + "uuid={${SLX_FLOPPY_UUID}}" + + + # set the MAC address + edit_attr "/VirtualBox/Machine/Hardware/Network/Adapter" "MACAddress" "${VM_VDE_MAC_ADDR}" + + # check if KVM is available and activate it if so + if source /run/hwinfo && [ "${HW_KVM}" = "ENABLED" ]; then + edit_attr --create "/VirtualBox/Machine/Hardware/Paravirt" "provider" "KVM" + fi + # activate IOAPIC needed for multi core (?) + if [ $CPU_CORES -gt 1 ]; then + edit_attr --create "/VirtualBox/Machine/Hardware/BIOS/IOAPIC" "enabled" "true" + fi + + # TODO fix usb generally, just delete it if present for now .... + del_node "/VirtualBox/Machine/Hardware/USB" + + cp $TMPCONFIG /tmp/vbox-last-config + cp $TMPCONFIG $VBOX_MACHINE_CONFIG +} + +call_post_source finalize_machine_config diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/guest_hardware_limits.inc b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/guest_hardware_limits.inc new file mode 100755 index 00000000..224bccde --- /dev/null +++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/guest_hardware_limits.inc @@ -0,0 +1,118 @@ +################################################################################ +# Include: Set hardware limitations determined by the guest os type # +################################################################################ + +set_hardware_limits() { + #SHARED_FOLDERS="TRUE" + #enablevt="true" + #enable2d + #enable3d + + # set some base configuration depending on the guest operating system + # NOTE: list supported OS type with: VBoxManage list ostypes + case "${VM_OS_TYPE}" in + Windows31) + MAXCORES="1" + MAXMEM="32" + MAXVRAM="16" + SHARED_FOLDERS="FALSE" + ;; + WindowsNT*) + MAXCORES="4" + MAXMEM="1024" + MAXVRAM="32" + SHARED_FOLDERS="FALSE" + ;; + Windows95) + MAXCORES="1" + MAXMEM="128" + MAXVRAM="32" + SHARED_FOLDERS="FALSE" + ;; + Windows98) + MAXCORES="1" + MAXMEM="256" + MAXVRAM="64" + SHARED_FOLDERS="FALSE" + ;; + WindowsMe) + MAXCORES="1" + MAXMEM="384" + MAXVRAM="64" + SHARED_FOLDERS="FALSE" + ;; + Windows2000|Windows2003) + MAXCORES="4" + MAXMEM="4000" + MAXVRAM="128" + SHARED_FOLDERS="FALSE" + ;; + Windows2003_64|WindowsXP_64) + MAXCORES="4" + MAXMEM="8000" + MAXVRAM="128" + ;; + WindowsXP) + MAXCORES="4" + MAXMEM="4000" + MAXVRAM="128" + ;; + WindowsVista) + MAXCORES="4" + MAXMEM="4000" + MAXVRAM="128" + ;; + WindowsVista_64) + MAXCORES="4" + MAXMEM="16000" + MAXVRAM="128" + ;; + Windows7|Windows8|Windows81|Windows10) + MAXCORES="4" + MAXMEM="4000" + MAXVRAM="128" + ;; + Windows7_64|Windows8_64|Windows81_64|Windows10_64) + MAXCORES="4" + MAXMEM="32000" + MAXVRAM="128" + ;; + ArchLinux|Debian|OpenSUSE|Fedora|Gentoo|Mandriva|RedHat|Turbolinux|Ubuntu) + MAXCORES="4" + MAXMEM="4000" + MAXVRAM="128" + ;; + ArchLinux_64|Debian_64|OpenSUSE_64|Fedora_64|Gentoo_64|Mandriva_64|RedHat_64|Turbolinux_64|Ubuntu_64) + MAXCORES="8" + MAXMEM="32000" + MAXVRAM="128" + ;; + *Linux*) + MAXCORES="4" + MAXMEM="1024" + MAXVRAM="32" + ;; + *Linux*64) + MAXCORES="8" + MAXMEM="8000" + MAXVRAM="128" + ;; + OS2eCS) + MAXMEM="256" + MAXCORES=1 + ;; + *) + MAXMEM="512" + MAXCORES="1" + ;; + # TODO: FreeBSD, NetBSD, MacOS*, Solaris, Oracle, ... + esac + + [ "${CPU_CORES}" -gt "{MAXCORES}" ] && CPU_CORES="${MAXCORES}" + + [ "${VM_MEM}" -gt "${MAXMEM}" ] && VM_MEM="${MAXMEM}" + + return 0 +} + +call_post_source set_hardware_limits diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/init_core.inc b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/init_core.inc new file mode 100755 index 00000000..d30a0408 --- /dev/null +++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/init_core.inc @@ -0,0 +1,162 @@ +####################################################################### +# Include: Declaration of core variables and some sanity checks # +####################################################################### + +# wrapper for xmlstarlet to add node with attributes and value +# to the machine configuration +# Usage: +# add_node <parent> <newnode> <attrs...> +# E.g: +# add_node "/VirtualBox" "Machine" "uuid=1234" +add_node() { + if [ $# -lt 2 ]; then + writelog "${FUNCNAME[0]} requires 2 or more args, $# given." + cleanexit 1 + fi + local PARENT="$1" + shift + local NODE="$1" + shift + # if parent does not exists, create it aswell + if ! node_exists "${PARENT}"; then + add_node "${PARENT%/*}" "${PARENT##*/}" + fi + # now go over the list of attributes and directly create + # the xmlstarlet syntax string: -t attr -n <key> -v <value> + local ATTRS_OPTS= + while [ $# -ne 0 ]; do + # expects key=value syntax + local key="${1%=*}" + local value="${1#*=}" + shift + if isempty key || isempty value; then + writelog "${FUNCNAME[0]} expecting key=value, got: $1" + cleanexit 1 + fi + # the xmlstarlet internal newnode var references the newly created node + ATTRS_OPTS+=" -i \$newnode -t attr -n ${key} -v ${value}" + done + # args parsed, now create the node using xmlstarlet + # insert namespace to xpath expression + PARENT="$(print_namespaced "x" "${PARENT}")" + # create node and set the internal variable newnode to it + # to then add the attributes to it + xmlstarlet ed -L -N x="${VBOX_NAMESPACE}" \ + -s "${PARENT}" -t elem -n "${NODE}" \ + --var newnode '$prev' \ + ${ATTRS_OPTS} \ + "${TMPCONFIG}" +} +# edit_attr [--create] <node_xpath> <attr=value> +# --create would create the node if it does not exist +edit_attr() { + local CREATE= + if [ "$1" = "--create" ]; then + CREATE=yo + shift + fi + if [ $# -ne 3 ]; then + writelog "${FUNCNAME[0]} requires 3 args, $# given." + cleanexit 1 + fi + if notempty CREATE && ! node_exists "$1"; then + add_node "${1%/*}" "${1##*/}" \ + "$2=$3" + else + xmlstarlet ed -L -N x="${VBOX_NAMESPACE}" \ + -u "$(print_namespaced "x" "$1")/@$2" \ + -v "$3" \ + "${TMPCONFIG}" + fi +} +del_node() { + if [ $# -ne 1]; then + writelog "${FUNCNAME[0]} requires one arg, $# given." + cleanexit 1 + fi + xmlstarlet ed -L -N x="${VBOX_NAMESPACE}" \ + -d "$(print_namespaced "x" "$1")" \ + "${TMPCONFIG}" +} +node_exists() { + if [ $# -ne 1 ]; then + writelog "${FUNCNAME[0]} requires one arg, $# given." + cleanexit 1 + fi + xmlstarlet -q sel -N x="${VBOX_NAMESPACE}" \ + -t -c "$(print_namespaced "x" "$1")" \ + "${TMPCONFIG}" +} +# adds the vbox namespace to an xpath expression using +# the given placeholder for it. +# e.g. print_namespaced "x" "/VirtualBox/Machine" +# would echo "/x:VirtualBox/x:Machine" +print_namespaced() { + if [ $# -ne 2 ]; then + writelog "${FUNCNAME[0]} expects 2 arguments, $# given." + cleanexit 1 + fi + # add namespace on single '/' not doubles! + sed -E 's,(/)*/,\1/'"$1"':,g' <<< "$2" +} + +gen_uuid() { + local UUID="$(cat /proc/sys/kernel/random/uuid)" + notempty UUID && echo $UUID && return 0 + # fallback using $RANDOM + UUID= + while [ ${#UUID} -lt 32 ]; do + UUID="$UUID$RANDOM" + done + # sequence might be larger than 32, cut it and insert dashes + echo -n "${UUID:0:32}" | \ + sed -E 's,(.{8})(.{4})(.{4})(.{4})(.{12}),\1-\2-\3-\4-\5,' +} + +init_core() { + # check for variables that should have been set by the generic run-virt + if ! isset VM_CLEANNAME IMG_BASENAME SRC_IMG_ABSOLUTE VM_OS_TYPE; then + local MSG="Incomplete A required variable was not set by generic run-virt." + slxlog "virt-vbox-init" "${MSG}" + writelog "${MSG}" + error_user "Wichtige variablen, die das VBox Plugin benötigt, wurden nicht + gesetzt. Kann die VM nicht starten." + cleanexit 1 + fi + + # Check for vbox binaries in VBOX_BASE_DIR + for BIN in VBoxManage VirtualBox VBoxHeadless; do + if ! [ -x "${VBOX_BASE_DIR}/${BIN}" ]; then + local MSG="${BIN} not found in ${VBOX_BASE_DIR}." + writelog "${MSG}" + slxlog "virt-vbox-bin" "${MSG}" + cleanexit 1 + fi + done + + # Define which features the VMware plugin supports + declare -rg VBOX_ROOT="${TMPDIR}/vbox" # dir for configs + declare -rg VBOX_MACHINES_DIR="${VBOX_ROOT}/Machines" + declare -rg VBOX_SNAPSHOT_DIR="${VBOX_MACHINES_DIR}/${VM_CLEANNAME}/Snapshots" + if ! mkdir -p "${VBOX_SNAPSHOT_DIR}"; then + writelog "Failed to create '${VBOX_SNAPSHOT_DIR}'." + cleanexit 1 + fi + declare -rg VBOX_HDD_DIR="${VBOX_ROOT}/HardDisks" + if ! mkdir -p "${VBOX_HDD_DIR}"; then + writelog "Failed to create '${VBOX_HDD_DIR}'." + cleanexit 1 + fi + declare -rg VBOX_HDD_LINK="${VM_DISKFILE_RO}" + export VBOX_USER_HOME="${VBOX_ROOT}" # instead of $HOME/.VirtualBox + + # xml namespace for vbox configs + declare -rg VBOX_NAMESPACE="http://www.virtualbox.org/" + + writelog "Directories:" + writelog "\tConfig dir:\t\t$VBOX_ROOT" + writelog "\tMachines dir:\t\t$VBOX_MACHINES_DIR" + writelog "\tSnapshots dir:\t\t$VBOX_SNAPSHOT_DIR" +} + +call_post_source init_core diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/log_config_summary.inc b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/log_config_summary.inc new file mode 100755 index 00000000..fbff0551 --- /dev/null +++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/log_config_summary.inc @@ -0,0 +1,29 @@ +################################################################################ +# Include: log a summary of the configuration state for this machine # +################################################################################ +log_config_summary() { + writelog "Diskimage:" + writelog "\tDisk file:\t\t$VBOX_HDD_LINK" + writelog "\tDisk type:\t\tVDI" + writelog "\tGuest OS:\t\t$VM_OS_TYPE" + writelog "\tMachine UUID:\t\t$MACHINE_UUID" + writelog "\tDisk UUID:\t\t$VBOX_HDD_UUID" + writelog "Virtual Hardware:" + writelog "\tCPU cores:\t\t${CPU_CORES}\c" + writelog "" + [ "$HW_KVM" = "ENABLED" ] && writelog "\t(VT enabled CPU)" + writelog "\tGuest RAM:\t\t${VM_MEM} MB" + # echo nur wenn HOST_MEM_REMAINING gesetzt + [ -n "${HOST_MEM_REMAINING}" ] && writelog "\tHost RAM:\t\t${HOST_MEM_REMAINING} MB" + writelog "\tMAC address:\t\t$VM_MAC_ADDR" + writelog "\tNetwork card:\t\t${vb_network_card}" + writelog "\tNetwork kind:\t\t${network_kind}" + writelog "\tBooting from:\t\t${boot}\c" + writelog "" + writelog "\tCD-ROM1:\t\t${CDROM0}" + writelog "\tFloppy_A:\t\t${floppy0}" + writelog "\tFloppy_B:\t\t${floppy1}" + writelog "\tShared Folders '${sharename}':\t${sharepath}" +} + +call_post_source log_config_summary diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/prepare_snapshot.inc b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/prepare_snapshot.inc new file mode 100755 index 00000000..296f55ae --- /dev/null +++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/prepare_snapshot.inc @@ -0,0 +1,36 @@ +prepare_snapshot() { + SNAPSHOT_UUID="34f617be-192a-46b3-a8ae-bce1029e093f" # snapshot UUID is static + + # get UUID of VBox image + HDD_UUID=$(${VBOX_BASE_DIR}/VBoxManage -q showvdiinfo ${VBOX_HDD_LINK} \ + | grep UUID | grep -v "Parent UUID" | awk '{print $2}' \ + | grep -v use ) # nec. for VBox >= 4 + + # TODO support vmdk disks? + VBOX_HDD_FORMAT="VDI" + + if isset VM_DISKFILE_RO; then + # use temp disk as snapshot to get CoW + VBOX_HDD_TYPE="Immutable" # make disk immutable + VBOX_HDD_UUID=${SNAPSHOT_UUID} + < "${VBOX_PLUGIN_DIR}/empty-diff.vdi.gz" gunzip > "${VBOX_SNAPSHOT_DIR}/{${SNAPSHOT_UUID}}.vdi" + # patch the disk file uuid into the snapshot vdi file: + # We read from offset 424 in the source HDD and write the 16 bytes long UUID + # starting at offset 392 in the snapshot. + # TODO: This requires the image to be a vdi/vdh; Afaik, vbox supports vmdk, + # so this code would break in that case. Can we use the diskuuid we got via + # VBoxManage, convert to binary, and patch it + dd if=${VBOX_HDD_LINK} of="${VBOX_SNAPSHOT_DIR}/{${SNAPSHOT_UUID}}.vdi" seek=424 \ + skip=392 bs=1 count=16 conv=notrunc || \ + writelog "Could not patch snapshot file" + elif isset VM_DISKFILE_RW; then + # Image is already RW - easy + VBOX_HDD_TYPE="Normal" + VBOX_HDD_UUID=${HDD_UUID} + else + writelog "Neither VM_DISKFILE_RO nor VM_DISKFILE_RW defined!" + cleanexit 1 + fi +} + +call_post_source prepare_snapshot diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include new file mode 100755 index 00000000..22fde7b4 --- /dev/null +++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/run-virt.include @@ -0,0 +1,57 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) 2009..2018 - RZ Uni Freiburg +# Copyright (c) 2009..2018 - OpenSLX GmbH +# +# This program/file is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org +# ----------------------------------------------------------------------------- +# run-virt.include +# - component for virtualbox of the vmchooser plugin vmchooser-run_virt +################################################################################ + +declare -rg VBOX_PLUGIN_DIR="$(dirname "${BASH_SOURCE[0]}")" +declare -rg VBOX_INCLUDE_DIR="${VBOX_PLUGIN_DIR}/includes" +declare -rg VBOX_BASE_DIR="/usr/lib/virtualbox" + +#declare -rg PLUGIN_FEATURES="slxfloppy firewall printer usb sound netshares" +declare -rg PLUGIN_FEATURES="slxfloppy" + +run_plugin() { + # declaration of default variables and some sanity checks + $(safesource --exit "${VBOX_INCLUDE_DIR}/init_core.inc") + + # determine hardware limits based on guest OD + $(safesource "${VBOX_INCLUDE_DIR}/guest_hardware_limits.inc") + + # prepare volatile rw layer for the disk image using a snapshot + $(safesource "${VBOX_INCLUDE_DIR}/prepare_snapshot.inc") + + # create main virtualbox configuration + $(safesource "${VBOX_INCLUDE_DIR}/create_vbox_config.inc") + + # finalize machine configuration + $(safesource "${VBOX_INCLUDE_DIR}/finalize_machine_config.inc") + + # log config summary + $(safesource "${VBOX_INCLUDE_DIR}/log_config_summary.inc") + + # This is necessary for the VM to start (don't ask me why, yet!) + VBMANPID=$(pstree -p | grep VBoxXPCOMIPCD | grep -ivE "VirtualBox|VBoxHeadless"\ + | sed -e "s/.*VBoxXPCOMIPCD(\(.*\)).*/\1/") + for i in $(echo ${VBMANPID}); do + kill -9 ${VBMANPID} >/dev/null 2>&1 + done + + # set the variables appropriately (several interfaces with different names) + declare -rg VIRTCMD="${VBOX_BASE_DIR}/VirtualBox" + declare -rg VIRTCMDOPTS="--startvm ${MACHINE_UUID} --start-running --fullscreen" + + # set headless mode (-v off to disable vrdp) + declare -rg VIRTCMDHL="${VBOX_BASE_DIR}/VBoxHeadless" + declare -rg VIRTCMDOPTSHL="-s ${MACHINE_UUID}" +} diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/rwimg.vdi.gz b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/rwimg.vdi.gz Binary files differnew file mode 100644 index 00000000..e2133d6d --- /dev/null +++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/rwimg.vdi.gz diff --git a/core/modules/vbox-src/module.build b/core/modules/vbox-src/module.build new file mode 100644 index 00000000..9660302f --- /dev/null +++ b/core/modules/vbox-src/module.build @@ -0,0 +1,88 @@ +#!/bin/bash +fetch_source() { + [ -d "${MODULE_WORK_DIR}/src" ] && rm -rf "${MODULE_WORK_DIR}/src" + [ -z "${REQUIRED_VBOX_VERSION}" ] && perror "REQUIRED_VBOX_VERSION is not set!" + + local BASE_URL="https://download.virtualbox.org/virtualbox" + local DOWNLOAD_URL="${BASE_URL}/${REQUIRED_VBOX_VERSION}/VirtualBox-${REQUIRED_VBOX_VERSION}.tar.bz2" + download_untar "$DOWNLOAD_URL" "${MODULE_WORK_DIR}/src" || \ + perror "Could not download_untar '$DOWNLOAD_URL' to '${MODULE_WORK_DIR}/src'." + + # oracle's extension pack + DOWNLOAD_URL="${DOWNLOAD_URL%/*}/Oracle_VM_VirtualBox_Extension_Pack-${REQUIRED_VBOX_VERSION}-${REQUIRED_VBOX_EXTPACK_REVISION}.vbox-extpack" + download_untar "$DOWNLOAD_URL" "${MODULE_WORK_DIR}/extpack" || \ + perror "Could not download_untar '$DOWNLOAD_URL' to '${MODULE_WORK_DIR}/extpack'." +} + +build() { + [ -n "${KERNEL_HEADERS_DIR}" ] || perror "KERNEL_HEADERS_DIR not set, kernel module present?" + cd "${MODULE_WORK_DIR}/src/VirtualBox-${REQUIRED_VBOX_VERSION}" || \ + perror "Could not cd to '${MODULE_WORK_DIR}/src/VirtualBox-${REQUIRED_VBOX_VERSION}'." + local VBOX_BUILD_DIR="${MODULE_WORK_DIR}/src/VirtualBox-${REQUIRED_VBOX_VERSION}/build" + mkdir -p "$VBOX_BUILD_DIR" || perror "Failed to mkdir '$VBOX_BUILD_DIR'." + ./configure \ + --disable-docs \ + --disable-java \ + --disable-python \ + --disable-libvpx \ + --with-linux="${KERNEL_HEADERS_DIR}" \ + --out-path="${VBOX_BUILD_DIR}" \ + || perror "'configure' failed." + + # the configure script should have created a file called 'env.sh' + source "${VBOX_BUILD_DIR}/env.sh" || perror "Failed to source '${VBOX_BUILD_DIR}/env.sh'." + # copy the LocalConfig.kmk to the build dir to be more LSB-compliant + cp "${MODULE_DIR}/LocalConfig.kmk" "${VBOX_BUILD_DIR}" || \ + perror "Failed to cp LocalConfig.kmk to build dir" + kmk all || perror "Failed to execute 'kmk'." + + # check the generated build directory, use BUILD_PLATFORM_ARCH defined in env.sh + local VBOX_RELEASE_BUILD_DIR="${VBOX_BUILD_DIR}/linux.${BUILD_PLATFORM_ARCH}/release" + [ -d "${VBOX_RELEASE_BUILD_DIR}" ] || \ + perror "No release build dir found under '${VBOX_RELEASE_BUILD_DIR}'. Build failed?" + + # the resulting linux.<arch>/release/bin folder contains the whole build, + # copy it over to usr/lib/virtualbox + mkdir -p "${MODULE_BUILD_DIR}/usr/lib/virtualbox" || \ + perror "Failed to mkdir '${MODULE_BUILD_DIR}/usr/lib/virtualbox'." + cp -r "${VBOX_RELEASE_BUILD_DIR}/bin/"* "${MODULE_BUILD_DIR}/usr/lib/virtualbox" || \ + perror "Failed to cp -r '${VBOX_RELEASE_BUILD_DIR}/bin' to '${MODULE_BUILD_DIR}/usr/lib/virtualbox'." + + # set suid bits + for BIN in VBoxHeadless VBoxNetAdpCtl VBoxNetDHCP VBoxSDL VBoxVolInfo VirtualBox VBoxNetAdpCtl; do + if ! [ -e "${MODULE_BUILD_DIR}/usr/lib/virtualbox/$BIN" ]; then + pwarning "No such file: '${MODULE_BUILD_DIR}/usr/lib/virtualbox/$BIN', cannot add suid bit." + continue + fi + chmod u+s "${MODULE_BUILD_DIR}/usr/lib/virtualbox/${BIN}" || perror "Failed to set suid bit on '${BIN}'." + done + + ## Kernel modules + # build kernel modules from the release dir + cd "${VBOX_RELEASE_BUILD_DIR}/bin/src" || \ + perror "Failed to cd to '${VBOX_RELEASE_BUILD_DIR}/bin/src'." + make \ + KERN_DIR="${KERNEL_HEADERS_DIR}" \ + KERN_VER="${TARGET_KERNEL_LONG}" \ + || perror "Build kernel modules failed." + # check they were, in fact, built and copy them to build dir + mkdir -p "${MODULE_BUILD_DIR}/lib/modules/vbox" || \ + perror "Failed to mkdir '${MODULE_BUILD_DIR}/lib/modules/vbox'." + for MOD in $(find * -maxdepth 0 -type d); do + [ -e "$MOD.ko" ] || perror "Module '$MOD' was not built!" + cp "$MOD.ko" "${MODULE_BUILD_DIR}/lib/modules/vbox/" || \ + perror "Failed to cp $MOD.ko to '${MODULE_BUILD_DIR}/lib/modules/vbox/'." + done + + # finally copy the extension pack files, everthing is needed as the subfolders + # target the guest architectures and not that of the host! + local VBOX_EXTPACK_DIR="${MODULE_BUILD_DIR}/usr/lib/virtualbox/ExtensionPacks/Oracle_VM_VirtualBox_Extension_Pack" + cp -ar "${MODULE_WORK_DIR}/extpack" "${VBOX_EXTPACK_DIR}" || \ + perror "Failed to cp '${MODULE_WORK_DIR}/extpack' to '${VBOX_EXTPACK_DIR}'." + chown -R root:root "${VBOX_EXTPACK_DIR}" || \ + perror "Failed to chown '${VBOX_EXTPACK_DIR}' to root:root." +} + +post_copy() { + : +} diff --git a/core/modules/vbox-src/module.conf b/core/modules/vbox-src/module.conf new file mode 100644 index 00000000..0da5db67 --- /dev/null +++ b/core/modules/vbox-src/module.conf @@ -0,0 +1,7 @@ +REQUIRED_MODULES="kernel" +REQUIRED_VBOX_VERSION="5.2.6" +REQUIRED_VBOX_EXTPACK_REVISION="120293" +REQUIRED_DIRECTORIES=" + /lib/modules + /usr/lib/virtualbox +" diff --git a/core/modules/vbox-src/module.conf.ubuntu b/core/modules/vbox-src/module.conf.ubuntu new file mode 100644 index 00000000..2b9145b2 --- /dev/null +++ b/core/modules/vbox-src/module.conf.ubuntu @@ -0,0 +1,23 @@ +REQUIRED_INSTALLED_PACKAGES=" + iasl + makeself + libcurl4-openssl-dev + libdevmapper-dev + libidl-dev + libsdl1.2-dev + libxml2-dev + libxmu-dev + libxcursor-dev + libxinerama-dev + libxrandr-dev +" +# These are required for building 32-bit guest additions on 64-bit systems +REQUIRED_INSTALLED_PACKAGES_X64_X86=" + libc6-dev-i386 + lib32gcc1 + lib32stdc++6 + gcc-multilib + g++-multilib +" +[ "$(uname -m)x" = "x86_64x" ] && REQUIRED_INSTALLED_PACKAGES+="$REQUIRED_INSTALLED_PACKAGES_X64_X86" +true diff --git a/core/modules/vmchooser2/data/opt/openslx/bin/vmchooser b/core/modules/vmchooser2/data/opt/openslx/bin/vmchooser index 21efe6df..b06443ae 100755 --- a/core/modules/vmchooser2/data/opt/openslx/bin/vmchooser +++ b/core/modules/vmchooser2/data/opt/openslx/bin/vmchooser @@ -45,16 +45,20 @@ elif [ -n "$SLX_AUTOSTART_UUID" ]; then fi if [ -z "$SLX_NO_PVS" ]; then EXTRA="$EXTRA --pvs" - if [ "x$SLX_PVS_DEFAULT" = "xON" ]; then + if [ "x$SLX_PVS_DEFAULT" = "xON" ] || [ "x$SLX_PVS_HYBRID" = "xyes" ]; then EXTRA="$EXTRA --pvs-checked" fi fi +if [ -z "${SLX_AUTOLOGIN%OFF}" ] && [ -n "$SLX_VMCHOOSER_TIMEOUT" ] && [ "$SLX_VMCHOOSER_TIMEOUT" -gt 0 ]; then + EXTRA="$EXTRA --autoquit $SLX_VMCHOOSER_TIMEOUT" +fi + # No quotes around $EXTRA! if [ -z "$SLX_LOCATIONS" ]; then - exec vmchooser.real "$@" --url "$URL" --fullscreen --tab "$TAB" --start-uuid "$SLX_EXAM_START" --autoquit 120 $EXTRA + exec vmchooser.real "$@" --url "$URL" --fullscreen --tab "$TAB" --start-uuid "$SLX_EXAM_START" $EXTRA fi # No quotes around $EXTRA! -exec vmchooser.real "$@" --url "$URL" --fullscreen --tab "$TAB" --start-uuid "$SLX_EXAM_START" --locations "$SLX_LOCATIONS" --autoquit 120 $EXTRA +exec vmchooser.real "$@" --url "$URL" --fullscreen --tab "$TAB" --start-uuid "$SLX_EXAM_START" --locations "$SLX_LOCATIONS" $EXTRA diff --git a/core/modules/vmchooser2/module.conf.ubuntu b/core/modules/vmchooser2/module.conf.ubuntu index 1e09c702..286d01f1 100644 --- a/core/modules/vmchooser2/module.conf.ubuntu +++ b/core/modules/vmchooser2/module.conf.ubuntu @@ -1,5 +1,6 @@ #!/bin/bash REQUIRED_INSTALLED_PACKAGES=" - cmake - libqt4-dev + cmake + libqt5gui5 + qttools5-dev " diff --git a/core/modules/vmchooser2/module.conf.ubuntu.17 b/core/modules/vmchooser2/module.conf.ubuntu.17 new file mode 100644 index 00000000..597eb825 --- /dev/null +++ b/core/modules/vmchooser2/module.conf.ubuntu.17 @@ -0,0 +1,7 @@ +#!/bin/bash +REQUIRED_INSTALLED_PACKAGES=" + cmake + libqt5gui5 + libqt5x11extras5-dev + qttools5-dev-tools +" diff --git a/core/modules/vmware/data/opt/openslx/bin/vmplayer b/core/modules/vmware/data/opt/openslx/bin/vmplayer index cfb91a0a..05a4ec3a 100755 --- a/core/modules/vmware/data/opt/openslx/bin/vmplayer +++ b/core/modules/vmware/data/opt/openslx/bin/vmplayer @@ -5,13 +5,12 @@ PREFIX=/usr/lib/vmware # depends on the vmware location # HACK: Let the OpenGL driver report s3tc capability even if not present, so 3D will be enabled export force_s3tc_enable=true -PROG=$(basename $0) - -exec "$PREFIX/lib/wrapper-gtk24.sh" \ - "$PREFIX/lib" \ - "$PREFIX/bin/$PROG" \ - "$PREFIX/libconf" "$@" - +# Turn off "helpful" DE features +export APPMENU_DISPLAY_BOTH=1 +export UBUNTU_MENUPROXY=0 +export GNOME_DISABLE_CRASH_DIALOG=1 +PROG=$(basename $0) +exec "$PREFIX/bin/$PROG" "$@" diff --git a/core/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env b/core/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env index 0f3e270e..18959170 100755 --- a/core/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env +++ b/core/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env @@ -1,18 +1,18 @@ #!/bin/ash # ----------------------------------------------------------------------------- -# Copyright (c) 2013 - OpenSLX GmbH -# -# This program is free software distributed under the GPL version 2. -# See http://openslx.org/COPYING -# -# If you have any feedback please consult http://openslx.org/feedback and -# send your suggestions, praise, or complaints to feedback@openslx.org -# -# General information about OpenSLX can be found at http://openslx.org/ +# Copyright (c) 2013 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ # ----------------------------------------------------------------------------- # systemd-vmware_env # - This is the systemd configuration and provisioning script for the various -# VMware modules and services +# VMware modules and services ################################################################################ export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin" @@ -20,49 +20,78 @@ export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin" VMWARE_CONF_DIR=/opt/openslx/vmchooser/vmware VMCHOOSER_CONF_DIR=/opt/openslx/vmchooser/config +. /opt/openslx/config + load_modules () { local FAILED="" - # module stuff - insmod /lib/modules/vmware/vmmon.ko || FAILED="$FAILED vmmon" - insmod /lib/modules/vmware/vmnet.ko || FAILED="$FAILED vmnet" - #insmod /lib/modules/vmware/vmci.ko || FAILED="$FAILED vmci" - #insmod /lib/modules/vmware/vmblock.ko || FAILED="$FAILED vmblock" - #insmod /lib/modules/vmware/vsock.ko || FAILED="$FAILED vsock" + # module stuff + insmod /lib/modules/vmware/vmmon.ko || FAILED="$FAILED vmmon" + insmod /lib/modules/vmware/vmnet.ko || FAILED="$FAILED vmnet" + #insmod /lib/modules/vmware/vmci.ko || FAILED="$FAILED vmci" + #insmod /lib/modules/vmware/vmblock.ko || FAILED="$FAILED vmblock" + #insmod /lib/modules/vmware/vsock.ko || FAILED="$FAILED vsock" [ -n "$FAILED" ] && slxlog "vmware-insmod" "Error loading vmware kernel module(s) $FAILED" } -unload_modules () { - rmmod vmnet vmmon #vsock vmci vmblock +unload_modules () { + rmmod vmnet vmmon #vsock vmci vmblock +} + +vmnet_create() { + vmnet="$1" + # first, create device node + dev="/dev/vmnet${vmnet}" + if ! [ -c "$dev" ] && ! mknod "${dev}" c 119 "${vmnet}"; then + slxlog "vmware-node-vmnet" "Could not create ${dev}" + return 1 + fi + chmod 0700 "${dev}" + # now bring it up + if ! /usr/bin/vmnet-netifup -d "/var/run/vmnet-netifup-vmnet${vmnet}.pid" "${dev}" "vmnet${vmnet}" ; then + slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet${vmnet} failed." + fi + ip link set dev "vmnet${vmnet}" up } -vmnetif () { +vmnetif () { + local vmnet nic NICS # create the needed devices which effects all vmware options # they are not created automatically via module load - for device in "/dev/vmnet0 c 119 0" "/dev/vmnet1 c 119 1" \ - "/dev/vmnet2 c 119 2" "/dev/vmmon c 10 165"; do - mknod ${device} + if ! [ -e /dev/vmmon ]; then + mknod /dev/vmmon c 10 165 || slxlog "vmware-node-vmmon" "Could not create /dev/vmmon" + fi + # network interfaces + # 1) default ones + for vmnet in 0 1 2; do + vmnet_create "$vmnet" done - chmod 0700 /dev/vmnet* - + # Set the vmware interface to 9000 too, as br0 will use the smallest of all slave devices + [ "x$SLX_JUMBO_FRAMES" = "xyes" ] && ip link set dev vmnet0 mtu 9000 # setup bridge (vmnet0), nat (vmnet1) and software defined networking (vmnet2) interfaces - if ! /usr/bin/vmnet-netifup -d /var/run/vmnet-netifup-vmnet0.pid /dev/vmnet0 vmnet0 ; then - slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet0 failed." - fi - ip link set dev vmnet0 up - brctl addif br0 vmnet0 - if ! /usr/bin/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid /dev/vmnet1 vmnet1; then - slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet1 failed." - fi - ip link set dev vmnet1 up - brctl addif nat1 vmnet1 - if ! /usr/bin/vmnet-netifup -d /var/run/vmnet-netifup-vmnet2.pid /dev/vmnet2 vmnet2; then - slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet2 failed." + brctl addif br0 vmnet0 + brctl addif nat1 vmnet1 + brctl addif vsw2 vmnet2 + # 2) see if we should bridge additional interfaces + NICS= + if [ "$SLX_BRIDGE_OTHER_NICS" = "yes" ]; then + # These will have been set up in our init + NICS=$( ls -1 /sys/class/net | grep '^br-nic-' | cut -c 8- ) + vmnet=10 + for nic in $NICS; do + if ! [ "$nic" -gt 0 ] && ! [ "$nic" -eq 0 ]; then + slxlog "vmware-other-nics" "NaN: br-nic-X has X='$nic'" + continue + fi + # create vmnet10 - vmnetN for these + vmnet_create "$vmnet" + brctl addif "br-nic-${nic}" "vmnet${vmnet}" + vmnet="$(( vmnet + 1 ))" + done fi - ip link set dev vmnet2 up - brctl addif vsw2 vmnet2 + } -vmblock () { +vmblock () { if ! /usr/bin/vmware-usbarbitrator; then slxlog "vmware-usbarb" "Launching /usr/bin/vmware-usbarbitrator failed." fi @@ -72,31 +101,31 @@ vmblock () { mkdir -p "/tmp/virt/vmware" "/dev/shm/vmware" "/run/vmware" -m 1777 # FixMe: Should be rewritten for proper systemd operation -case "$1" in - start) - # hack to access the first serial/parallel port - [ -c /dev/ttyS0 ] && chmod a+rw /dev/ttyS0 - [ -c /dev/parport0 ] && chmod a+rw /dev/parport0 - load_modules - vmnetif - vmblock - ;; - stop) - #stop: defines stop function for initscript - killall vmnet-netifup vmnet-bridge vmware vmplayer vmware-tray - # might take a while until all services are shut down - sleep 0.5 - unload_modules - - ;; - restart) - #restart: defines restart function for initscript - $0 stop && $0 start - ;; - status) - #status: defines status function for initscript - vmstatus - ;; +case "$1" in + start) + # hack to access the first serial/parallel port + [ -c /dev/ttyS0 ] && chmod a+rw /dev/ttyS0 + [ -c /dev/parport0 ] && chmod a+rw /dev/parport0 + load_modules + vmnetif + vmblock + ;; + stop) + #stop: defines stop function for initscript + killall vmnet-netifup vmnet-bridge vmware vmplayer vmware-tray + # might take a while until all services are shut down + sleep 0.5 + unload_modules + + ;; + restart) + #restart: defines restart function for initscript + $0 stop && $0 start + ;; + status) + #status: defines status function for initscript + vmstatus + ;; esac # Breaks performance with certain workloads, so disable. diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc index 2e1ed1c4..b4197051 100644 --- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc +++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc @@ -58,6 +58,8 @@ create_vmhome_preferences_file() { pref.vmplayer.confirmOnExit = "TRUE" pref.backgroundOnClose = "FALSE" pref.trayicon.enabled = "FALSE" + pref.keyboardAndMouse.vmHotKey.enabled = "FALSE" + pref.keyboardAndMouse.vmHotKey.count = "0" # shared folders pref.enableAllSharedFolders = "TRUE" diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc index 85fafc9f..d7ad77c6 100644 --- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc +++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc @@ -27,7 +27,9 @@ declare -rg VM_CONF_DIR="/tmp/virt/vmware/${USER}.$$" declare -rg VM_RUN_FILE="${VM_CONF_DIR}/run-vmware.conf" # Users vmware config folder -[ -z "${HOME}" ] && declare -rg HOME=$(getent passwd "$(whoami)" | awk -F ':' '{print $6}') +[ -z "$UID" ] && UID=$(id -u) +[ -z "${HOME}" ] && declare -rg HOME=$(getent passwd "$UID" | awk -F ':' '{print $6}') +[ -z "${HOME}" ] && slxlog "run-virt-vmware-home" "Could not get home directory of user $(whoami) ($UID)" declare -rg VM_HOME="${HOME}/.vmware" # mltk generates a vmware config file with several version infos for vmware/player, read it diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc index 6ca82acb..47330bb0 100644 --- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc +++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc @@ -3,6 +3,17 @@ ###################################################################### ## Functions parse_vmx() { + # To avoid potential syntax problems from the vmx served by dmsd, sanitize + # it before continuing with filling in the gaps + local TMPTMPCONFIG="$(mktemp)" + grep -E '^\s*(#|[^=]+=[^"]*"[^"]*"\s*$|[^=]+=[^"]+$|$)' "$TMPCONFIG" > "$TMPTMPCONFIG" + if ! diff -q "$TMPCONFIG" "$TMPTMPCONFIG"; then + # file was corrupted, log it + writelog "'$TMPCONFIG' had bad syntax and was pruned by the post-download sanitizer!" + slxlog -s "virt-vmware-vmx-corrupt" "Downloaded .vmx for '$IMGUUID' has a corrupted format!" "$TMPCONFIG" + fi + mv -f -- "$TMPTMPCONFIG" "$TMPCONFIG" + writelog "Parsing virtual machine description file..." local -i HW_VERSION=$(grep -i -m1 '^virtualHW.version *= *' "${TMPCONFIG}" | awk -F '=' '{print $2}' | sed -r 's/[^0-9]//g') if notempty HW_VERSION; then @@ -19,4 +30,3 @@ else writelog "Path to VMX file is not set or empty! Aborting..." EXIT_TYPE="internal" EXIT_REASON="Konnte Pfad zur VMX-Datei nicht finden!" cleanexit 1 fi - diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc index 84ddee1d..a7d3d837 100644 --- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc +++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc @@ -22,6 +22,38 @@ replace_placeholders() { setup_ethernet() { echo 'ethernet0.addressType = "static"' >> "${TMPCONFIG}" echo 'ethernet0.address = "'"${VM_MAC_ADDR}"'"' >> "${TMPCONFIG}" + if [ -n "$OTHER_NICS" ]; then + local devtype mac cnt eth + # Copy type of eth0, in case the others don't specify a type in the vmx, we'll use the same + # so we know the drivers are there + devtype=$(< "${TMPCONFIG}" grep -m1 -i '^ethernet0\.virtualDev' | sed -r 's/^[^=]+//;s/^(\s|=|")*//;s/(\s|")+$//') # TODO: Make a helper like "getVmxOption" + cnt=0 + for mac in $OTHER_NICS; do + vmnet=$(( cnt + 10 )) + cnt=$(( cnt + 1 )) + eth="ethernet${cnt}" + # Check device exists + if ! [ -c "/dev/vmnet${vmnet}" ]; then + slxlog "vmware-bridge-setup" "Cannot bridge NIC into VM: /dev/vmnet${vmnet} does not exist" + continue + fi + # Remove lines that could break things + sed -i "/^${eth}\.connectionType/Id;/^${eth}\.present/Id" "${TMPCONFIG}" + # Set up devType + devline= + if ! grep -q -i "^${eth}\.virtualDev" "${TMPCONFIG}" && [ -n "$devtype" ]; then + devline="${eth}.virtualDev = "'"'"${devtype}"'"' + fi + cat >> "${TMPCONFIG}" <<-HEND + ${eth}.connectionType = "custom" + ${eth}.present = "TRUE" + ${eth}.vnet = "vmnet${vmnet}" + ${eth}.addressType = "static" + ${eth}.address = "${mac}" + ${devline} + HEND + done + fi } # DVD, CDROM @@ -50,8 +82,8 @@ setup_floppies() { # Floppies: cat >> "${TMPCONFIG}" <<-HEREEND - floppy0.present = "$FLOPPY0" - floppy0.startConnected = "FALSE" + floppy0.present = "TRUE" + floppy0.startConnected = "$FLOPPY0" floppy0.autodetect = "TRUE" floppy0.fileName = "auto detect" floppy1.present = "$SLX_FLOPPY" diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvram b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvram Binary files differindex 85125f1e..88074390 100644 --- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvram +++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/nvram diff --git a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include index 181ae44c..a552038b 100644 --- a/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include +++ b/core/modules/vmware/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include @@ -43,6 +43,17 @@ run_plugin() { # For debugging cp "$VM_RUN_FILE" "/tmp/vmware-last-config" + + # HACK: make the mouse disappear + ( + local WINDOWS="$(xdotool search --sync --name '.*VMware.*Player.*')" + isempty WINDOWS && writelog "Could not find any vmplayer windows." + for WINDOW in $WINDOWS; do + xdotool set_desktop_for_window $WINDOW 0 || writelog "Could not move vmplayer to desktop 0" + xdotool windowactivate --sync $WINDOW || writelog "Could not activate vmplayer window" + xdotool key --delay 2000 --clearmodifiers ctrl+g || writelog "Could not send ctrl+g to vmplayer window" + done + ) & # HACK: using the modified version of the wrapper script declare -rg VIRTCMD="/opt/openslx/bin/vmplayer" diff --git a/core/modules/vmware/module.build b/core/modules/vmware/module.build index b056ccc4..cfb6fb39 100644 --- a/core/modules/vmware/module.build +++ b/core/modules/vmware/module.build @@ -37,6 +37,7 @@ fetch_source() { } build() { + local KMOD SHORT PATCH MIN_KERN MAX_KERN [ -z "$VMWARE_BUNDLE_FILE" ] && VMWARE_BUNDLE_FILE=$(basename "$(find "${MODULE_WORK_DIR}/src" -iname "vmware-*" | head -n 1)") local DELETE_FILES=$(for LINE in $REQUIRED_VMWARE_DELETIONS;do echo "rm -rf -- $LINE"; done) @@ -50,7 +51,23 @@ build() { # prepare the build directory with the files needed during the chroot cp "${MODULE_WORK_DIR}/src/$VMWARE_BUNDLE_FILE" "${MODULE_BUILD_DIR}/$VMWARE_BUNDLE_FILE" - cp -r "${MODULE_DIR}/patches" "${MODULE_BUILD_DIR}" + # copy required patches + mkdir -p "${MODULE_BUILD_DIR}/patches" + for PATCH in $(find "${MODULE_DIR}/patches/" -name "*__*__*.patch"); do + parse_patch_name "$PATCH" + [ -z "${MIN_KERN}" -o -z "${MAX_KERN}" ] && perror "Could not parse patch filename" + if version_lt "$TARGET_KERNEL_SHORT" "$MIN_KERN" || version_gt "$TARGET_KERNEL_SHORT" "$MAX_KERN"; then + pinfo "*NOT* applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$TARGET_KERNEL_SHORT)" + continue # Not suitable for our kernel + fi + if version_lt "$OFFICIAL_VERSION" "$MIN_VMWARE" || version_gt "$OFFICIAL_VERSION" "$MAX_VMWARE"; then + pinfo "*NOT* applying $PATCH (min=$MIN_VMWARE max=$MAX_VMWARE cmp=$OFFICIAL_VERSION)" + continue # Not suitable for our kernel + fi + pinfo "Kernel: Applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$TARGET_KERNEL_SHORT)" + pinfo "VMware: Applying $PATCH (min=$MIN_VMWARE max=$MAX_VMWARE cmp=$OFFICIAL_VERSION)" + cp "$PATCH" "${MODULE_BUILD_DIR}/patches/" || perror "Could not copy patch $PATCH to $MODULE_BUILD_DIR/patches" + done # sanity check to see if KERNEL_HEADERS_DIR is set and exists [ -z "${KERNEL_HEADERS_DIR}" -o ! -e "${KERNEL_HEADERS_DIR}" ] && perror "KERNEL_HEADERS_DIR ('"${KERNEL_HEADERS_DIR}"') not found. Was the kernel module built?" @@ -58,55 +75,44 @@ build() { # build in two steps, to be able to use mltk function while patching modules pinfo "Installing vmware per chroot..." chroot_run "${MODULE_BUILD_DIR}" <<-EOF + perror() { + echo "[ERROR ERROR] " "\$@" >&6 + exit 1 + } # PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot $DELETE_FILES yes | sh /"${VMWARE_BUNDLE_FILE}" --eulas-agreed --console --required - EOF - # check if we need to patch modules - cd "${MODULE_BUILD_DIR}/usr/lib/vmware/modules/source" \ - || perror "Could not cd to '${MODULE_BUILD_DIR}/usr/lib/vmware/modules/source'" - - local KMOD SHORT PATCH MIN_KERN MAX_KERN - for KMOD in *.tar; do - SHORT="${KMOD%%.tar}" - [ -e ".${SHORT}.patched" ] && continue - for PATCH in $(find "${MODULE_DIR}/patches/" -name "${SHORT}__*__*.patch"); do - parse_patch_name "$PATCH" - [ -z "${MIN_KERN}" -o -z "${MAX_KERN}" ] && perror "Could not parse patch filename" - if version_lt "$TARGET_KERNEL_SHORT" "$MIN_KERN" || version_gt "$TARGET_KERNEL_SHORT" "$MAX_KERN"; then - pinfo "*NOT* applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$TARGET_KERNEL_SHORT)" - continue # Not suitable for our kernel - fi - if version_lt "$OFFICIAL_VERSION" "$MIN_VMWARE" || version_gt "$OFFICIAL_VERSION" "$MAX_VMWARE"; then - pinfo "*NOT* applying $PATCH (min=$MIN_VMWARE max=$MAX_VMWARE cmp=$OFFICIAL_VERSION)" - continue # Not suitable for our kernel - fi - pinfo "Kernel: Applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$TARGET_KERNEL_SHORT)" - pinfo "VMware: Applying $PATCH (min=$MIN_VMWARE max=$MAX_VMWARE cmp=$OFFICIAL_VERSION)" - [ ! -d "${SHORT}-only" ] && tar xf "$KMOD" - [ ! -d "${SHORT}-only" ] && perror "untar of $KMOD failed." - cd "${SHORT}-only" || perror "Where is ${SHORT}-only?" - if ! patch -p1 < "$PATCH"; then + set -x + # Patch kernel modules + # check if we need to patch modules + cd "/usr/lib/vmware/modules/source" \ + || perror "Could not cd to '/usr/lib/vmware/modules/source'" + for file in /patches/*.patch; do + [ -s "\$file" ] || continue + echo "Applying patch $file" + SHORT="\$(basename "\${file%%__*}")" + KMOD="\${SHORT}.tar" + [ -s "\$KMOD" ] || perror "Kmod \$KMOD does not exist" + [ ! -d "\${SHORT}-only" ] && tar xf "\$KMOD" + [ ! -d "\${SHORT}-only" ] && perror "untar of \$KMOD failed." + cd "\${SHORT}-only" || perror "Where is \${SHORT}-only?" + if ! patch -p1 < "\$file"; then cd .. - rm -rf -- "${SHORT}-only" - perror "Applying $PATCH failed." + rm -rf -- "\${SHORT}-only" + perror "Applying \$file failed." fi cd .. + if [ -d "\${SHORT}-only" ]; then + tar cf "\$KMOD" "\${SHORT}-only/" || perror "repacking of \$KMOD failed." + rm -rf -- "\${SHORT}-only" + fi done - if [ -d "${SHORT}-only" ]; then - tar cf "$KMOD" "${SHORT}-only/" || perror "repacking of $KMOD failed." - rm -rf -- "${SHORT}-only" - touch ".${SHORT}.patched" - fi - done - cd "${MODULE_WORK_DIR}" || perror "Could not cd to '${MODULE_WORK_DIR}'" - - # now build modules inside the chroot - chroot_run "${MODULE_BUILD_DIR}" <<-EOF - vmware-modconfig --console --build-mod -k "${TARGET_KERNEL_LONG}" vmnet $(which gcc) "${KERNEL_HEADERS_DIR}/include" vmplayer vmnet - vmware-modconfig --console --build-mod -k "${TARGET_KERNEL_LONG}" vmmon $(which gcc) "${KERNEL_HEADERS_DIR}/include" vmplayer vmmon + vmware-modconfig --console --build-mod -k "${TARGET_KERNEL_LONG}" vmnet $(which gcc) "${KERNEL_HEADERS_DIR}/include" vmplayer vmnet || perror "vmnet build failed" + vmware-modconfig --console --build-mod -k "${TARGET_KERNEL_LONG}" vmmon $(which gcc) "${KERNEL_HEADERS_DIR}/include" vmplayer vmmon || perror "vmmon build failed" EOF + cd "${MODULE_WORK_DIR}" || perror "Could not cd to '${MODULE_WORK_DIR}'" + # cleanup unneeded files rm -rf -- "${MODULE_BUILD_DIR}/etc/vmware-installer" rm -rf -- "${MODULE_BUILD_DIR}/usr/lib/vmware-installer" @@ -154,6 +160,9 @@ post_copy() { parse_patch_name() { [ $# -ne 1 ] && perror "parse_patch_name: Wrong parameter count." local PATCH="$1" + # Module + SHORT=$(echo "$PATCH" | sed -r 's/^([^_]+)__.*$/\1/g') + KMOD="${SHORT}.tar" # Kernel restriction MIN_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)-[0-9\.]+__[^_]+\.patch$/\1/g') [[ "$MIN_KERN" == /* ]] && MIN_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)__[^_]+\.patch$/\1/g') diff --git a/core/modules/vmware/module.conf b/core/modules/vmware/module.conf index 7e0280a7..31766419 100644 --- a/core/modules/vmware/module.conf +++ b/core/modules/vmware/module.conf @@ -1,5 +1,5 @@ #!/bin/bash -REQUIRED_VERSION="12.5.7" +REQUIRED_VERSION="14.0.0" REQUIRED_TYPE="workstation" REQUIRED_MODULES=" kernel @@ -15,6 +15,7 @@ REQUIRED_DIRECTORIES=" /usr/lib/vmware/libconf /usr/lib/vmware/licenses /usr/lib/vmware/resources + /usr/lib/vmware/roms /usr/lib/vmware/scripts /usr/lib/vmware/share /usr/lib/vmware/xkeymap diff --git a/core/modules/vmware/patches/vmmon__4.14-4.14.99__12.0-14.0.patch b/core/modules/vmware/patches/vmmon__4.14-4.14.99__12.0-14.0.patch new file mode 100644 index 00000000..5278d645 --- /dev/null +++ b/core/modules/vmware/patches/vmmon__4.14-4.14.99__12.0-14.0.patch @@ -0,0 +1,61 @@ +--- a/linux/hostif.c 2017-09-18 15:22:18.000000000 +0200 ++++ b/linux/hostif.c 2017-11-17 13:35:49.600578115 +0100 +@@ -79,6 +79,37 @@ + #error CONFIG_HIGH_RES_TIMERS required for acceptable performance + #endif + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) ++# define global_zone_page_state global_page_state ++#endif ++ ++static unsigned long get_nr_slab_unreclaimable(void) ++{ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) ++ return global_node_page_state(NR_SLAB_UNRECLAIMABLE); ++#else ++ return global_page_state(NR_SLAB_UNRECLAIMABLE); ++#endif ++} ++ ++static unsigned long get_nr_unevictable(void) ++{ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ return global_node_page_state(NR_UNEVICTABLE); ++#else ++ return global_page_state(NR_UNEVICTABLE); ++#endif ++} ++ ++static unsigned long get_nr_anon_mapped(void) ++{ ++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ return global_node_page_state(NR_ANON_MAPPED); ++ #else ++ return global_page_state(NR_ANON_PAGES); ++ #endif ++} ++ + /* + * Although this is not really related to kernel-compatibility, I put this + * helper macro here for now for a lack of better place --hpreg +@@ -1516,16 +1547,11 @@ + unsigned int reservedPages = MEMDEFAULTS_MIN_HOST_PAGES; + unsigned int hugePages = (vm == NULL) ? 0 : + BYTES_2_PAGES(vm->memInfo.hugePageBytes); +- unsigned int lockedPages = global_page_state(NR_PAGETABLE) + +- global_page_state(NR_SLAB_UNRECLAIMABLE) + +- global_page_state(NR_UNEVICTABLE) + ++ unsigned int lockedPages = global_zone_page_state(NR_PAGETABLE) + ++ get_nr_slab_unreclaimable() + ++ get_nr_unevictable() + + hugePages + reservedPages; +- unsigned int anonPages = +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) +- global_page_state(NR_ANON_MAPPED); +-#else +- global_page_state(NR_ANON_PAGES); +-#endif ++ unsigned int anonPages = get_nr_anon_mapped(); + unsigned int swapPages = BYTES_2_PAGES(linuxState.swapSize); + + if (anonPages > swapPages) { diff --git a/core/modules/vmware/patches/vmmon__4.14__14.0.patch b/core/modules/vmware/patches/vmmon__4.14__14.0.patch new file mode 100644 index 00000000..5278d645 --- /dev/null +++ b/core/modules/vmware/patches/vmmon__4.14__14.0.patch @@ -0,0 +1,61 @@ +--- a/linux/hostif.c 2017-09-18 15:22:18.000000000 +0200 ++++ b/linux/hostif.c 2017-11-17 13:35:49.600578115 +0100 +@@ -79,6 +79,37 @@ + #error CONFIG_HIGH_RES_TIMERS required for acceptable performance + #endif + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) ++# define global_zone_page_state global_page_state ++#endif ++ ++static unsigned long get_nr_slab_unreclaimable(void) ++{ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) ++ return global_node_page_state(NR_SLAB_UNRECLAIMABLE); ++#else ++ return global_page_state(NR_SLAB_UNRECLAIMABLE); ++#endif ++} ++ ++static unsigned long get_nr_unevictable(void) ++{ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ return global_node_page_state(NR_UNEVICTABLE); ++#else ++ return global_page_state(NR_UNEVICTABLE); ++#endif ++} ++ ++static unsigned long get_nr_anon_mapped(void) ++{ ++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ return global_node_page_state(NR_ANON_MAPPED); ++ #else ++ return global_page_state(NR_ANON_PAGES); ++ #endif ++} ++ + /* + * Although this is not really related to kernel-compatibility, I put this + * helper macro here for now for a lack of better place --hpreg +@@ -1516,16 +1547,11 @@ + unsigned int reservedPages = MEMDEFAULTS_MIN_HOST_PAGES; + unsigned int hugePages = (vm == NULL) ? 0 : + BYTES_2_PAGES(vm->memInfo.hugePageBytes); +- unsigned int lockedPages = global_page_state(NR_PAGETABLE) + +- global_page_state(NR_SLAB_UNRECLAIMABLE) + +- global_page_state(NR_UNEVICTABLE) + ++ unsigned int lockedPages = global_zone_page_state(NR_PAGETABLE) + ++ get_nr_slab_unreclaimable() + ++ get_nr_unevictable() + + hugePages + reservedPages; +- unsigned int anonPages = +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) +- global_page_state(NR_ANON_MAPPED); +-#else +- global_page_state(NR_ANON_PAGES); +-#endif ++ unsigned int anonPages = get_nr_anon_mapped(); + unsigned int swapPages = BYTES_2_PAGES(linuxState.swapSize); + + if (anonPages > swapPages) { diff --git a/core/modules/vmware12/data/addon-init b/core/modules/vmware12/data/addon-init new file mode 100755 index 00000000..d844c282 --- /dev/null +++ b/core/modules/vmware12/data/addon-init @@ -0,0 +1,6 @@ +#!/bin/ash + +systemctl daemon-reload +systemctl start vmware +exit 0 + diff --git a/core/modules/vmware12/data/etc/X11/Xreset.d/vmware b/core/modules/vmware12/data/etc/X11/Xreset.d/vmware new file mode 100644 index 00000000..83bfb392 --- /dev/null +++ b/core/modules/vmware12/data/etc/X11/Xreset.d/vmware @@ -0,0 +1,17 @@ +# +# VMWare cleanup +# + +# Unmount dirs that vmware sometimes leaves around +VMWARE_TMP_DIRS="$(cat /proc/mounts | grep "/tmp/vmware-" | awk -F " " '{print $1}')" +for DIR in $VMWARE_TMP_DIRS; do + umount "$DIR" && rmdir "$DIR" +done + +# Delete redo/temp files that sometimes stay around e.g. on vmware crash +for file in $(find /tmp/virt/vmware -type f -size +4M); do + fuser -s "$file" || rm -- "$file" +done + +true + diff --git a/core/modules/vmware12/data/etc/systemd/system/graphical.target.wants/vmware.service b/core/modules/vmware12/data/etc/systemd/system/graphical.target.wants/vmware.service new file mode 120000 index 00000000..7deb4820 --- /dev/null +++ b/core/modules/vmware12/data/etc/systemd/system/graphical.target.wants/vmware.service @@ -0,0 +1 @@ +../vmware.service
\ No newline at end of file diff --git a/core/modules/vmware12/data/etc/systemd/system/vmware.service b/core/modules/vmware12/data/etc/systemd/system/vmware.service new file mode 100644 index 00000000..78f75726 --- /dev/null +++ b/core/modules/vmware12/data/etc/systemd/system/vmware.service @@ -0,0 +1,9 @@ +[Unit] +Description=Sets up the vmware environment +Requires=run-virt-env.service setup-partitions.service network.target +After=run-virt-env.service setup-partitions.service network.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/opt/openslx/scripts/systemd-vmware_env start diff --git a/core/modules/vmware12/data/etc/vmware-vix/bootstrap b/core/modules/vmware12/data/etc/vmware-vix/bootstrap new file mode 100644 index 00000000..425074de --- /dev/null +++ b/core/modules/vmware12/data/etc/vmware-vix/bootstrap @@ -0,0 +1,2 @@ +BINDIR="/usr/bin" + diff --git a/core/modules/vmware12/data/etc/vmware/bootstrap b/core/modules/vmware12/data/etc/vmware/bootstrap new file mode 100644 index 00000000..0cc4af90 --- /dev/null +++ b/core/modules/vmware12/data/etc/vmware/bootstrap @@ -0,0 +1,12 @@ +PREFIX="/usr" +BINDIR="/usr/bin" +SBINDIR="/usr/sbin" +LIBDIR="/usr/lib" +DATADIR="/usr/share" +SYSCONFDIR="/etc" +DOCDIR="/usr/share/doc" +MANDIR="/usr/share/man" +INCLUDEDIR="/usr/include" +INITDIR="/etc" +INITSCRIPTDIR="/etc/init.d" + diff --git a/core/modules/vmware12/data/etc/vmware/icu b/core/modules/vmware12/data/etc/vmware/icu new file mode 120000 index 00000000..d1ebea7d --- /dev/null +++ b/core/modules/vmware12/data/etc/vmware/icu @@ -0,0 +1 @@ +/usr/lib/vmware/icu
\ No newline at end of file diff --git a/core/modules/vmware12/data/etc/vmware/locations b/core/modules/vmware12/data/etc/vmware/locations new file mode 100644 index 00000000..2d419546 --- /dev/null +++ b/core/modules/vmware12/data/etc/vmware/locations @@ -0,0 +1,3 @@ +# Empty locations file to catch downgrade +# to WS 6.0 +# OpenSLX: No idea what above means, but better have this file... ;-) diff --git a/core/modules/vmware12/data/etc/vmware/usbarb.rules b/core/modules/vmware12/data/etc/vmware/usbarb.rules new file mode 100644 index 00000000..ae107c7b --- /dev/null +++ b/core/modules/vmware12/data/etc/vmware/usbarb.rules @@ -0,0 +1,4 @@ +{ + "version": 1, + "rules": [] +} diff --git a/core/modules/vmware12/data/opt/openslx/bin/vmplayer b/core/modules/vmware12/data/opt/openslx/bin/vmplayer new file mode 100755 index 00000000..f94c8794 --- /dev/null +++ b/core/modules/vmware12/data/opt/openslx/bin/vmplayer @@ -0,0 +1,18 @@ +#!/bin/ash +# radically simplified version of the original script vmplayer by VMware Inc. +PREFIX=/usr/lib/vmware # depends on the vmware location + +# HACK: Let the OpenGL driver report s3tc capability even if not present, so 3D will be enabled +export force_s3tc_enable=true + +PROG=$(basename $0) + +# various hacks to help vmplayer find its own libs -.- +export VMWARE_USE_SHIPPED_LIBS=force +export LD_LIBRARY_PATH=$( find /usr/lib/vmware/lib/ -maxdepth 1 -mindepth 1 -type d | awk 'BEGIN{p=""}{p=p$0":"}END{print p}' ) + +exec "$PREFIX/lib/wrapper-gtk24.sh" \ + "$PREFIX/lib" \ + "$PREFIX/bin/$PROG" \ + "$PREFIX/libconf" "$@" + diff --git a/core/modules/vmware12/data/opt/openslx/bin/vmware b/core/modules/vmware12/data/opt/openslx/bin/vmware new file mode 120000 index 00000000..aa0b74b1 --- /dev/null +++ b/core/modules/vmware12/data/opt/openslx/bin/vmware @@ -0,0 +1 @@ +vmplayer
\ No newline at end of file diff --git a/core/modules/vmware12/data/opt/openslx/scripts/systemd-vmware_env b/core/modules/vmware12/data/opt/openslx/scripts/systemd-vmware_env new file mode 100755 index 00000000..ff4d58c5 --- /dev/null +++ b/core/modules/vmware12/data/opt/openslx/scripts/systemd-vmware_env @@ -0,0 +1,135 @@ +#!/bin/ash +# ----------------------------------------------------------------------------- +# Copyright (c) 2013 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# systemd-vmware_env +# - This is the systemd configuration and provisioning script for the various +# VMware modules and services +################################################################################ + +VMWARE_CONF_DIR=/opt/openslx/vmchooser/vmware +VMCHOOSER_CONF_DIR=/opt/openslx/vmchooser/config + +. /opt/openslx/config + +load_modules () { + local FAILED="" + # module stuff + insmod /lib/modules/vmware/vmmon.ko || FAILED="$FAILED vmmon" + insmod /lib/modules/vmware/vmnet.ko || FAILED="$FAILED vmnet" + #insmod /lib/modules/vmware/vmci.ko || FAILED="$FAILED vmci" + #insmod /lib/modules/vmware/vmblock.ko || FAILED="$FAILED vmblock" + #insmod /lib/modules/vmware/vsock.ko || FAILED="$FAILED vsock" + [ -n "$FAILED" ] && slxlog "vmware-insmod" "Error loading vmware kernel module(s) $FAILED" +} + +unload_modules () { + rmmod vmnet vmmon #vsock vmci vmblock +} + +vmnet_create() { + vmnet="$1" + # first, create device node + dev="/dev/vmnet${vmnet}" + if ! [ -c "$dev" ] && ! mknod "${dev}" c 119 "${vmnet}"; then + slxlog "vmware-node-vmnet" "Could not create ${dev}" + return 1 + fi + chmod 0700 "${dev}" + # now bring it up + if ! /usr/bin/vmnet-netifup -d "/var/run/vmnet-netifup-vmnet${vmnet}.pid" "${dev}" "vmnet${vmnet}" ; then + slxlog "vmware-netifup" "Launching /usr/bin/vmnet-netifup for vmnet${vmnet} failed." + fi + ip link set dev "vmnet${vmnet}" up +} + +vmnetif () { + local vmnet nic NICS + # create the needed devices which effects all vmware options + # they are not created automatically via module load + if ! [ -e /dev/vmmon ]; then + mknod /dev/vmmon c 10 165 || slxlog "vmware-node-vmmon" "Could not create /dev/vmmon" + fi + # network interfaces + # 1) default ones + for vmnet in 0 1 2; do + vmnet_create "$vmnet" + done + # Set the vmware interface to 9000 too, as br0 will use the smallest of all slave devices + [ "x$SLX_JUMBO_FRAMES" = "xyes" ] && ip link set dev vmnet0 mtu 9000 + # setup bridge (vmnet0), nat (vmnet1) and software defined networking (vmnet2) interfaces + brctl addif br0 vmnet0 + brctl addif nat1 vmnet1 + brctl addif vsw2 vmnet2 + # 2) see if we should bridge additional interfaces + NICS= + if [ "$SLX_BRIDGE_OTHER_NICS" = "yes" ]; then + # These will have been set up in our init + NICS=$( ls -1 /sys/class/net | grep '^br-nic-' | cut -c 8- ) + vmnet=10 + for nic in $NICS; do + if ! [ "$nic" -gt 0 ] && ! [ "$nic" -eq 0 ]; then + slxlog "vmware-other-nics" "NaN: br-nic-X has X='$nic'" + continue + fi + # create vmnet10 - vmnetN for these + vmnet_create "$vmnet" + brctl addif "br-nic-${nic}" "vmnet${vmnet}" + vmnet="$(( vmnet + 1 ))" + done + fi + +} + +vmblock () { + if ! /usr/bin/vmware-usbarbitrator; then + slxlog "vmware-usbarb" "Launching /usr/bin/vmware-usbarbitrator failed." + fi +} + +# create required standard directories +mkdir -p "/tmp/virt/vmware" "/dev/shm/vmware" "/run/vmware" -m 1777 + +# FixMe: Should be rewritten for proper systemd operation +case "$1" in + start) + # hack to access the first serial/parallel port + [ -c /dev/ttyS0 ] && chmod a+rw /dev/ttyS0 + [ -c /dev/parport0 ] && chmod a+rw /dev/parport0 + load_modules + vmnetif + vmblock + ;; + stop) + #stop: defines stop function for initscript + killall vmnet-netifup vmnet-bridge vmware vmplayer vmware-tray + # might take a while until all services are shut down + sleep 0.5 + unload_modules + + ;; + restart) + #restart: defines restart function for initscript + $0 stop && $0 start + ;; + status) + #status: defines status function for initscript + vmstatus + ;; +esac + +# Breaks performance with certain workloads, so disable. +# See https://unix.stackexchange.com/a/185172 for details and further references +echo never > /sys/kernel/mm/transparent_hugepage/defrag +echo 0 > /sys/kernel/mm/transparent_hugepage/khugepaged/defrag + +exit 0 + diff --git a/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc new file mode 100644 index 00000000..b4197051 --- /dev/null +++ b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/create_vmhome_preferences_file.inc @@ -0,0 +1,81 @@ +#!/bin/bash +########################################### +# Include: Create VMware preferences file # +########################################### +## Functions ## +create_vmhome_preferences_file() { + cat > "${VM_HOME}/preferences" <<-HEREEND + .encoding = "UTF-8" + # This configuration file was generated on $(date) + # by $0 for VMWare version $vmware_version + + # updates + webUpdate.enabled = "FALSE" + webUpdate.lastCheck.status = "done_updates" + webUpdate.checkPeriod = "never" + pref.downloadPermission = "DENY" + pref.vmplayer.downloadPermission = "DENY" + pref.vmplayer.webUpdateOnStartup = "FALSE" + pref.lastUpdateCheckSec = "$(date +%s)" + # hints + pref.tip.startup = "FALSE" + hints.hideAll = "TRUE" + hint.vmui.showAllUSBDevs = "FALSE" + hint.usb.disconnectHostdriver = "FALSE" + hint.vmui.reset = "FALSE" + hint.vmui.poweroff = "FALSE" + hint.upgrade.legacyVM = "FALSE" + hint.tools.toolsReminder = "FALSE" + hint.nfsmounted.persistent = "FALSE" + hint.loader.debug.beta = "FALSE" + hint.leaveFullScreen = "FALSE" + hint.guestos.xp = "FALSE" + hint.buslogic.needDriver = "FALSE" + + # configs + prefvmx.defaultVMPath = "${VM_HOME}" + prefvmx.mru.config = "$VM_RUN_FILE:" + + # hot keys + pref.hotkey.control = "true" + pref.hotkey.alt = "true" + pref.hotkey.shift = "true" + pref.hotkey.gui = "true" + + # fullscreen/mouse/keyboard + pref.fullscreen.toolbarPixels = "0" + pref.vmplayer.fullscreen.autohide = "TRUE" + pref.vmplayer.fullscreen.nobar = 1 + pref.grabOnMouseClick = "TRUE" + pref.grabOnKeyPress = "TRUE" + pref.motionGrab = "TRUE" + pref.motionUngrab = "TRUE" + pref.hideCursorOnUngrab = "TRUE" + pref.autoFit = "TRUE" + pref.autoFitFullScreen = "fitGuestToHost" + pref.autoFitGuestToWindow = "TRUE" + pref.vmplayer.exit.vmAction = "poweroff" + pref.vmplayer.confirmOnExit = "TRUE" + pref.backgroundOnClose = "FALSE" + pref.trayicon.enabled = "FALSE" + pref.keyboardAndMouse.vmHotKey.enabled = "FALSE" + pref.keyboardAndMouse.vmHotKey.count = "0" + + # shared folders + pref.enableAllSharedFolders = "TRUE" + + # eula + pref.vmplayer.firstRunDismissedVersion = "$vmware_version" + pref.eula.count = "2" + pref.eula0.product = "VMware Player" + pref.eula0.build = "$vmware_build" + pref.eula1.product = "VMware Workstation" + pref.eula1.build = "$vmware_build" + HEREEND + if [ -n "$SLX_EXAM" ]; then + echo 'pref.hotkey.rightControl = "true"' >> "${VM_HOME}/preferences" + fi + writelog "Vmware preferences file created in $VM_HOME." +} + +call_post_source create_vmhome_preferences_file diff --git a/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/determine_hardware_limitations.inc b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/determine_hardware_limitations.inc new file mode 100644 index 00000000..c288ed09 --- /dev/null +++ b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/determine_hardware_limitations.inc @@ -0,0 +1,197 @@ +#!/bin/bash +########################################################################## +# Include: Determine limitations caused by hardware version and guest os # +########################################################################## +## Functions +set_vm_hardware_limits() { + # Sanity checks + if isempty VM_OS_TYPE; then + writelog "VM_OS_TYPE is empty! This should have been parsed from the VM metadata." + EXIT_TYPE="user" EXIT_REASON="Konnte Gastbetriebsystems der gewählten virtuellen Maschine nicht ermitteln!" cleanexit 1 + fi + + declare -g MAXMEM="9999999" + declare -g MAXCORES="4" + declare -g SHARED_FOLDERS="TRUE" + declare -g SOUND_DEV="es1371" + + # define hardware configuration depending on the guest OS used + # this needs to be fixed and is the base for the creation of new VMs + case "$VM_OS_TYPE" in + win31*|windows31*) + VM_OS_TYPE="win31" + SHARED_FOLDERS="FALSE" + SOUND_DEV="sb16" + MAXMEM="32" + MAXCORES="1" + ;; + winnt*|windowsnt*) + VM_OS_TYPE="winnt" + SHARED_FOLDERS="FALSE" + SOUND_DEV="sb16" + MAXMEM="1000" + MAXCORES="2" + ;; + win95*|windows95*) + VM_OS_TYPE="win95" + SHARED_FOLDERS="FALSE" + MAXMEM="96" + MAXCORES="1" + ;; + win98*|windows98*) + VM_OS_TYPE="win98" + MAXMEM="256" + MAXCORES="1" + ;; + winme*|windowsme*) + VM_OS_TYPE="winme" + MAXMEM="384" + MAXCORES="1" + ;; + win2000|windows2000|win2000pro*) + VM_OS_TYPE="win2000pro" + MAXMEM="4000" + MAXCORES="2" + ;; + win2000srv*|windows2000srv*|win2000serv*|windows2000serv*) + VM_OS_TYPE="win2000serv" + SHARED_FOLDERS="FALSE" + MAXMEM="4000" + MAXCORES="4" + ;; + win2000adv*|windows2000adv*|win2000dat*|windows2000dat*) + VM_OS_TYPE="win2000advserv" + SHARED_FOLDERS="FALSE" + MAXMEM="8000" + MAXCORES="8" + ;; + winnet*64|win*2003*64|windowsnet*64) + VM_OS_TYPE="winnetstandard-64" + MAXMEM="8000" + MAXCORES="8" + ;; + winnet*|win*2003*|windowsnet*) + VM_OS_TYPE="winnetstandard" + MAXMEM="4000" + MAXCORES="8" + ;; + winxphome*|windowsxphome*) + VM_OS_TYPE="winxphome" + MAXMEM="4000" + MAXCORES="2" + ;; + winxp*64|windowsxp*64) + VM_OS_TYPE="winxppro-64" + MAXMEM="8000" + MAXCORES="8" + ;; + winxp*|windowsxp*) + VM_OS_TYPE="winxppro" + MAXMEM="4000" + MAXCORES="4" + ;; + winvista-64) + VM_OS_TYPE="winvista-64" + MAXMEM="16000" + MAXCORES="4" + ;; + windows7-64) + VM_OS_TYPE="windows7-64" + MAXMEM="32000" + MAXCORES="8" + ;; + windows8-64) + VM_OS_TYPE="windows8-64" + MAXMEM="32000" + MAXCORES="8" + ;; + windows9-64) + VM_OS_TYPE="windows9-64" + MAXMEM="64000" + MAXCORES="8" + ;; + winvista) + VM_OS_TYPE="winvista" + MAXMEM="8000" + MAXCORES="2" + ;; + windows7) + VM_OS_TYPE="windows7" + MAXMEM="8000" + MAXCORES="4" + ;; + windows8) + VM_OS_TYPE="windows8" + MAXMEM="8000" + MAXCORES="4" + ;; + windows9) + VM_OS_TYPE="windows9" + MAXMEM="8000" + MAXCORES="4" + ;; + win*64) + MAXMEM="16000" + MAXCORES="4" + ;; + win*) + MAXMEM="8000" + MAXCORES="1" + ;; + dos|msdos*|ms-dos*) + VM_OS_TYPE="dos" + SHARED_FOLDERS="FALSE" + MAXMEM="128" + MAXCORES="1" + ;; + macos*64) + VM_OS_TYPE="freebsd-64" + MAXMEM="4000" + MAXCORES="2" + ;; + macos*) + VM_OS_TYPE="freebsd" + MAXMEM="4000" + MAXCORES="1" + ;; + beos*) + VM_OS_TYPE="other" + SHARED_FOLDERS="FALSE" + ;; + # Unknown guestOS setting in .xml - this encompasses linux too, + # as there is a multitude of different distributions. Perhaps further + # action will be needed if this leads to problems with exotic OSs. + *64) + VM_OS_TYPE="other-64" + # SHARED_FOLDERS="FALSE" + MAXMEM="123456" + MAXCORES="4" + ;; + *) + VM_OS_TYPE="other" + # SHARED_FOLDERS="FALSE" + MAXMEM="8000" + MAXCORES="1" + ;; + esac + + declare -rg HOST_CORE_COUNT="$CPU_CORES" + [ "$CPU_CORES" -gt "$MAXCORES" ] && CPU_CORES="$MAXCORES" + + # It currently makes no sense to set the virtual number of cores + # to a different value than the virtual number of cores per virtual CPU. + declare -rg VM_CORES_PER_SOCKET="$CPU_CORES" + + if [ "x$SHARED_FOLDERS" != "xFALSE" ] && [ "$SHARE_REMAP_MODE" -gt 1 ]; then + declare -rg HGFS_DISABLED="FALSE" + else + declare -rg HGFS_DISABLED="TRUE" + fi + + [ "${VM_MEM}" -ge "${MAXMEM}" ] && VM_MEM="${MAXMEM}" + [ "${VM_HW_VERSION}" -lt "7" -a "${VM_MEM}" -gt "3500" ] && VM_MEM="3500" + return 0 +} + +## MAIN ## +call_post_source set_vm_hardware_limits diff --git a/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc new file mode 100644 index 00000000..d7ad77c6 --- /dev/null +++ b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/init_core.inc @@ -0,0 +1,55 @@ +#!/bin/bash +####################################################################### +# Include: Declaration of core functions and variables of this plugin # +####################################################################### +# This core include just runs commands directly + +## Sanity checks for systemd-vmware_env +# /dev/vmmon should exist, missing vmnet's does not make vmplayer crash +if [ ! -c /dev/vmmon ]; then + # would cause vmplayer to crash, so abort + EXIT_TYPE="internal" EXIT_REASON="VMWare wurde nicht richtig initialisiert!" cleanexit 1 +fi + +# For now define helpers here, maybe use a dedicated include later on +vmw_cap_hw_version() { + [ -z "$1" ] && writelog "cap_hw_version called without parameter!" && return 1 + [ "$1" -lt "$maxhardwareversion" ] && maxhardwareversion="$1" +} + +# Temporary disk space for logs, etc... +declare -rg VM_REDO_DIR="/tmp/virt/vmware/${USER}.$$" + +# Dir for configs and vmem file +declare -rg VM_CONF_DIR="/tmp/virt/vmware/${USER}.$$" + +# The VMX file of the starting VM +declare -rg VM_RUN_FILE="${VM_CONF_DIR}/run-vmware.conf" + +# Users vmware config folder +[ -z "$UID" ] && UID=$(id -u) +[ -z "${HOME}" ] && declare -rg HOME=$(getent passwd "$UID" | awk -F ':' '{print $6}') +[ -z "${HOME}" ] && slxlog "run-virt-vmware-home" "Could not get home directory of user $(whoami) ($UID)" +declare -rg VM_HOME="${HOME}/.vmware" + +# mltk generates a vmware config file with several version infos for vmware/player, read it +$(safesource "${VMWARE_PLUGIN_DIR}/vmware.conf") + +# VMware start options +# "-X": start in fullscreen +declare -rg VM_START_OPTIONS="-X" + +# create vmware directories +mkdir -p "$VM_REDO_DIR" >/dev/null 2>&1 +mkdir -p "$VM_CONF_DIR" >/dev/null 2>&1 +mkdir -p "$VM_HOME/dndlogs" >/dev/null 2>&1 +touch "$VM_HOME/dndlogs/dndlog.conf" >/dev/null 2>&1 + +# link to VM_RUN_FILE if VM_CONF_DIR != VM_REDO_DIR +[ "$VM_CONF_DIR" != "$VM_REDO_DIR" ] && ln -s "$VM_RUN_FILE" "$VM_REDO_DIR/run-vmware.conf" >/dev/null 2>&1 + +# own nvram. We need it for floppy drive b, default nvram has just drive a +if ! cp "${VMWARE_PLUGIN_DIR}/nvram" "$VM_CONF_DIR/nvram"; then + slxlog "virt-vmware-nvram" "Could not copy nvram from '${VMWARE_PLUGIN_DIR}/nvram' '$VM_CONF_DIR/nvram'" +fi + diff --git a/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/log_config_summary.inc b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/log_config_summary.inc new file mode 100644 index 00000000..0c20cbcc --- /dev/null +++ b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/log_config_summary.inc @@ -0,0 +1,60 @@ +#!/bin/bash +################################################## +# Include: Print vm config summary into log file # +################################################## + +log_config_summary() { + # write all results to logfile + # log disksetup + writelog "Directories:" + writelog "\tConfig dir:\t\t${VM_CONF_DIR}" + writelog "\tConfig file:\t\t${VM_RUN_FILE}" + writelog "\tRedo dir:\t\t${VM_REDO_DIR}" + writelog "\tVM home:\t\t${VM_HOME}" + writelog "\tDrag n' drop log:\t${VM_HOME}/dndlogs" + writelog "\t/tmp info:\t\t$(grep "/tmp " /proc/mounts) $(df -h | grep " /tmp$" | awk '{print $2}')" + + # hw setup + writelog "Hardware:" + writelog "\tvCPUs:\t\t\t${CPU_CORES}" + writelog "\tVM RAM:\t\t\t${VM_MEM} MB" + writelog "\tMAC:\t\t\t${VM_MAC_ADDR}" + if [ -n "${network_card}" ]; then + writelog "\tNet Adaptor:\t\t${network_card}" + fi + + writelog "\tCD-ROM 1:\t\t${CDROM0}" + writelog "\tCD-ROM 2:\t\t${CDROM1}" + writelog "\tFloppy A:\t\t${FLOPPY0}" + # echo nur wenn HOST_MEM_REMAINING gesetzt + if isset HOST_MEM_REMAINING; then + writelog "\tRemaining host RAM:\t${HOST_MEM_REMAINING} MB" + fi + + # image + writelog "Disk image:" + writelog "\tDisk file:\t\t${VM_DISKFILE_RO}" + if isset VM_DISKFILE_RW; then + writelog "\tDisk mode:\t\twritable" + writelog "\tRW-Layer:\t\t${VM_DISKFILE_RW}" + else + writelog "\tDisk mode:\t\tread-only" + fi + writelog "\tHardware version:\t${VM_HW_VERSION}" + writelog "\tGuest OS:\t\t${VM_OS_TYPE}" + + # misc + writelog "Misc:" + writelog "\tDisplayname:\t\t${VM_DISPLAYNAME}" + if [ "${cap3d}" = "TRUE" -a "${enable3d}" = "TRUE" ]; then + writelog "\t3D Graphics:\tenabled" + fi + if [ "${HGFS_DISABLED}" = "FALSE" ]; then + writelog "\tShared folders:\t\tdisabled" + else + writelog "\tShared folders:\t\tenabled." + fi + # empty line at end + writelog "" +} +call_post_source log_config_summary diff --git a/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc new file mode 100644 index 00000000..47330bb0 --- /dev/null +++ b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/parse_vmx.inc @@ -0,0 +1,32 @@ +###################################################################### +# Include: Parsing the non-legacy delivered vmxfile ${TMPCONFIG} # +###################################################################### +## Functions +parse_vmx() { + # To avoid potential syntax problems from the vmx served by dmsd, sanitize + # it before continuing with filling in the gaps + local TMPTMPCONFIG="$(mktemp)" + grep -E '^\s*(#|[^=]+=[^"]*"[^"]*"\s*$|[^=]+=[^"]+$|$)' "$TMPCONFIG" > "$TMPTMPCONFIG" + if ! diff -q "$TMPCONFIG" "$TMPTMPCONFIG"; then + # file was corrupted, log it + writelog "'$TMPCONFIG' had bad syntax and was pruned by the post-download sanitizer!" + slxlog -s "virt-vmware-vmx-corrupt" "Downloaded .vmx for '$IMGUUID' has a corrupted format!" "$TMPCONFIG" + fi + mv -f -- "$TMPTMPCONFIG" "$TMPCONFIG" + + writelog "Parsing virtual machine description file..." + local -i HW_VERSION=$(grep -i -m1 '^virtualHW.version *= *' "${TMPCONFIG}" | awk -F '=' '{print $2}' | sed -r 's/[^0-9]//g') + if notempty HW_VERSION; then + declare -g VM_HW_VERSION="${HW_VERSION}" + return 0 + fi + return 1 +} + +## MAIN ## +if notempty TMPCONFIG; then + call_post_source parse_vmx +else + writelog "Path to VMX file is not set or empty! Aborting..." + EXIT_TYPE="internal" EXIT_REASON="Konnte Pfad zur VMX-Datei nicht finden!" cleanexit 1 +fi diff --git a/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc new file mode 100644 index 00000000..a7d3d837 --- /dev/null +++ b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc @@ -0,0 +1,297 @@ +#!/bin/bash +################################################ +# Include: Create final VMX configuration file # +################################################ + + +# check for vmdk file marker %VM_DISK_PATH% and put vmdk path in it's place: also VM_DISK_MODE +# and VM_DISK_REDOLOGDIR. +replace_placeholders() { + if [ -n "$VM_DISKFILE_RW" ]; then + sed -i 's#%VM_DISK_PATH%#'"$VM_DISKFILE_RW"'#g' "${TMPCONFIG}" + sed -i 's#%VM_DISK_MODE%#'"independent-persistent"'#g' "${TMPCONFIG}" + else + sed -i 's#%VM_DISK_PATH%#'"$VM_DISKFILE_RO"'#g' "${TMPCONFIG}" + sed -i 's#%VM_DISK_MODE%#'"independent-nonpersistent"'#g' "${TMPCONFIG}" + fi + sed -i 's#%VM_DISK_REDOLOGDIR%#'"$VM_REDO_DIR"'#g' "${TMPCONFIG}" +} + +# Ethernet: All we do is entering a generated MAC, as we do not want to interfere +# in the possible case no networking is wanted. +setup_ethernet() { + echo 'ethernet0.addressType = "static"' >> "${TMPCONFIG}" + echo 'ethernet0.address = "'"${VM_MAC_ADDR}"'"' >> "${TMPCONFIG}" + if [ -n "$OTHER_NICS" ]; then + local devtype mac cnt eth + # Copy type of eth0, in case the others don't specify a type in the vmx, we'll use the same + # so we know the drivers are there + devtype=$(< "${TMPCONFIG}" grep -m1 -i '^ethernet0\.virtualDev' | sed -r 's/^[^=]+//;s/^(\s|=|")*//;s/(\s|")+$//') # TODO: Make a helper like "getVmxOption" + cnt=0 + for mac in $OTHER_NICS; do + vmnet=$(( cnt + 10 )) + cnt=$(( cnt + 1 )) + eth="ethernet${cnt}" + # Check device exists + if ! [ -c "/dev/vmnet${vmnet}" ]; then + slxlog "vmware-bridge-setup" "Cannot bridge NIC into VM: /dev/vmnet${vmnet} does not exist" + continue + fi + # Remove lines that could break things + sed -i "/^${eth}\.connectionType/Id;/^${eth}\.present/Id" "${TMPCONFIG}" + # Set up devType + devline= + if ! grep -q -i "^${eth}\.virtualDev" "${TMPCONFIG}" && [ -n "$devtype" ]; then + devline="${eth}.virtualDev = "'"'"${devtype}"'"' + fi + cat >> "${TMPCONFIG}" <<-HEND + ${eth}.connectionType = "custom" + ${eth}.present = "TRUE" + ${eth}.vnet = "vmnet${vmnet}" + ${eth}.addressType = "static" + ${eth}.address = "${mac}" + ${devline} + HEND + done + fi +} + +# DVD, CDROM +setup_optical_drives() { + # XXX: For now it's safe to assume ide channel 1 is free, as we support only one HDD. + # If it's IDE, it's on channel 0 + cat >> "${TMPCONFIG}" <<-HEREEND + ide1:0.present = "$CDROM0" + ide1:0.autodetect = "TRUE" + ide1:0.fileName = "auto detect" + ide1:0.deviceType = "cdrom-raw" + ide1:1.present = "$CDROM1" + ide1:1.autodetect = "TRUE" + ide1:1.fileName = "auto detect" + ide1:1.deviceType = "cdrom-raw" + HEREEND +} + +setup_floppies() { + local SLX_FLOPPY + if isset SLX_FLOPPY_IMG; then + SLX_FLOPPY="TRUE" + else + SLX_FLOPPY="FALSE" + fi + + # Floppies: + cat >> "${TMPCONFIG}" <<-HEREEND + floppy0.present = "TRUE" + floppy0.startConnected = "$FLOPPY0" + floppy0.autodetect = "TRUE" + floppy0.fileName = "auto detect" + floppy1.present = "$SLX_FLOPPY" + floppy1.startConnected = "TRUE" + floppy1.fileType = "file" + floppy1.fileName = "$SLX_FLOPPY_IMG" + HEREEND +} + +setup_serial() { + # Serial port + if [ -n "$SERIAL0" ]; then + cat >> "${TMPCONFIG}" <<-HEREEND + serial0.present = "TRUE" + serial0.startConnected = "TRUE" + serial0.fileType = "device" + serial0.fileName = "$SERIAL0" + serial0.tryNoRxLoss = "FALSE" + serial0.autodetect = "FALSE" + HEREEND + fi + + # Parallel port + if [ -n "$PARALLEL0" ]; then + cat >> "${TMPCONFIG}" <<-HEREEND + parallel0.present = "TRUE" + parallel0.startConnected = "TRUE" + parallel0.fileType = "device" + parallel0.fileName = "$PARALLEL0" + parallel0.bidirectional = "TRUE" + parallel0.autodetect = "FALSE" + HEREEND + fi +} + +# CPU and RAM +setup_vcpu_ram() { + #writelog "numvcpus = ${CPU_CORES} - maxvcpus=${HOST_CORE_COUNT}" + cat >> "${TMPCONFIG}" <<-HEREEND + numvcpus = "$CPU_CORES" + cpuid.coresPerSocket = "$VM_CORES_PER_SOCKET" + maxvcpus = "$HOST_CORE_COUNT" + memsize = "${VM_MEM}" + MemAllowAutoScaleDown = "FALSE" + MemTrimRate = "-1" + HEREEND +} + +setup_usb() { + # USB fallback: Only write usb config if there's none + if ! grep -q -i "^usb\.present" "${TMPCONFIG}"; then + # Nothing found, go ahead + if [ -n "$SLX_EXAM" ]; then # TODO better handling of exam mode... + # Exam mode: Default to no USB + sed -i '/^usb\./Id' "${TMPCONFIG}" + echo 'usb.present = "FALSE"' >> "${TMPCONFIG}" + else + echo 'usb.present = "TRUE"' >> "${TMPCONFIG}" + fi + fi + sed -i '/^usb\.generic\.autoconnect/Id' "${TMPCONFIG}" + echo 'usb.generic.autoconnect = "TRUE"' >> "${TMPCONFIG}" + + # USB 3.0 support changes quality and has different side effects + # with every minor release of vmware. Always force 2.0 for now. + # TODO: Get it fixed by vmware? + sed -i '/^ehci\.present/Id;/^usb_xhci\.present/Id' "${TMPCONFIG}" + echo 'ehci.present = "TRUE"' >> "${TMPCONFIG}" + + # See if there are any USB devices connected that we want to pass through immediately + get_usb_devices 'usb.autoConnect.deviceXXXXX = "0x%VENDOR%:0x%PRODUCT%"' \ + | sed -r 's/0x0+/0x/g' \ + | awk '{sub(/XXXXX/,NR-1)}1' \ + >> "${TMPCONFIG}" +} + +setup_shared_folders() { + if ! notempty SHARED_FOLDERS HOME_SHARE_PATH HOME_SHARE_NAME COMMON_SHARE_PATH COMMON_SHARE_NAME; then + writelog "Missing information to setup shared folders." + return 1 + fi + + cat >> "${TMPCONFIG}" <<-HEREEND + sharedFolder.option = "alwaysEnabled" + sharedFolder0.present = "$SHARED_FOLDERS" + sharedFolder0.enabled = "$SHARED_FOLDERS" + sharedFolder0.expiration = "never" + sharedFolder0.guestName = "$HOME_SHARE_NAME" + sharedFolder0.hostPath = "$HOME_SHARE_PATH" + sharedFolder0.readAccess = "TRUE" + sharedFolder0.writeAccess = "TRUE" + sharedFolder1.present = "$SHARED_FOLDERS" + sharedFolder1.enabled = "$SHARED_FOLDERS" + sharedFolder1.expiration = "never" + sharedFolder1.guestName = "$COMMON_SHARE_NAME" + sharedFolder1.hostPath = "$COMMON_SHARE_PATH" + sharedFolder1.readAccess = "TRUE" + sharedFolder1.writeAccess = "FALSE" + sharedFolder.maxNum = "2" + hgfs.mapRootShare = "TRUE" + hgfs.linkRootShare = "TRUE" + HEREEND +} + +setup_isolation() { + # Settings for isolation tools (drag & drop, copy & paste, etc...) + cat >> "${TMPCONFIG}" <<-HEREEND + isolation.tools.hgfs.disable = "$HGFS_DISABLED" + isolation.tools.dnd.disable = "FALSE" + isolation.tools.copy.enable = "TRUE" + isolation.tools.paste.enabled = "TRUE" + HEREEND +} + +# Serial, parallel: Empty, nothing is being currently set. TODO later. + +setup_graphics() { + # Graphics, GPU: 3D will be enabled (even if vmware doesn't support the chip) if we whitelisted it. + if isset SLX_VMWARE_3D; then + writelog "FORCE3D set - overriding 3D in vmx file." + echo 'mks.gl.allowBlacklistedDrivers = "TRUE"' >> "${TMPCONFIG}" + # We override... play safe and cap the hwVersion to 10, since some i915 chips goofed up with 12 + # Investigate if we might have to do this in other cases where we don't override + if grep -qi '^mks.enable3d.*true' "${TMPCONFIG}"; then + vmw_cap_hw_version "10" + fi + else + writelog "FORCE3D not set - 3D will only work if GPU/driver is whitelisted by vmware." + fi + + # Disable DPI scaling information passing via vmware tools + sed -i '/^gui.applyHostDisplayScaling/Id' "${TMPCONFIG}" + echo 'gui.applyHostDisplayScalingToGuest = "FALSE"' >> "${TMPCONFIG}" + + # Additinal exam mode settings + if [ -n "$SLX_EXAM" ]; then + echo 'gui.restricted = "true"' >> "${TMPCONFIG}" + fi + + # Hack resolution if we know the desired one is not in the default list of vmx_svga + # For now, only do it on the odd ones, as we don't know if this has any side effects + # This seems unnecessary on Win7 but is required on WinXP - need more research for other OSs + case "$RESOLUTION" in + 1600x900|2560x1440|2880x1800|3200x1800) + X=${RESOLUTION%x*} + Y=${RESOLUTION#*x} + BYTES=$(( ( ( X * Y * 4 + 65535 ) / 65536 ) * 65536 )) + [ "$BYTES" -lt 16777216 ] && BYTES=16777216 + cat >> "${TMPCONFIG}" <<-EOF + svga.autodetect = "FALSE" + svga.vramSize = $BYTES + svga.maxWidth = $X + svga.maxHeight = $Y + EOF + ;; + esac + + # Killing duplicate lines (output much nicer than sort -u): + awk '!a[$0]++' "${TMPCONFIG}" > "${TMPCONFIG}.tmp" && mv -f "${TMPCONFIG}.tmp" "${TMPCONFIG}" +} + +finalize_hardware() { + # Apply $maxhardwareversion to final VMX + if notempty VM_HW_VERSION && [ "$VM_HW_VERSION" -gt "$maxhardwareversion" ]; then + writelog "Hardware version capped to $maxhardwareversion (was $VM_HW_VERSION)" + sed -i 's/^virtualHW\.version.*$/virtualHW.version = "'$maxhardwareversion'"/I' "${TMPCONFIG}" + VM_HW_VERSION="$maxhardwareversion" + fi + + # Enable nested virtualization if not specified in remote vmx + if [ -e "/run/hwinfo" ] && ! grep -qi '^vhv\.enable' "${TMPCONFIG}" \ + && grep -qE '^flags\s*:.*\b(ept|npt)\b' "/proc/cpuinfo" \ + && [ "$VM_HW_VERSION" -ge "9" ]; then + . "/run/hwinfo" + [ "${HW_KVM}" = "ENABLED" ] && echo 'vhv.enable = "TRUE"' >> "${TMPCONFIG}" + fi + + # Disable space check warnings + sed -i '/^mainMem.freeSpaceCheck/Id' "${TMPCONFIG}" + echo 'mainMem.freeSpaceCheck = "FALSE"' >> "${TMPCONFIG}" + + # TODO: Need a way to check if supported by hardware before enabling! + #grep -qi '^vpmc\.enable' "${TMPCONFIG}" || echo 'vpmc.enable = "TRUE"' >> "${TMPCONFIG}" +} + + +## MAIN ## +write_final_vmx() { + replace_placeholders + setup_ethernet + setup_optical_drives + setup_floppies + setup_serial + setup_vcpu_ram + setup_usb + [ "x$HGFS_DISABLED" = "xFALSE" ] && setup_shared_folders + setup_isolation + setup_graphics + finalize_hardware + + # At last: Let's copy it to $VM_CONF_DIR/run-vmware.conf + if cp -p "${TMPCONFIG}" "${VM_RUN_FILE}"; then + writelog "Copied '${TMPCONFIG}' to '${VM_RUN_FILE}'" + else + writelog "Could not copy TMPDIR/IMGUUID -${TMPCONFIG}- to VM_RUN_FILE ${VM_RUN_FILE}!" + # cleanexit 1 # that seems not needed! + fi +} +call_post_source write_final_vmx + + diff --git a/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/nvram b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/nvram Binary files differnew file mode 100644 index 00000000..88074390 --- /dev/null +++ b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/nvram diff --git a/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include new file mode 100644 index 00000000..a552038b --- /dev/null +++ b/core/modules/vmware12/data/opt/openslx/vmchooser/plugins/vmware/run-virt.include @@ -0,0 +1,61 @@ +# ----------------------------------------------------------------------------- +# Copyright (c) 2009..2017 - RZ Uni Freiburg +# Copyright (c) 2009..2017 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# run-virt.include +# - component for vmware/player of the vmchooser plugin vmchooser-run_virt +################################################################################ + +# BASH_SOURCE[0] contains the file being sourced, namely this one +declare -rg VMWARE_PLUGIN_DIR="$(dirname "${BASH_SOURCE[0]}")" +declare -rg VMWARE_INCLUDE_DIR="${VMWARE_PLUGIN_DIR}/includes" + +# TODO make this part of the metadata coming from the server +# Define which features the VMware plugin supports +declare -rg PLUGIN_FEATURES="firewall printer usb slxfloppy sound netshares" + +run_plugin() { + # declaration of default functions and variables for vmware + $(safesource --exit "${VMWARE_INCLUDE_DIR}/init_core.inc") + + # get information from downloaded vmx + $(safesource "${VMWARE_INCLUDE_DIR}/parse_vmx.inc") + + # determine limitations wrt RAM and CPU count of VM + $(safesource "${VMWARE_INCLUDE_DIR}/determine_hardware_limitations.inc") + + # create preferences file ${HOME}/.vmware/preferences + $(safesource "${VMWARE_INCLUDE_DIR}/create_vmhome_preferences_file.inc") + + # parse the given vmx file + $(safesource "${VMWARE_INCLUDE_DIR}/write_final_vmx.inc") + + # print summary - needs writelog() from vmchooser-run_virt + $(safesource "${VMWARE_INCLUDE_DIR}/log_config_summary.inc") + + # For debugging + cp "$VM_RUN_FILE" "/tmp/vmware-last-config" + + # HACK: make the mouse disappear + ( + local WINDOWS="$(xdotool search --sync --name '.*VMware.*Player.*')" + isempty WINDOWS && writelog "Could not find any vmplayer windows." + for WINDOW in $WINDOWS; do + xdotool set_desktop_for_window $WINDOW 0 || writelog "Could not move vmplayer to desktop 0" + xdotool windowactivate --sync $WINDOW || writelog "Could not activate vmplayer window" + xdotool key --delay 2000 --clearmodifiers ctrl+g || writelog "Could not send ctrl+g to vmplayer window" + done + ) & + + # HACK: using the modified version of the wrapper script + declare -rg VIRTCMD="/opt/openslx/bin/vmplayer" + declare -rg VIRTCMDOPTS="${VM_START_OPTIONS} ${VM_RUN_FILE}" +} diff --git a/core/modules/vmware12/data/usr/bin/vmplayer b/core/modules/vmware12/data/usr/bin/vmplayer new file mode 120000 index 00000000..2944838d --- /dev/null +++ b/core/modules/vmware12/data/usr/bin/vmplayer @@ -0,0 +1 @@ +/opt/openslx/bin/vmplayer
\ No newline at end of file diff --git a/core/modules/vmware12/data/usr/bin/vmware b/core/modules/vmware12/data/usr/bin/vmware new file mode 120000 index 00000000..bde6f9c0 --- /dev/null +++ b/core/modules/vmware12/data/usr/bin/vmware @@ -0,0 +1 @@ +/opt/openslx/bin/vmware
\ No newline at end of file diff --git a/core/modules/vmware12/data/usr/share/icons/hicolor/index.theme b/core/modules/vmware12/data/usr/share/icons/hicolor/index.theme new file mode 100644 index 00000000..5c9c50ad --- /dev/null +++ b/core/modules/vmware12/data/usr/share/icons/hicolor/index.theme @@ -0,0 +1,1662 @@ +[Icon Theme] +Name=Hicolor +Comment=Fallback icon theme +Hidden=true +Directories=16x16/actions,16x16/animations,16x16/apps,16x16/categories,16x16/devices,16x16/emblems,16x16/emotes,16x16/filesystems,16x16/intl,16x16/mimetypes,16x16/places,16x16/status,16x16/stock/chart,16x16/stock/code,16x16/stock/data,16x16/stock/form,16x16/stock/image,16x16/stock/io,16x16/stock/media,16x16/stock/navigation,16x16/stock/net,16x16/stock/object,16x16/stock/table,16x16/stock/text,22x22/actions,22x22/animations,22x22/apps,22x22/categories,22x22/devices,22x22/emblems,22x22/emotes,22x22/filesystems,22x22/intl,22x22/mimetypes,22x22/places,22x22/status,22x22/stock/chart,22x22/stock/code,22x22/stock/data,22x22/stock/form,22x22/stock/image,22x22/stock/io,22x22/stock/media,22x22/stock/navigation,22x22/stock/net,22x22/stock/object,22x22/stock/table,22x22/stock/text,24x24/actions,24x24/animations,24x24/apps,24x24/categories,24x24/devices,24x24/emblems,24x24/emotes,24x24/filesystems,24x24/intl,24x24/mimetypes,24x24/places,24x24/status,24x24/stock/chart,24x24/stock/code,24x24/stock/data,24x24/stock/form,24x24/stock/image,24x24/stock/io,24x24/stock/media,24x24/stock/navigation,24x24/stock/net,24x24/stock/object,24x24/stock/table,24x24/stock/text,32x32/actions,32x32/animations,32x32/apps,32x32/categories,32x32/devices,32x32/emblems,32x32/emotes,32x32/filesystems,32x32/intl,32x32/mimetypes,32x32/places,32x32/status,32x32/stock/chart,32x32/stock/code,32x32/stock/data,32x32/stock/form,32x32/stock/image,32x32/stock/io,32x32/stock/media,32x32/stock/navigation,32x32/stock/net,32x32/stock/object,32x32/stock/table,32x32/stock/text,36x36/actions,36x36/animations,36x36/apps,36x36/categories,36x36/devices,36x36/emblems,36x36/emotes,36x36/filesystems,36x36/intl,36x36/mimetypes,36x36/places,36x36/status,36x36/stock/chart,36x36/stock/code,36x36/stock/data,36x36/stock/form,36x36/stock/image,36x36/stock/io,36x36/stock/media,36x36/stock/navigation,36x36/stock/net,36x36/stock/object,36x36/stock/table,36x36/stock/text,48x48/actions,48x48/animations,48x48/apps,48x48/categories,48x48/devices,48x48/emblems,48x48/emotes,48x48/filesystems,48x48/intl,48x48/mimetypes,48x48/places,48x48/status,48x48/stock/chart,48x48/stock/code,48x48/stock/data,48x48/stock/form,48x48/stock/image,48x48/stock/io,48x48/stock/media,48x48/stock/navigation,48x48/stock/net,48x48/stock/object,48x48/stock/table,48x48/stock/text,64x64/actions,64x64/animations,64x64/apps,64x64/categories,64x64/devices,64x64/emblems,64x64/emotes,64x64/filesystems,64x64/intl,64x64/mimetypes,64x64/places,64x64/status,64x64/stock/chart,64x64/stock/code,64x64/stock/data,64x64/stock/form,64x64/stock/image,64x64/stock/io,64x64/stock/media,64x64/stock/navigation,64x64/stock/net,64x64/stock/object,64x64/stock/table,64x64/stock/text,72x72/actions,72x72/animations,72x72/apps,72x72/categories,72x72/devices,72x72/emblems,72x72/emotes,72x72/filesystems,72x72/intl,72x72/mimetypes,72x72/places,72x72/status,72x72/stock/chart,72x72/stock/code,72x72/stock/data,72x72/stock/form,72x72/stock/image,72x72/stock/io,72x72/stock/media,72x72/stock/navigation,72x72/stock/net,72x72/stock/object,72x72/stock/table,72x72/stock/text,96x96/actions,96x96/animations,96x96/apps,96x96/categories,96x96/devices,96x96/emblems,96x96/emotes,96x96/filesystems,96x96/intl,96x96/mimetypes,96x96/places,96x96/status,96x96/stock/chart,96x96/stock/code,96x96/stock/data,96x96/stock/form,96x96/stock/image,96x96/stock/io,96x96/stock/media,96x96/stock/navigation,96x96/stock/net,96x96/stock/object,96x96/stock/table,96x96/stock/text,128x128/actions,128x128/animations,128x128/apps,128x128/categories,128x128/devices,128x128/emblems,128x128/emotes,128x128/filesystems,128x128/intl,128x128/mimetypes,128x128/places,128x128/status,128x128/stock/chart,128x128/stock/code,128x128/stock/data,128x128/stock/form,128x128/stock/image,128x128/stock/io,128x128/stock/media,128x128/stock/navigation,128x128/stock/net,128x128/stock/object,128x128/stock/table,128x128/stock/text,192x192/actions,192x192/animations,192x192/apps,192x192/categories,192x192/devices,192x192/emblems,192x192/emotes,192x192/filesystems,192x192/intl,192x192/mimetypes,192x192/places,192x192/status,192x192/stock/chart,192x192/stock/code,192x192/stock/data,192x192/stock/form,192x192/stock/image,192x192/stock/io,192x192/stock/media,192x192/stock/navigation,192x192/stock/net,192x192/stock/object,192x192/stock/table,192x192/stock/text,256x256/actions,256x256/animations,256x256/apps,256x256/categories,256x256/devices,256x256/emblems,256x256/emotes,256x256/filesystems,256x256/intl,256x256/mimetypes,256x256/places,256x256/status,256x256/stock/chart,256x256/stock/code,256x256/stock/data,256x256/stock/form,256x256/stock/image,256x256/stock/io,256x256/stock/media,256x256/stock/navigation,256x256/stock/net,256x256/stock/object,256x256/stock/table,256x256/stock/text,scalable/actions,scalable/animations,scalable/apps,scalable/categories,scalable/devices,scalable/emblems,scalable/emotes,scalable/filesystems,scalable/intl,scalable/mimetypes,scalable/places,scalable/status,scalable/stock/chart,scalable/stock/code,scalable/stock/data,scalable/stock/form,scalable/stock/image,scalable/stock/io,scalable/stock/media,scalable/stock/navigation,scalable/stock/net,scalable/stock/object,scalable/stock/table,scalable/stock/text + + +[16x16/actions] +Size=16 +Context=Actions +Type=Threshold + +[16x16/animations] +Size=16 +Context=Animations +Type=Threshold + +[16x16/apps] +Size=16 +Context=Applications +Type=Threshold + +[16x16/categories] +Size=16 +Context=Categories +Type=Threshold + +[16x16/devices] +Size=16 +Context=Devices +Type=Threshold + +[16x16/emblems] +Size=16 +Context=Emblems +Type=Threshold + +[16x16/emotes] +Size=16 +Context=Emotes +Type=Threshold + +[16x16/filesystems] +Size=16 +Context=FileSystems +Type=Threshold + +[16x16/intl] +Size=16 +Context=International +Type=Threshold + +[16x16/mimetypes] +Size=16 +Context=MimeTypes +Type=Threshold + +[16x16/places] +Size=16 +Context=Places +Type=Threshold + +[16x16/status] +Size=16 +Context=Status +Type=Threshold + +[16x16/stock/chart] +Size=16 +Context=Stock +Type=Threshold + +[16x16/stock/code] +Size=16 +Context=Stock +Type=Threshold + +[16x16/stock/data] +Size=16 +Context=Stock +Type=Threshold + +[16x16/stock/form] +Size=16 +Context=Stock +Type=Threshold + +[16x16/stock/image] +Size=16 +Context=Stock +Type=Threshold + +[16x16/stock/io] +Size=16 +Context=Stock +Type=Threshold + +[16x16/stock/media] +Size=16 +Context=Stock +Type=Threshold + +[16x16/stock/navigation] +Size=16 +Context=Stock +Type=Threshold + +[16x16/stock/net] +Size=16 +Context=Stock +Type=Threshold + +[16x16/stock/object] +Size=16 +Context=Stock +Type=Threshold + +[16x16/stock/table] +Size=16 +Context=Stock +Type=Threshold + +[16x16/stock/text] +Size=16 +Context=Stock +Type=Threshold + +[22x22/actions] +Size=22 +Context=Actions +Type=Threshold + +[22x22/animations] +Size=22 +Context=Animations +Type=Threshold + +[22x22/apps] +Size=22 +Context=Applications +Type=Fixed + +[22x22/categories] +Size=22 +Context=Categories +Type=Threshold + +[22x22/devices] +Size=22 +Context=Devices +Type=Threshold + +[22x22/emblems] +Size=22 +Context=Emblems +Type=Threshold + +[22x22/emotes] +Size=22 +Context=Emotes +Type=Threshold + +[22x22/filesystems] +Size=22 +Context=FileSystems +Type=Threshold + +[22x22/intl] +Size=22 +Context=International +Type=Threshold + +[22x22/mimetypes] +Size=22 +Context=MimeTypes +Type=Threshold + +[22x22/places] +Size=22 +Context=Places +Type=Threshold + +[22x22/status] +Size=22 +Context=Status +Type=Threshold + +[22x22/stock/chart] +Size=22 +Context=Stock +Type=Threshold + +[22x22/stock/code] +Size=22 +Context=Stock +Type=Threshold + +[22x22/stock/data] +Size=22 +Context=Stock +Type=Threshold + +[22x22/stock/form] +Size=22 +Context=Stock +Type=Threshold + +[22x22/stock/image] +Size=22 +Context=Stock +Type=Threshold + +[22x22/stock/io] +Size=22 +Context=Stock +Type=Threshold + +[22x22/stock/media] +Size=22 +Context=Stock +Type=Threshold + +[22x22/stock/navigation] +Size=22 +Context=Stock +Type=Threshold + +[22x22/stock/net] +Size=22 +Context=Stock +Type=Threshold + +[22x22/stock/object] +Size=22 +Context=Stock +Type=Threshold + +[22x22/stock/table] +Size=22 +Context=Stock +Type=Threshold + +[22x22/stock/text] +Size=22 +Context=Stock +Type=Threshold + +[24x24/actions] +Size=24 +Context=Actions +Type=Threshold + +[24x24/animations] +Size=24 +Context=Animations +Type=Threshold + +[24x24/apps] +Size=24 +Context=Applications +Type=Threshold + +[24x24/categories] +Size=24 +Context=Categories +Type=Threshold + +[24x24/devices] +Size=24 +Context=Devices +Type=Threshold + +[24x24/emblems] +Size=24 +Context=Emblems +Type=Threshold + +[24x24/emotes] +Size=24 +Context=Emotes +Type=Threshold + +[24x24/filesystems] +Size=24 +Context=FileSystems +Type=Threshold + +[24x24/intl] +Size=24 +Context=International +Type=Threshold + +[24x24/mimetypes] +Size=24 +Context=MimeTypes +Type=Threshold + +[24x24/places] +Size=24 +Context=Places +Type=Threshold + +[24x24/status] +Size=24 +Context=Status +Type=Threshold + +[24x24/stock/chart] +Size=24 +Context=Stock +Type=Threshold + +[24x24/stock/code] +Size=24 +Context=Stock +Type=Threshold + +[24x24/stock/data] +Size=24 +Context=Stock +Type=Threshold + +[24x24/stock/form] +Size=24 +Context=Stock +Type=Threshold + +[24x24/stock/image] +Size=24 +Context=Stock +Type=Threshold + +[24x24/stock/io] +Size=24 +Context=Stock +Type=Threshold + +[24x24/stock/media] +Size=24 +Context=Stock +Type=Threshold + +[24x24/stock/navigation] +Size=24 +Context=Stock +Type=Threshold + +[24x24/stock/net] +Size=24 +Context=Stock +Type=Threshold + +[24x24/stock/object] +Size=24 +Context=Stock +Type=Threshold + +[24x24/stock/table] +Size=24 +Context=Stock +Type=Threshold + +[24x24/stock/text] +Size=24 +Context=Stock +Type=Threshold + +[32x32/actions] +Size=32 +Context=Actions +Type=Threshold + +[32x32/animations] +Size=32 +Context=Animations +Type=Threshold + +[32x32/apps] +Size=32 +Context=Applications +Type=Threshold + +[32x32/categories] +Size=32 +Context=Categories +Type=Threshold + +[32x32/devices] +Size=32 +Context=Devices +Type=Threshold + +[32x32/emblems] +Size=32 +Context=Emblems +Type=Threshold + +[32x32/emotes] +Size=32 +Context=Emotes +Type=Threshold + +[32x32/filesystems] +Size=32 +Context=FileSystems +Type=Threshold + +[32x32/intl] +Size=32 +Context=International +Type=Threshold + +[32x32/mimetypes] +Size=32 +Context=MimeTypes +Type=Threshold + +[32x32/places] +Size=32 +Context=Places +Type=Threshold + +[32x32/status] +Size=32 +Context=Status +Type=Threshold + +[32x32/stock/chart] +Size=32 +Context=Stock +Type=Threshold + +[32x32/stock/code] +Size=32 +Context=Stock +Type=Threshold + +[32x32/stock/data] +Size=32 +Context=Stock +Type=Threshold + +[32x32/stock/form] +Size=32 +Context=Stock +Type=Threshold + +[32x32/stock/image] +Size=32 +Context=Stock +Type=Threshold + +[32x32/stock/io] +Size=32 +Context=Stock +Type=Threshold + +[32x32/stock/media] +Size=32 +Context=Stock +Type=Threshold + +[32x32/stock/navigation] +Size=32 +Context=Stock +Type=Threshold + +[32x32/stock/net] +Size=32 +Context=Stock +Type=Threshold + +[32x32/stock/object] +Size=32 +Context=Stock +Type=Threshold + +[32x32/stock/table] +Size=32 +Context=Stock +Type=Threshold + +[32x32/stock/text] +Size=32 +Context=Stock +Type=Threshold + +[36x36/actions] +Size=36 +Context=Actions +Type=Threshold + +[36x36/animations] +Size=36 +Context=Animations +Type=Threshold + +[36x36/apps] +Size=36 +Context=Applications +Type=Threshold + +[36x36/categories] +Size=36 +Context=Categories +Type=Threshold + +[36x36/devices] +Size=36 +Context=Devices +Type=Threshold + +[36x36/emblems] +Size=36 +Context=Emblems +Type=Threshold + +[36x36/emotes] +Size=36 +Context=Emotes +Type=Threshold + +[36x36/filesystems] +Size=36 +Context=FileSystems +Type=Threshold + +[36x36/intl] +Size=36 +Context=International +Type=Threshold + +[36x36/mimetypes] +Size=36 +Context=MimeTypes +Type=Threshold + +[36x36/places] +Size=36 +Context=Places +Type=Threshold + +[36x36/status] +Size=36 +Context=Status +Type=Threshold + +[36x36/stock/chart] +Size=36 +Context=Stock +Type=Threshold + +[36x36/stock/code] +Size=36 +Context=Stock +Type=Threshold + +[36x36/stock/data] +Size=36 +Context=Stock +Type=Threshold + +[36x36/stock/form] +Size=36 +Context=Stock +Type=Threshold + +[36x36/stock/image] +Size=36 +Context=Stock +Type=Threshold + +[36x36/stock/io] +Size=36 +Context=Stock +Type=Threshold + +[36x36/stock/media] +Size=36 +Context=Stock +Type=Threshold + +[36x36/stock/navigation] +Size=36 +Context=Stock +Type=Threshold + +[36x36/stock/net] +Size=36 +Context=Stock +Type=Threshold + +[36x36/stock/object] +Size=36 +Context=Stock +Type=Threshold + +[36x36/stock/table] +Size=36 +Context=Stock +Type=Threshold + +[36x36/stock/text] +Size=36 +Context=Stock +Type=Threshold + +[48x48/actions] +Size=48 +Context=Actions +Type=Threshold + +[48x48/animations] +Size=48 +Context=Animations +Type=Threshold + +[48x48/apps] +Size=48 +Context=Applications +Type=Threshold + +[48x48/categories] +Size=48 +Context=Categories +Type=Threshold + +[48x48/devices] +Size=48 +Context=Devices +Type=Threshold + +[48x48/emblems] +Size=48 +Context=Emblems +Type=Threshold + +[48x48/emotes] +Size=48 +Context=Emotes +Type=Threshold + +[48x48/filesystems] +Size=48 +Context=FileSystems +Type=Threshold + +[48x48/intl] +Size=48 +Context=International +Type=Threshold + +[48x48/mimetypes] +Size=48 +Context=MimeTypes +Type=Threshold + +[48x48/places] +Size=48 +Context=Places +Type=Threshold + +[48x48/status] +Size=48 +Context=Status +Type=Threshold + +[48x48/stock/chart] +Size=48 +Context=Stock +Type=Threshold + +[48x48/stock/code] +Size=48 +Context=Stock +Type=Threshold + +[48x48/stock/data] +Size=48 +Context=Stock +Type=Threshold + +[48x48/stock/form] +Size=48 +Context=Stock +Type=Threshold + +[48x48/stock/image] +Size=48 +Context=Stock +Type=Threshold + +[48x48/stock/io] +Size=48 +Context=Stock +Type=Threshold + +[48x48/stock/media] +Size=48 +Context=Stock +Type=Threshold + +[48x48/stock/navigation] +Size=48 +Context=Stock +Type=Threshold + +[48x48/stock/net] +Size=48 +Context=Stock +Type=Threshold + +[48x48/stock/object] +Size=48 +Context=Stock +Type=Threshold + +[48x48/stock/table] +Size=48 +Context=Stock +Type=Threshold + +[48x48/stock/text] +Size=48 +Context=Stock +Type=Threshold + +[64x64/actions] +Size=64 +Context=Actions +Type=Threshold + +[64x64/animations] +Size=64 +Context=Animations +Type=Threshold + +[64x64/apps] +Size=64 +Context=Applications +Type=Threshold + +[64x64/categories] +Size=64 +Context=Categories +Type=Threshold + +[64x64/devices] +Size=64 +Context=Devices +Type=Threshold + +[64x64/emblems] +Size=64 +Context=Emblems +Type=Threshold + +[64x64/emotes] +Size=64 +Context=Emotes +Type=Threshold + +[64x64/filesystems] +Size=64 +Context=FileSystems +Type=Threshold + +[64x64/intl] +Size=64 +Context=International +Type=Threshold + +[64x64/mimetypes] +Size=64 +Context=MimeTypes +Type=Threshold + +[64x64/places] +Size=64 +Context=Places +Type=Threshold + +[64x64/status] +Size=64 +Context=Status +Type=Threshold + +[64x64/stock/chart] +Size=64 +Context=Stock +Type=Threshold + +[64x64/stock/code] +Size=64 +Context=Stock +Type=Threshold + +[64x64/stock/data] +Size=64 +Context=Stock +Type=Threshold + +[64x64/stock/form] +Size=64 +Context=Stock +Type=Threshold + +[64x64/stock/image] +Size=64 +Context=Stock +Type=Threshold + +[64x64/stock/io] +Size=64 +Context=Stock +Type=Threshold + +[64x64/stock/media] +Size=64 +Context=Stock +Type=Threshold + +[64x64/stock/navigation] +Size=64 +Context=Stock +Type=Threshold + +[64x64/stock/net] +Size=64 +Context=Stock +Type=Threshold + +[64x64/stock/object] +Size=64 +Context=Stock +Type=Threshold + +[64x64/stock/table] +Size=64 +Context=Stock +Type=Threshold + +[64x64/stock/text] +Size=64 +Context=Stock +Type=Threshold +[72x72/actions] +Size=72 +Context=Actions +Type=Threshold + +[72x72/animations] +Size=72 +Context=Animations +Type=Threshold + +[72x72/apps] +Size=72 +Context=Applications +Type=Threshold + +[72x72/categories] +Size=72 +Context=Categories +Type=Threshold + +[72x72/devices] +Size=72 +Context=Devices +Type=Threshold + +[72x72/emblems] +Size=72 +Context=Emblems +Type=Threshold + +[72x72/emotes] +Size=72 +Context=Emotes +Type=Threshold + +[72x72/filesystems] +Size=72 +Context=FileSystems +Type=Threshold + +[72x72/intl] +Size=72 +Context=International +Type=Threshold + +[72x72/mimetypes] +Size=72 +Context=MimeTypes +Type=Threshold + +[72x72/places] +Size=72 +Context=Places +Type=Threshold + +[72x72/status] +Size=72 +Context=Status +Type=Threshold + +[72x72/stock/chart] +Size=72 +Context=Stock +Type=Threshold + +[72x72/stock/code] +Size=72 +Context=Stock +Type=Threshold + +[72x72/stock/data] +Size=72 +Context=Stock +Type=Threshold + +[72x72/stock/form] +Size=72 +Context=Stock +Type=Threshold + +[72x72/stock/image] +Size=72 +Context=Stock +Type=Threshold + +[72x72/stock/io] +Size=72 +Context=Stock +Type=Threshold + +[72x72/stock/media] +Size=72 +Context=Stock +Type=Threshold + +[72x72/stock/navigation] +Size=72 +Context=Stock +Type=Threshold + +[72x72/stock/net] +Size=72 +Context=Stock +Type=Threshold + +[72x72/stock/object] +Size=72 +Context=Stock +Type=Threshold + +[72x72/stock/table] +Size=72 +Context=Stock +Type=Threshold + +[72x72/stock/text] +Size=72 +Context=Stock +Type=Threshold + +[96x96/actions] +Size=96 +Context=Actions +Type=Threshold + +[96x96/animations] +Size=96 +Context=Animations +Type=Threshold + +[96x96/apps] +Size=96 +Context=Applications +Type=Threshold + +[96x96/categories] +Size=96 +Context=Categories +Type=Threshold + +[96x96/devices] +Size=96 +Context=Devices +Type=Threshold + +[96x96/emblems] +Size=96 +Context=Emblems +Type=Threshold + +[96x96/emotes] +Size=96 +Context=Emotes +Type=Threshold + +[96x96/filesystems] +Size=96 +Context=FileSystems +Type=Threshold + +[96x96/intl] +Size=96 +Context=International +Type=Threshold + +[96x96/mimetypes] +Size=96 +Context=MimeTypes +Type=Threshold + +[96x96/places] +Size=96 +Context=Places +Type=Threshold + +[96x96/status] +Size=96 +Context=Status +Type=Threshold + +[96x96/stock/chart] +Size=96 +Context=Stock +Type=Threshold + +[96x96/stock/code] +Size=96 +Context=Stock +Type=Threshold + +[96x96/stock/data] +Size=96 +Context=Stock +Type=Threshold + +[96x96/stock/form] +Size=96 +Context=Stock +Type=Threshold + +[96x96/stock/image] +Size=96 +Context=Stock +Type=Threshold + +[96x96/stock/io] +Size=96 +Context=Stock +Type=Threshold + +[96x96/stock/media] +Size=96 +Context=Stock +Type=Threshold + +[96x96/stock/navigation] +Size=96 +Context=Stock +Type=Threshold + +[96x96/stock/net] +Size=96 +Context=Stock +Type=Threshold + +[96x96/stock/object] +Size=96 +Context=Stock +Type=Threshold + +[96x96/stock/table] +Size=96 +Context=Stock +Type=Threshold + +[96x96/stock/text] +Size=96 +Context=Stock +Type=Threshold + +[128x128/actions] +Size=128 +Context=Actions +Type=Threshold + +[128x128/animations] +Size=128 +Context=Animations +Type=Threshold + +[128x128/apps] +Size=128 +Context=Applications +Type=Threshold + +[128x128/categories] +Size=128 +Context=Categories +Type=Threshold + +[128x128/devices] +Size=128 +Context=Devices +Type=Threshold + +[128x128/emblems] +Size=128 +Context=Emblems +Type=Threshold + +[128x128/emotes] +Size=128 +Context=Emotes +Type=Threshold + +[128x128/filesystems] +Size=128 +Context=FileSystems +Type=Threshold + +[128x128/intl] +Size=128 +Context=International +Type=Threshold + +[128x128/mimetypes] +Size=128 +Context=MimeTypes +Type=Threshold + +[128x128/places] +Size=128 +Context=Places +Type=Threshold + +[128x128/status] +Size=128 +Context=Status +Type=Threshold + +[128x128/stock/chart] +Size=128 +Context=Stock +Type=Threshold + +[128x128/stock/code] +Size=128 +Context=Stock +Type=Threshold + +[128x128/stock/data] +Size=128 +Context=Stock +Type=Threshold + +[128x128/stock/form] +Size=128 +Context=Stock +Type=Threshold + +[128x128/stock/image] +Size=128 +Context=Stock +Type=Threshold + +[128x128/stock/io] +Size=128 +Context=Stock +Type=Threshold + +[128x128/stock/media] +Size=128 +Context=Stock +Type=Threshold + +[128x128/stock/navigation] +Size=128 +Context=Stock +Type=Threshold + +[128x128/stock/net] +Size=128 +Context=Stock +Type=Threshold + +[128x128/stock/object] +Size=128 +Context=Stock +Type=Threshold + +[128x128/stock/table] +Size=128 +Context=Stock +Type=Threshold + +[128x128/stock/text] +Size=128 +Context=Stock +Type=Threshold + +[192x192/actions] +Size=192 +Context=Actions +Type=Threshold + +[192x192/animations] +Size=192 +Context=Animations +Type=Threshold + +[192x192/apps] +Size=192 +Context=Applications +Type=Threshold + +[192x192/categories] +Size=192 +Context=Categories +Type=Threshold + +[192x192/devices] +Size=192 +Context=Devices +Type=Threshold + +[192x192/emblems] +Size=192 +Context=Emblems +Type=Threshold + +[192x192/emotes] +Size=192 +Context=Emotes +Type=Threshold + +[192x192/filesystems] +Size=192 +Context=FileSystems +Type=Threshold + +[192x192/intl] +Size=192 +Context=International +Type=Threshold + +[192x192/mimetypes] +Size=192 +Context=MimeTypes +Type=Threshold + +[192x192/places] +Size=192 +Context=Places +Type=Threshold + +[192x192/status] +Size=192 +Context=Status +Type=Threshold + +[192x192/stock/chart] +Size=192 +Context=Stock +Type=Threshold + +[192x192/stock/code] +Size=192 +Context=Stock +Type=Threshold + +[192x192/stock/data] +Size=192 +Context=Stock +Type=Threshold + +[192x192/stock/form] +Size=192 +Context=Stock +Type=Threshold + +[192x192/stock/image] +Size=192 +Context=Stock +Type=Threshold + +[192x192/stock/io] +Size=192 +Context=Stock +Type=Threshold + +[192x192/stock/media] +Size=192 +Context=Stock +Type=Threshold + +[192x192/stock/navigation] +Size=192 +Context=Stock +Type=Threshold + +[192x192/stock/net] +Size=192 +Context=Stock +Type=Threshold + +[192x192/stock/object] +Size=192 +Context=Stock +Type=Threshold + +[192x192/stock/table] +Size=192 +Context=Stock +Type=Threshold + +[192x192/stock/text] +Size=192 +Context=Stock +Type=Threshold + +[256x256/actions] +MinSize=64 +Size=256 +MaxSize=256 +Context=Actions +Type=Scalable + +[256x256/animations] +MinSize=64 +Size=256 +MaxSize=256 +Context=Animations +Type=Scalable + +[256x256/apps] +MinSize=64 +Size=256 +MaxSize=256 +Context=Applications +Type=Scalable + +[256x256/categories] +MinSize=64 +Size=256 +MaxSize=256 +Context=Categories +Type=Scalable + +[256x256/devices] +MinSize=64 +Size=256 +MaxSize=256 +Context=Devices +Type=Scalable + +[256x256/emblems] +MinSize=64 +Size=256 +MaxSize=256 +Context=Emblems +Type=Scalable + +[256x256/emotes] +MinSize=64 +Size=256 +MaxSize=256 +Context=Emotes +Type=Scalable + +[256x256/filesystems] +MinSize=64 +Size=256 +MaxSize=256 +Context=FileSystems +Type=Scalable + +[256x256/intl] +MinSize=64 +Size=256 +MaxSize=256 +Context=International +Type=Scalable + +[256x256/mimetypes] +MinSize=64 +Size=256 +MaxSize=256 +Context=MimeTypes +Type=Scalable + +[256x256/places] +MinSize=64 +Size=256 +MaxSize=256 +Context=Places +Type=Scalable + +[256x256/status] +MinSize=64 +Size=256 +MaxSize=256 +Context=Status +Type=Scalable + +[256x256/stock/chart] +MinSize=64 +Size=256 +MaxSize=256 +Context=Stock +Type=Scalable + +[256x256/stock/code] +MinSize=64 +Size=256 +MaxSize=256 +Context=Stock +Type=Scalable + +[256x256/stock/data] +MinSize=64 +Size=256 +MaxSize=256 +Context=Stock +Type=Scalable + +[256x256/stock/form] +MinSize=64 +Size=256 +MaxSize=256 +Context=Stock +Type=Scalable + +[256x256/stock/image] +MinSize=64 +Size=256 +MaxSize=256 +Context=Stock +Type=Scalable + +[256x256/stock/io] +MinSize=64 +Size=256 +MaxSize=256 +Context=Stock +Type=Scalable + +[256x256/stock/media] +MinSize=64 +Size=256 +MaxSize=256 +Context=Stock +Type=Scalable + +[256x256/stock/navigation] +MinSize=64 +Size=256 +MaxSize=256 +Context=Stock +Type=Scalable + +[256x256/stock/net] +MinSize=64 +Size=256 +MaxSize=256 +Context=Stock +Type=Scalable + +[256x256/stock/object] +MinSize=64 +Size=256 +MaxSize=256 +Context=Stock +Type=Scalable + +[256x256/stock/table] +MinSize=64 +Size=256 +MaxSize=256 +Context=Stock +Type=Scalable + +[256x256/stock/text] +MinSize=64 +Size=256 +MaxSize=256 +Context=Stock +Type=Scalable + +[scalable/actions] +MinSize=1 +Size=128 +MaxSize=256 +Context=Actions +Type=Scalable + +[scalable/animations] +MinSize=1 +Size=128 +MaxSize=256 +Context=Animations +Type=Scalable + +[scalable/apps] +MinSize=1 +Size=128 +MaxSize=256 +Context=Applications +Type=Scalable + +[scalable/categories] +MinSize=1 +Size=128 +MaxSize=256 +Context=Categories +Type=Scalable + +[scalable/devices] +MinSize=1 +Size=128 +MaxSize=256 +Context=Devices +Type=Scalable + +[scalable/emblems] +MinSize=1 +Size=128 +MaxSize=256 +Context=Emblems +Type=Scalable + +[scalable/emotes] +MinSize=1 +Size=128 +MaxSize=256 +Context=Emotes +Type=Scalable + +[scalable/filesystems] +MinSize=1 +Size=128 +MaxSize=256 +Context=FileSystems +Type=Scalable + +[scalable/intl] +MinSize=1 +Size=128 +MaxSize=256 +Context=International +Type=Scalable + +[scalable/mimetypes] +MinSize=1 +Size=128 +MaxSize=256 +Context=MimeTypes +Type=Scalable + +[scalable/places] +MinSize=1 +Size=128 +MaxSize=256 +Context=Places +Type=Scalable + +[scalable/status] +MinSize=1 +Size=128 +MaxSize=256 +Context=Status +Type=Scalable + +[scalable/stock/chart] +MinSize=1 +Size=128 +MaxSize=256 +Context=Stock +Type=Scalable + +[scalable/stock/code] +MinSize=1 +Size=128 +MaxSize=256 +Context=Stock +Type=Scalable + +[scalable/stock/data] +MinSize=1 +Size=128 +MaxSize=256 +Context=Stock +Type=Scalable + +[scalable/stock/form] +MinSize=1 +Size=128 +MaxSize=256 +Context=Stock +Type=Scalable + +[scalable/stock/image] +MinSize=1 +Size=128 +MaxSize=256 +Context=Stock +Type=Scalable + +[scalable/stock/io] +MinSize=1 +Size=128 +MaxSize=256 +Context=Stock +Type=Scalable + +[scalable/stock/media] +MinSize=1 +Size=128 +MaxSize=256 +Context=Stock +Type=Scalable + +[scalable/stock/navigation] +MinSize=1 +Size=128 +MaxSize=256 +Context=Stock +Type=Scalable + +[scalable/stock/net] +MinSize=1 +Size=128 +MaxSize=256 +Context=Stock +Type=Scalable + +[scalable/stock/object] +MinSize=1 +Size=128 +MaxSize=256 +Context=Stock +Type=Scalable + +[scalable/stock/table] +MinSize=1 +Size=128 +MaxSize=256 +Context=Stock +Type=Scalable + +[scalable/stock/text] +MinSize=1 +Size=128 +MaxSize=256 +Context=Stock +Type=Scalable + diff --git a/core/modules/vmware12/module.build b/core/modules/vmware12/module.build new file mode 100644 index 00000000..2160e5f7 --- /dev/null +++ b/core/modules/vmware12/module.build @@ -0,0 +1,225 @@ +#!/bin/bash +fetch_source() { + [ -d "${MODULE_WORK_DIR}/src" ] && \ + { rm -r "${MODULE_WORK_DIR}/src" || perror "Could not delete old src dir."; } + mkdir -p "${MODULE_WORK_DIR}/src" || perror "Could not mkdir src" + cd "${MODULE_WORK_DIR}/src" || perror "cd to '${MODULE_WORK_DIR}/src' failed." + + local BASE_URL LIST_URL BUILD_NO + #BASE_URL="http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.5.2/4638234/linux/core/" + BASE_URL="http://softwareupdate.vmware.com/cds/vmw-desktop/" + if [ "$REQUIRED_TYPE" = "workstation" ]; then + BASE_URL+="ws/" + else + BASE_URL+="${REQUIRED_TYPE}/" + fi + BASE_URL+="${REQUIRED_VERSION}/" + # Get directory listing of version to get build number + wget -O "index.html" "$BASE_URL" || perror "Could not download vmware version index from $BASE_URL" + BUILD_NO=$(grep -E -o -i -m 1 'href="[0-9]+/"' "index.html" | awk -F '"' '{print $2}') + [ -z "$BUILD_NO" ] && perror "Could not determine build number of $REQUIRED_VERSION from $MODULE_WORK_DIR/src/index.html" + LIST_URL="${BASE_URL}${BUILD_NO}linux/core/" # BUILD_NO already has trailing slash... + + # Get directory listing of where final archive resides + wget -O "index.html" "$LIST_URL" || perror "Could not download vmware build type core dir index" + VMWARE_BUNDLE_FILE=$(grep -E -o -i -m 1 "href=\"VMware-$REQUIRED_TYPE-[^\"]+[\._\-]$ARCHREGEX[\._\-][^\"]+\"" "index.html" | awk -F '"' '{printf $2}') + [ -z "$VMWARE_BUNDLE_FILE" ] && perror "Could not determine vmware $REQUIRED_TYPE bundle file for current arch from $MODULE_WORK_DIR/src/index.html" + + # Download file + wget -O "$VMWARE_BUNDLE_FILE" "${LIST_URL}${VMWARE_BUNDLE_FILE}" || perror "Could not download ${VMWARE_BUNDLE_FILE} from ${LIST_URL}" + if [[ "$VMWARE_BUNDLE_FILE" == *.tar ]]; then + tar -x "${VMWARE_BUNDLE_FILE%.tar}" -f "$VMWARE_BUNDLE_FILE" || perror "Could not untar downloaded $VMWARE_BUNDLE_FILE" + unlink "$VMWARE_BUNDLE_FILE" + VMWARE_BUNDLE_FILE="${VMWARE_BUNDLE_FILE%.tar}" + fi + + cd - >/dev/null +} + +build() { + local KMOD SHORT PATCH MIN_KERN MAX_KERN + [ -z "$VMWARE_BUNDLE_FILE" ] && VMWARE_BUNDLE_FILE=$(basename "$(find "${MODULE_WORK_DIR}/src" -iname "vmware-*" | head -n 1)") + local DELETE_FILES=$(for LINE in $REQUIRED_VMWARE_DELETIONS;do echo "rm -rf -- $LINE"; done) + + local OFFICIAL_VERSION=$(echo "$VMWARE_BUNDLE_FILE" | cut -f 3 -d '-') + local BUILD_VERSION=$(echo "$VMWARE_BUNDLE_FILE" | cut -f 4 -d '-') + BUILD_VERSION=${BUILD_VERSION%%.*} + [ -z "$OFFICIAL_VERSION" ] && perror "Could not determine vmware version from downloaded file (expected eg. 12.0.0)" + if [ -z "$BUILD_VERSION" ] || [ "$BUILD_VERSION" -lt 10000 ]; then + perror "Could not determine vmware build number from downloaded file" + fi + + # prepare the build directory with the files needed during the chroot + cp "${MODULE_WORK_DIR}/src/$VMWARE_BUNDLE_FILE" "${MODULE_BUILD_DIR}/$VMWARE_BUNDLE_FILE" + # copy required patches + mkdir -p "${MODULE_BUILD_DIR}/patches" + for PATCH in $(find "${MODULE_DIR}/patches/" -name "*__*__*.patch"); do + parse_patch_name "$PATCH" + [ -z "${MIN_KERN}" -o -z "${MAX_KERN}" ] && perror "Could not parse patch filename" + if version_lt "$TARGET_KERNEL_SHORT" "$MIN_KERN" || version_gt "$TARGET_KERNEL_SHORT" "$MAX_KERN"; then + pinfo "*NOT* applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$TARGET_KERNEL_SHORT)" + continue # Not suitable for our kernel + fi + if version_lt "$OFFICIAL_VERSION" "$MIN_VMWARE" || version_gt "$OFFICIAL_VERSION" "$MAX_VMWARE"; then + pinfo "*NOT* applying $PATCH (min=$MIN_VMWARE max=$MAX_VMWARE cmp=$OFFICIAL_VERSION)" + continue # Not suitable for our kernel + fi + pinfo "Kernel: Applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$TARGET_KERNEL_SHORT)" + pinfo "VMware: Applying $PATCH (min=$MIN_VMWARE max=$MAX_VMWARE cmp=$OFFICIAL_VERSION)" + cp "$PATCH" "${MODULE_BUILD_DIR}/patches/" || perror "Could not copy patch $PATCH to $MODULE_BUILD_DIR/patches" + done + + # sanity check to see if KERNEL_HEADERS_DIR is set and exists + [ -z "${KERNEL_HEADERS_DIR}" -o ! -e "${KERNEL_HEADERS_DIR}" ] && perror "KERNEL_HEADERS_DIR ('"${KERNEL_HEADERS_DIR}"') not found. Was the kernel module built?" + + # build in two steps, to be able to use mltk function while patching modules + pinfo "Installing vmware per chroot..." + mkdir -p "${MODULE_BUILD_DIR}/bin" + cat > "${MODULE_BUILD_DIR}/bin/gccw" <<-EOF + #!/bin/sh + if [ "x\$1" = "x--version" ]; then + cat <<-FOO + gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 + Copyright (C) 2013 Free Software Foundation, Inc. + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + FOO + elif [ "x\$1" = "x-v" ]; then + cat >&2 <<-FOO + Using built-in specs. + COLLECT_GCC=gcc + COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.3.0-12ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu + Thread model: posix + gcc version 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2) + FOO + elif [ "x\$1" = "x-dumpversion" ]; then + echo "4.8" + else + echo "\$@" > "/tmp/gcc-args.\$\$" + exec gcc "\$@" + fi + exit 0 + EOF + chmod +x "${MODULE_BUILD_DIR}/bin/gccw" + chroot_run "${MODULE_BUILD_DIR}" <<-EOF + perror() { + echo "[ERROR ERROR] " "\$@" >&6 + exit 1 + } + # PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot + $DELETE_FILES + yes | sh /"${VMWARE_BUNDLE_FILE}" --eulas-agreed --console --required + set -x + # Patch kernel modules + # check if we need to patch modules + cd "/usr/lib/vmware/modules/source" \ + || perror "Could not cd to '/usr/lib/vmware/modules/source'" + for file in /patches/*.patch; do + [ -s "\$file" ] || continue + echo "Applying patch \$file" + SHORT="\$(basename "\${file%%__*}")" + KMOD="\${SHORT}.tar" + [ -s "\$KMOD" ] || perror "Kmod \$KMOD does not exist" + [ ! -d "\${SHORT}-only" ] && tar xf "\$KMOD" + [ ! -d "\${SHORT}-only" ] && perror "untar of \$KMOD failed." + cd "\${SHORT}-only" || perror "Where is \${SHORT}-only?" + if ! patch -p1 < "\$file"; then + cd .. + rm -rf -- "\${SHORT}-only" + perror "Applying \$file failed." + fi + cd .. + if [ -d "\${SHORT}-only" ]; then + tar cf "\$KMOD" "\${SHORT}-only/" || perror "repacking of \$KMOD failed." + rm -rf -- "\${SHORT}-only" + fi + done + export LD_LIBRARY_PATH=/usr/lib/vmware/lib/libglibmm-2.4.so.1/:/usr/lib/x86_64-linux-gnu/gtk-2.0/modules/:\$LD_LIBRARY_PATH + vmware-modconfig --console --build-mod -k "${TARGET_KERNEL_LONG}" vmnet /bin/gccw "${KERNEL_HEADERS_DIR}/include" vmplayer vmnet || perror "vmnet build failed" + vmware-modconfig --console --build-mod -k "${TARGET_KERNEL_LONG}" vmmon /bin/gccw "${KERNEL_HEADERS_DIR}/include" vmplayer vmmon || perror "vmmon build failed" + EOF + + # cleanup unneeded files + rm -rf -- "${MODULE_BUILD_DIR}/etc/vmware-installer" + rm -rf -- "${MODULE_BUILD_DIR}/usr/lib/vmware-installer" + rm -rf -- "${MODULE_BUILD_DIR}/usr/lib/vmware-ovftool" + unlink "${MODULE_BUILD_DIR}/$VMWARE_BUNDLE_FILE" + + # write vmware.conf config file to be later sourced by vmware/run-virt.include. + mkdir -p "${MODULE_BUILD_DIR}/opt/openslx/vmchooser/plugins/vmware/" || perror "Could not mkdir "${MODULE_BUILD_DIR}/opt/openslx/vmchooser/plugins/vmware/"." + + cat > "${MODULE_BUILD_DIR}/opt/openslx/vmchooser/plugins/vmware/vmware.conf" <<-EOF + # configuration file written by vmware/module.build + vmnet0=true + vmnet1=192.168.101.1/24 + vmnet1nat=true + vmnet8=192.168.102.1/24 + vmware_version=$OFFICIAL_VERSION + vmware_build=${BUILD_VERSION} + maxhardwareversion=${OFFICIAL_VERSION%%.*} + EOF + + # Patch system-wide vmware config + sed -i '/^installerDefaults.autoSoftwareUpdateEnabled/d;/^installerDefaults.componentDownloadEnabled/d;/^installerDefaults.dataCollectionEnabled/d' "${MODULE_BUILD_DIR}/etc/vmware/config" + cat >> "${MODULE_BUILD_DIR}/etc/vmware/config" <<-HEREDOC + installerDefaults.autoSoftwareUpdateEnabled = "no" + installerDefaults.componentDownloadEnabled = "no" + installerDefaults.dataCollectionEnabled = "no" + HEREDOC + + # HACK: vmplayer 12.5.8 libfontconfig needs libexpat.so.0 but vmware ships with libexpat.so.1 + # To fix crashes, rename the shipped .1 lib to the expected .0 lib... + local SHIPPED_LIBEXPAT="libexpat.so.1" + if [ -f "${MODULE_BUILD_DIR}/usr/lib/vmware/lib/${SHIPPED_LIBEXPAT}/${SHIPPED_LIBEXPAT}" ]; then + mv "${MODULE_BUILD_DIR}/usr/lib/vmware/lib/${SHIPPED_LIBEXPAT}/${SHIPPED_LIBEXPAT}" \ + "${MODULE_BUILD_DIR}/usr/lib/vmware/lib/${SHIPPED_LIBEXPAT}/${SHIPPED_LIBEXPAT%?}0" || \ + perror "Failed to rename vmware's lib 'libexpat.so.1'." + mv "${MODULE_BUILD_DIR}/usr/lib/vmware/lib/${SHIPPED_LIBEXPAT}" \ + "${MODULE_BUILD_DIR}/usr/lib/vmware/lib/${SHIPPED_LIBEXPAT%?}0" || \ + perror "Failed to rename vmware's dir 'libexpat.so.1'." + elif [ -f "${MODULE_BUILD_DIR}/usr/lib/vmware/lib/${SHIPPED_LIBEXPAT%?}0/${SHIPPED_LIBEXPAT%?}0" ]; then + pnfo "Found '${MODULE_BUILD_DIR}/usr/lib/vmware/lib/${SHIPPED_LIBEXPAT%?}0/${SHIPPED_LIBEXPAT%?}0'" + else + pwarning "Could not find '${MODULE_BUILD_DIR}/usr/lib/vmware/lib/${SHIPPED_LIBEXPAT}'" + fi +} + +post_copy() { + # FIXME: gconftool is copied without dependencies + 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-usbarbitrator bug + date +'%Y.%m.%d' >"${TARGET_BUILD_DIR}/etc/arch-release" + + mkdir -p "$TARGET_BUILD_DIR/lib/modules/vmware/" + cp "${MODULE_BUILD_DIR}/lib/modules/$TARGET_KERNEL_LONG/vmplayer/"* "$TARGET_BUILD_DIR/lib/modules/vmware/" || perror "Could not cp vmware modules to target!" + +} + +parse_patch_name() { + [ $# -ne 1 ] && perror "parse_patch_name: Wrong parameter count." + local PATCH="$1" + # Module + SHORT=$(echo "$PATCH" | sed -r 's/^([^_]+)__.*$/\1/g') + KMOD="${SHORT}.tar" + # Kernel restriction + MIN_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)-[0-9\.]+__[^_]+\.patch$/\1/g') + [[ "$MIN_KERN" == /* ]] && MIN_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)__[^_]+\.patch$/\1/g') + MAX_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__[0-9\.]+-([0-9\.]+)__[^_]+\.patch$/\1/g') + [[ "$MAX_KERN" == /* ]] && MAX_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)__[^_]+\.patch$/\1/g') + [[ "$MIN_KERN" == /* ]] && MIN_KERN= + [[ "$MAX_KERN" == /* ]] && MAX_KERN= + # vmware restriction + MIN_VMWARE=$(echo "$PATCH" | sed -r 's/^[^_]+__[^_]+__([0-9\.]+)-[^_]+\.patch$/\1/g') + [[ "$MIN_VMWARE" == /* ]] && MIN_VMWARE=$(echo "$PATCH" | sed -r 's/^[^_]+__[^_]+__([0-9\.]+)\.patch$/\1/g') + MAX_VMWARE=$(echo "$PATCH" | sed -r 's/^[^_]+__[^_]+__[^_]+-([0-9\.]+)\.patch$/\1/g') + [[ "$MAX_VMWARE" == /* ]] && MAX_VMWARE=$(echo "$PATCH" | sed -r 's/^[^_]+__[^_]+__([0-9\.]+)\.patch$/\1/g') + [[ "$MIN_VMWARE" == /* ]] && MIN_VMWARE= + [[ "$MAX_VMWARE" == /* ]] && MAX_VMWARE= +} + diff --git a/core/modules/vmware12/module.conf b/core/modules/vmware12/module.conf new file mode 100644 index 00000000..b11b8884 --- /dev/null +++ b/core/modules/vmware12/module.conf @@ -0,0 +1,70 @@ +#!/bin/bash +REQUIRED_VERSION="12.5.9" +REQUIRED_TYPE="workstation" +REQUIRED_MODULES="kernel" +REQUIRED_DIRECTORIES=" + /etc/vmware + /usr/sbin + /usr/lib/vmware/bin + /usr/lib/vmware/hostd + /usr/lib/vmware/icu + /usr/lib/vmware/lib + /usr/lib/vmware/libconf + /usr/lib/vmware/licenses + /usr/lib/vmware/resources + /usr/lib/vmware/scripts + /usr/lib/vmware/share + /usr/lib/vmware/xkeymap +" +REQUIRED_FILES=" + /usr/lib/vmware/config + /usr/bin/vmware-usbarbitrator + /opt/openslx/vmchooser/plugins/vmware/vmware.conf +" +REQUIRED_BINARIES=" + vmnet-netifup +" + +REQUIRED_VMWARE_DELETIONS=" + /var/lib/vmware + /etc/vmw* + /etc/rc?.d/???vmware* + /etc/rc0.d/K06vmware-workstation-server + /etc/pam.d/vmware-authd + /etc/rc3.d/S25vmamqpd + /etc/xdg/menus/applications-merged + /etc/init.d/vmamqpd + /etc/init.d/vmware* + /etc/thnuclnt + /etc/cups/thnuclnt.convs + /etc/cups/thnuclnt.types + /etc/modprobe.d/vmware-fuse.conf + /lib/modules/*-generic/misc/vmnet.ko + /lib/modules/*-generic/misc/vmmon.ko + /usr/share/mime/packages/vmware-player.xml + /usr/share/applications/vmware* + /usr/share/desktop-directories/vmware-ace-vms.directory + /usr/share/man/man1/vmware.1.gz + /usr/share/doc/vmware* + /usr/share/icons/hicolor/*/mimetypes/application-certificate.png + /usr/share/icons/hicolor/*/apps/vmware* + /usr/share/icons/hicolor/*/mimetypes/*vmware* + /usr/bin/vmnet-dhcpd + /usr/bin/ovftool + /usr/bin/vmrun + /usr/bin/vmware-wssc-adminTool + /usr/bin/vmnet-bridge + /usr/bin/vmplayer + /usr/bin/vmnet-sniffer + /usr/bin/vmss2core + /usr/bin/vm-support + /usr/bin/vmnet-natd + /usr/bin/vmnet-netifup + /usr/bin/vmware* + /usr/include/vmware-vix + /usr/lib/libvixAllProducts.so + /usr/lib/cups/filter/thnucups + /usr/lib/diskLibWrapper.so + /usr/lib/vmware* + /usr/sbin/vmware* +" diff --git a/core/modules/vmware12/module.conf.ubuntu b/core/modules/vmware12/module.conf.ubuntu new file mode 100644 index 00000000..09b01ee9 --- /dev/null +++ b/core/modules/vmware12/module.conf.ubuntu @@ -0,0 +1,137 @@ +#!/bin/bash +REQUIRED_VMWARE_DELETIONS=" + /var/lib/vmware + /etc/vmware-vix + /etc/rc0.d/K08vmware + /etc/rc0.d/K06vmware-workstation-server + /etc/rc0.d/K06vmamqpd + /etc/pam.d/vmware-authd + /etc/rc3.d/S19vmware + /etc/rc3.d/S55vmware-workstation-server + /etc/rc3.d/S25vmamqpd + /etc/rc3.d/K08vmware-USBArbitrator + /etc/rc3.d/S50vmware-USBArbitrator + /etc/rc5.d/K08vmware-USBArbitrator + /etc/rc5.d/S50vmware-USBArbitrator + /etc/rc2.d/S19vmware + /etc/rc2.d/S55vmware-workstation-server + /etc/rc2.d/S25vmamqpd + /etc/rc2.d/K08vmware-USBArbitrator + /etc/rc2.d/S50vmware-USBArbitrator + /etc/xdg/menus/applications-merged + /etc/rc6.d/K08vmware + /etc/rc6.d/K06vmware-workstation-server + /etc/rc6.d/K06vmamqpd + /etc/rc4.d/S19vmware + /etc/rc4.d/S55vmware-workstation-server + /etc/rc4.d/S25vmamqpd + /etc/init.d/vmamqpd + /etc/init.d/vmware-USBArbitrator + /etc/init.d/vmware-workstation-server + /etc/init.d/vmware + /etc/thnuclnt + /etc/vmware-installer + /etc/cups/thnuclnt.convs + /etc/cups/thnuclnt.types + /etc/vmware/netmap.conf + /etc/vmware/icu + /etc/vmware/hostd + /etc/vmware/installer.sh + /etc/vmware/bootstrap + /etc/vmware/ssl + /etc/vmware/config + /etc/vmware/locations + /etc/modprobe.d/vmware-fuse.conf + /lib/modules/3.11.0-13-generic/misc/vmnet.ko + /lib/modules/3.11.0-13-generic/misc/vmmon.ko + /usr/share/mime/packages/vmware-player.xml + /usr/share/applications/vmware-workstation.desktop + /usr/share/applications/vmware-player.desktop + /usr/share/applications/vmware-netcfg.desktop + /usr/share/desktop-directories/vmware-ace-vms.directory + /usr/share/man/man1/vmware.1.gz + /usr/share/doc/vmware-vix + /usr/share/doc/vmware-workstation + /usr/share/doc/vmware-player + /usr/share/icons/hicolor/32x32/mimetypes/application-certificate.png + /usr/share/icons/hicolor/32x32/mimetypes/application-x-vmware-easter-egg.png + /usr/share/icons/hicolor/32x32/mimetypes/application-x-vmware-team.png + /usr/share/icons/hicolor/32x32/mimetypes/application-x-vmware-vm-legacy.png + /usr/share/icons/hicolor/32x32/mimetypes/application-x-vmware-vm-clone.png + /usr/share/icons/hicolor/32x32/mimetypes/application-x-vmware-vm.png + /usr/share/icons/hicolor/32x32/apps/vmware-player.png + /usr/share/icons/hicolor/32x32/apps/vmware-workstation.png + /usr/share/icons/hicolor/48x48/mimetypes/application-x-vmware-vmfoundry.png + /usr/share/icons/hicolor/48x48/mimetypes/application-x-vmware-vmdisk.png + /usr/share/icons/hicolor/48x48/mimetypes/application-x-vmware-easter-egg.png + /usr/share/icons/hicolor/48x48/mimetypes/application-x-vmware-team.png + /usr/share/icons/hicolor/48x48/mimetypes/application-x-vmware-vm-legacy.png + /usr/share/icons/hicolor/48x48/mimetypes/application-x-vmware-vm-clone.png + /usr/share/icons/hicolor/48x48/mimetypes/application-x-vmware-snapshot.png + /usr/share/icons/hicolor/48x48/mimetypes/application-x-vmware-vm.png + /usr/share/icons/hicolor/48x48/apps/vmware-player.png + /usr/share/icons/hicolor/48x48/apps/vmware-workstation.png + /usr/share/icons/hicolor/scalable/mimetypes/application-x-vmware-easter-egg.svg + /usr/share/icons/hicolor/scalable/mimetypes/application-x-vmware-team.svg + /usr/share/icons/hicolor/scalable/mimetypes/application-x-vmware-vm-clone.svg + /usr/share/icons/hicolor/scalable/mimetypes/application-x-vmware-snapshot.svg + /usr/share/icons/hicolor/scalable/mimetypes/application-x-vmware-vm-legacy.svg + /usr/share/icons/hicolor/scalable/mimetypes/application-x-vmware-vmfoundry.svg + /usr/share/icons/hicolor/scalable/mimetypes/application-certificate.svg + /usr/share/icons/hicolor/scalable/mimetypes/application-x-vmware-vm.svg + /usr/share/icons/hicolor/scalable/apps/vmware-workstation.svg + /usr/share/icons/hicolor/16x16/mimetypes/application-certificate.png + /usr/share/icons/hicolor/16x16/mimetypes/application-x-vmware-easter-egg.png + /usr/share/icons/hicolor/16x16/mimetypes/application-x-vmware-team.png + /usr/share/icons/hicolor/16x16/mimetypes/application-x-vmware-vm-legacy.png + /usr/share/icons/hicolor/16x16/mimetypes/application-x-vmware-vm-clone.png + /usr/share/icons/hicolor/16x16/mimetypes/application-x-vmware-vm.png + /usr/share/icons/hicolor/16x16/apps/vmware-player.png + /usr/share/icons/hicolor/16x16/apps/vmware-netcfg.png + /usr/share/icons/hicolor/16x16/apps/vmware-workstation.png + /usr/share/icons/hicolor/24x24/mimetypes + /usr/share/icons/hicolor/24x24/apps/vmware-player.png + /usr/share/icons/hicolor/24x24/apps/vmware-netcfg.png + /usr/share/icons/hicolor/24x24/apps/vmware-workstation.png + /usr/bin/vmnet-dhcpd + /usr/bin/vmware-unity-helper + /usr/bin/ovftool + /usr/bin/vmrun + /usr/bin/vmware-vim-cmd + /usr/bin/vmware-wssc-adminTool + /usr/bin/vmnet-bridge + /usr/bin/vmplayer + /usr/bin/vmnet-sniffer + /usr/bin/vmss2core + /usr/bin/vmware-usbarbitrator + /usr/bin/vmware-netcfg + /usr/bin/vmware-modconfig + /usr/bin/vmware-tray + /usr/bin/vmware-mount + /usr/bin/vm-support + /usr/bin/vmware-vdiskmanager + /usr/bin/vmware-license-enter.sh + /usr/bin/vmware-license-check.sh + /usr/bin/vmnet-natd + /usr/bin/vmware-uninstall + /usr/bin/vmware-vprobe + /usr/bin/vmware-fuseUI + /usr/bin/vmware-installer + /usr/bin/vmware-ping + /usr/bin/vmware-gksu + /usr/bin/vmnet-netifup + /usr/bin/vmware-networks + /usr/bin/vmware + /usr/bin/vmware-hostd + /usr/include/vmware-vix + /usr/lib/vmware-vix + /usr/lib/vmware-ovftool + /usr/lib/vmware-installer + /usr/lib/libvixAllProducts.so + /usr/lib/cups/filter/thnucups + /usr/lib/diskLibWrapper.so + /usr/lib/vmware + /usr/local/share/applications + /usr/sbin/vmware-authdlauncher + /usr/sbin/vmware-authd +" diff --git a/core/modules/vmware12/patches/vmblock__3.0-3.9__1.0-100.0.patch b/core/modules/vmware12/patches/vmblock__3.0-3.9__1.0-100.0.patch new file mode 100644 index 00000000..89b3a7c6 --- /dev/null +++ b/core/modules/vmware12/patches/vmblock__3.0-3.9__1.0-100.0.patch @@ -0,0 +1,11 @@ +--- a/linux/control.c 2013-10-18 19:56:11.000000000 +0200 ++++ b/linux/control.c 2014-02-14 15:54:59.895201379 +0100 +@@ -293,7 +293,7 @@ + + retval = i < 0 ? -EINVAL : blockOp(name, blocker); + +- putname(name); ++ __putname(name); + + return retval; + } diff --git a/core/modules/vmware12/patches/vmblock__3.10__1.0-100.0.patch b/core/modules/vmware12/patches/vmblock__3.10__1.0-100.0.patch new file mode 100644 index 00000000..e54317f9 --- /dev/null +++ b/core/modules/vmware12/patches/vmblock__3.10__1.0-100.0.patch @@ -0,0 +1,34 @@ +--- a/linux/control.c 2013-10-18 19:56:11.000000000 +0200 ++++ b/linux/control.c 2014-02-14 16:20:18.667236035 +0100 +@@ -208,17 +208,18 @@ + VMBlockSetProcEntryOwner(controlProcMountpoint); + + /* Create /proc/fs/vmblock/dev */ +- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME, ++ /* controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME, + VMBLOCK_CONTROL_MODE, +- controlProcDirEntry); +- if (!controlProcEntry) { ++ controlProcDirEntry);*/ ++ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME, VMBLOCK_CONTROL_MODE, controlProcDirEntry, &ControlFileOps); ++ if (controlProcEntry == NULL) { + Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n"); + remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry); + remove_proc_entry(VMBLOCK_CONTROL_PROC_DIRNAME, NULL); + return -EINVAL; + } + +- controlProcEntry->proc_fops = &ControlFileOps; ++ /*controlProcEntry->proc_fops = &ControlFileOps;*/ + return 0; + } + +@@ -293,7 +294,7 @@ + + retval = i < 0 ? -EINVAL : blockOp(name, blocker); + +- putname(name); ++ __putname(name); + + return retval; + } diff --git a/core/modules/vmware12/patches/vmblock__3.11-9.9__1.0-11.0.patch b/core/modules/vmware12/patches/vmblock__3.11-9.9__1.0-11.0.patch new file mode 100644 index 00000000..dedb2646 --- /dev/null +++ b/core/modules/vmware12/patches/vmblock__3.11-9.9__1.0-11.0.patch @@ -0,0 +1,123 @@ +--- a/linux/control.c 2013-10-18 19:56:11.000000000 +0200 ++++ b/linux/control.c 2014-02-14 16:20:18.667236035 +0100 +@@ -208,17 +208,18 @@ + VMBlockSetProcEntryOwner(controlProcMountpoint); + + /* Create /proc/fs/vmblock/dev */ +- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME, ++ /* controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME, + VMBLOCK_CONTROL_MODE, +- controlProcDirEntry); +- if (!controlProcEntry) { ++ controlProcDirEntry);*/ ++ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME, VMBLOCK_CONTROL_MODE, controlProcDirEntry, &ControlFileOps); ++ if (controlProcEntry == NULL) { + Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n"); + remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry); + remove_proc_entry(VMBLOCK_CONTROL_PROC_DIRNAME, NULL); + return -EINVAL; + } + +- controlProcEntry->proc_fops = &ControlFileOps; ++ /*controlProcEntry->proc_fops = &ControlFileOps;*/ + return 0; + } + +@@ -293,7 +294,7 @@ + + retval = i < 0 ? -EINVAL : blockOp(name, blocker); + +- putname(name); ++ __putname(name); + + return retval; + } +--- a/linux/file.c 2013-10-18 19:56:11.000000000 +0200 ++++ b/linux/file.c 2014-02-14 16:20:21.455236098 +0100 +@@ -38,46 +38,6 @@ + typedef ino_t inode_num_t; + #endif + +-/* Specifically for our filldir_t callback */ +-typedef struct FilldirInfo { +- filldir_t filldir; +- void *dirent; +-} FilldirInfo; +- +- +-/* +- *---------------------------------------------------------------------------- +- * +- * Filldir -- +- * +- * Callback function for readdir that we use in place of the one provided. +- * This allows us to specify that each dentry is a symlink, but pass through +- * everything else to the original filldir function. +- * +- * Results: +- * Original filldir's return value. +- * +- * Side effects: +- * Directory information gets copied to user's buffer. +- * +- *---------------------------------------------------------------------------- +- */ +- +-static int +-Filldir(void *buf, // IN: Dirent buffer passed from FileOpReaddir +- const char *name, // IN: Dirent name +- int namelen, // IN: len of dirent's name +- loff_t offset, // IN: Offset +- inode_num_t ino, // IN: Inode number of dirent +- unsigned int d_type) // IN: Type of file +-{ +- FilldirInfo *info = buf; +- +- /* Specify DT_LNK regardless */ +- return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK); +-} +- +- + /* File operations */ + + /* +@@ -166,11 +126,10 @@ + + static int + FileOpReaddir(struct file *file, // IN +- void *dirent, // IN +- filldir_t filldir) // IN ++ struct dir_context *ctx) // IN + { + int ret; +- FilldirInfo info; ++ + struct file *actualFile; + + if (!file) { +@@ -184,12 +143,10 @@ + return -EINVAL; + } + +- info.filldir = filldir; +- info.dirent = dirent; +- +- actualFile->f_pos = file->f_pos; +- ret = vfs_readdir(actualFile, Filldir, &info); +- file->f_pos = actualFile->f_pos; ++ /* Ricky Wong Yung Fei: ++ * Manipulation of pos is now handled internally by iterate_dir(). ++ */ ++ ret = iterate_dir(actualFile, ctx); + + return ret; + } +@@ -237,7 +194,7 @@ + + + struct file_operations RootFileOps = { +- .readdir = FileOpReaddir, ++ .iterate = FileOpReaddir, + .open = FileOpOpen, + .release = FileOpRelease, + }; diff --git a/core/modules/vmware12/patches/vmci__4.3-4.3__12.0.0.patch b/core/modules/vmware12/patches/vmci__4.3-4.3__12.0.0.patch new file mode 100644 index 00000000..05dae1b7 --- /dev/null +++ b/core/modules/vmware12/patches/vmci__4.3-4.3__12.0.0.patch @@ -0,0 +1,26 @@ +--- a/linux/driver.c 2015-09-14 21:07:49.751696932 +0200 ++++ b/linux/driver.c 2015-09-14 22:10:48.015908198 +0200 +@@ -2467,8 +2467,6 @@ + static void __exit + vmci_exit(void) + { +- int retval; +- + if (guestDeviceInit) { + pci_unregister_driver(&vmci_driver); + vfree(data_buffer); +@@ -2480,12 +2478,8 @@ + + VMCI_HostCleanup(); + +- retval = misc_deregister(&linuxState.misc); +- if (retval) { +- Warning(LGPFX "Module %s: error unregistering\n", VMCI_MODULE_NAME); +- } else { +- Log(LGPFX"Module %s: unloaded\n", VMCI_MODULE_NAME); +- } ++ misc_deregister(&linuxState.misc); ++ Log(LGPFX"Module %s: unloaded\n", VMCI_MODULE_NAME); + + hostDeviceInit = FALSE; + } diff --git a/core/modules/vmware12/patches/vmmon__4.14-4.14.99__12.0-14.0.patch b/core/modules/vmware12/patches/vmmon__4.14-4.14.99__12.0-14.0.patch new file mode 100644 index 00000000..5278d645 --- /dev/null +++ b/core/modules/vmware12/patches/vmmon__4.14-4.14.99__12.0-14.0.patch @@ -0,0 +1,61 @@ +--- a/linux/hostif.c 2017-09-18 15:22:18.000000000 +0200 ++++ b/linux/hostif.c 2017-11-17 13:35:49.600578115 +0100 +@@ -79,6 +79,37 @@ + #error CONFIG_HIGH_RES_TIMERS required for acceptable performance + #endif + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) ++# define global_zone_page_state global_page_state ++#endif ++ ++static unsigned long get_nr_slab_unreclaimable(void) ++{ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) ++ return global_node_page_state(NR_SLAB_UNRECLAIMABLE); ++#else ++ return global_page_state(NR_SLAB_UNRECLAIMABLE); ++#endif ++} ++ ++static unsigned long get_nr_unevictable(void) ++{ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ return global_node_page_state(NR_UNEVICTABLE); ++#else ++ return global_page_state(NR_UNEVICTABLE); ++#endif ++} ++ ++static unsigned long get_nr_anon_mapped(void) ++{ ++ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++ return global_node_page_state(NR_ANON_MAPPED); ++ #else ++ return global_page_state(NR_ANON_PAGES); ++ #endif ++} ++ + /* + * Although this is not really related to kernel-compatibility, I put this + * helper macro here for now for a lack of better place --hpreg +@@ -1516,16 +1547,11 @@ + unsigned int reservedPages = MEMDEFAULTS_MIN_HOST_PAGES; + unsigned int hugePages = (vm == NULL) ? 0 : + BYTES_2_PAGES(vm->memInfo.hugePageBytes); +- unsigned int lockedPages = global_page_state(NR_PAGETABLE) + +- global_page_state(NR_SLAB_UNRECLAIMABLE) + +- global_page_state(NR_UNEVICTABLE) + ++ unsigned int lockedPages = global_zone_page_state(NR_PAGETABLE) + ++ get_nr_slab_unreclaimable() + ++ get_nr_unevictable() + + hugePages + reservedPages; +- unsigned int anonPages = +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) +- global_page_state(NR_ANON_MAPPED); +-#else +- global_page_state(NR_ANON_PAGES); +-#endif ++ unsigned int anonPages = get_nr_anon_mapped(); + unsigned int swapPages = BYTES_2_PAGES(linuxState.swapSize); + + if (anonPages > swapPages) { diff --git a/core/modules/vmware12/patches/vmmon__4.3-4.3__12.0.0.patch b/core/modules/vmware12/patches/vmmon__4.3-4.3__12.0.0.patch new file mode 100644 index 00000000..3f5a950a --- /dev/null +++ b/core/modules/vmware12/patches/vmmon__4.3-4.3__12.0.0.patch @@ -0,0 +1,13 @@ +--- a/linux/driver.c 2015-08-14 22:39:49.000000000 +0200 ++++ b/linux/driver.c 2015-09-14 22:11:06.807909249 +0200 +@@ -387,9 +387,7 @@ + #ifdef VMX86_DEVEL + unregister_chrdev(linuxState.major, linuxState.deviceName); + #else +- if (misc_deregister(&linuxState.misc)) { +- Warning("Module %s: error unregistering\n", linuxState.deviceName); +- } ++ misc_deregister(&linuxState.misc); + #endif + + Log("Module %s: unloaded\n", linuxState.deviceName); diff --git a/core/modules/vmware12/patches/vmmon__4.9-4.9.99__12.0.0-12.5.2.patch b/core/modules/vmware12/patches/vmmon__4.9-4.9.99__12.0.0-12.5.2.patch new file mode 100644 index 00000000..054dd8a1 --- /dev/null +++ b/core/modules/vmware12/patches/vmmon__4.9-4.9.99__12.0.0-12.5.2.patch @@ -0,0 +1,13 @@ +--- a/linux/hostif.c 2016-12-22 14:27:00.425933040 +0100 ++++ b/linux/hostif.c 2016-12-22 14:27:38.746706220 +0100 +@@ -1162,7 +1162,9 @@ + int retval; + + down_read(¤t->mm->mmap_sem); +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) ++ retval = get_user_pages((unsigned long)uvAddr, numPages, 0, ppages, NULL); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) + retval = get_user_pages((unsigned long)uvAddr, numPages, 0, 0, ppages, NULL); + #else + retval = get_user_pages(current, current->mm, (unsigned long)uvAddr, diff --git a/core/modules/vmware12/patches/vmnet__3.13-3.13__1.0-10.0.2.patch b/core/modules/vmware12/patches/vmnet__3.13-3.13__1.0-10.0.2.patch new file mode 100644 index 00000000..54607506 --- /dev/null +++ b/core/modules/vmware12/patches/vmnet__3.13-3.13__1.0-10.0.2.patch @@ -0,0 +1,27 @@ +--- a/filter.c 2014-04-17 05:30:43.497846349 -0700 ++++ b/filter.c 2014-04-17 05:30:41.445846394 -0700 +@@ -203,7 +203,11 @@ + #endif + + static unsigned int ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) + VNetFilterHookFn(unsigned int hooknum, // IN: ++#else ++VNetFilterHookFn(const struct nf_hook_ops *ops, // IN: ++#endif + #ifdef VMW_NFHOOK_USES_SKB + struct sk_buff *skb, // IN: + #else +@@ -252,7 +256,11 @@ + + /* When the host transmits, hooknum is VMW_NF_INET_POST_ROUTING. */ + /* When the host receives, hooknum is VMW_NF_INET_LOCAL_IN. */ +- transmit = (hooknum == VMW_NF_INET_POST_ROUTING); ++ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) ++ transmit = (hooknum == VMW_NF_INET_POST_ROUTING); ++ #else ++ transmit = (ops->hooknum == VMW_NF_INET_POST_ROUTING); ++ #endif + + packetHeader = compat_skb_network_header(skb); + ip = (struct iphdr*)packetHeader; diff --git a/core/modules/vmware12/patches/vmnet__4.13-9.9__12.5-12.5.99.patch b/core/modules/vmware12/patches/vmnet__4.13-9.9__12.5-12.5.99.patch new file mode 100644 index 00000000..c5ec7107 --- /dev/null +++ b/core/modules/vmware12/patches/vmnet__4.13-9.9__12.5-12.5.99.patch @@ -0,0 +1,12 @@ +--- y/bridge.c 2017-06-26 22:08:39.148034785 +1000 ++++ y/bridge.c 2017-07-16 11:37:01.325802125 +1000 +@@ -636,7 +636,7 @@ + unsigned long flags; + int i; + +- atomic_inc(&clone->users); ++ clone = skb_get(clone); + + clone->dev = dev; + clone->protocol = eth_type_trans(clone, dev); + diff --git a/core/modules/vmware12/patches/vmnet__4.9-4.9.99__12.0.0-12.5.2.patch b/core/modules/vmware12/patches/vmnet__4.9-4.9.99__12.0.0-12.5.2.patch new file mode 100644 index 00000000..18ef062b --- /dev/null +++ b/core/modules/vmware12/patches/vmnet__4.9-4.9.99__12.0.0-12.5.2.patch @@ -0,0 +1,13 @@ +--- a/userif.c 2016-12-22 14:29:43.237218623 +0100 ++++ b/userif.c 2016-12-22 14:31:03.258834075 +0100 +@@ -113,7 +113,9 @@ + int retval; + + down_read(¤t->mm->mmap_sem); +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) ++ retval = get_user_pages(addr, 1, 0, &page, NULL); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) + retval = get_user_pages(addr, 1, 1, 0, &page, NULL); + #else + retval = get_user_pages(current, current->mm, addr, diff --git a/core/modules/xorg/data/etc/X11/xorg.conf.d/10-intel.conf b/core/modules/xorg/data/etc/X11/xorg.conf.d/10-intel.conf new file mode 100644 index 00000000..711fd644 --- /dev/null +++ b/core/modules/xorg/data/etc/X11/xorg.conf.d/10-intel.conf @@ -0,0 +1,5 @@ +Section "OutputClass" + Identifier "Intel iGPU" + MatchDriver "i915" + Driver "intel" +EndSection diff --git a/core/modules/xorg/module.build b/core/modules/xorg/module.build index 8806fc9f..b5f4eb53 100644 --- a/core/modules/xorg/module.build +++ b/core/modules/xorg/module.build @@ -1,7 +1,15 @@ #!/bin/bash fetch_source() { - : + if [ -n "$REQUIRED_XORG_DRIVERS" ]; then + mkdir -p src + cd src || perror "No cd to xorg src dir" + for drv in $REQUIRED_XORG_DRIVERS; do + [ -d "${drv}/.git" ] && continue + git clone --depth 1 "git://anongit.freedesktop.org/xorg/driver/${drv}" "${drv}" || perror "Could not clone $drv" + done + cd - + fi } build() { @@ -19,8 +27,25 @@ build() { cp -r "${MODULE_BUILD_DIR}/etc/udev" "${MODULE_BUILD_DIR}/usr/lib/" fi rm -rf -- "${MODULE_BUILD_DIR}/lib/udev" "${MODULE_BUILD_DIR}/etc/udev" - # This freezed/crashed X with certain gfx cards (radeon R240) - rm -f -- "${MODULE_BUILD_DIR}/usr/lib/xorg/modules/libglamoregl.so" + + # This used to freeze/crashe X with certain gfx cards (radeon R240) + # /usr/lib/xorg/modules/libglamoregl.so + # Newer X versions seems to have this fixed, so we included it again + + # See if we should build more up to date versions of drivers + local drv + if [ -n "$REQUIRED_XORG_DRIVERS" ]; then + pinfo "Compiling requested xorg drivers from source" + mkdir -p "${MODULE_BUILD_DIR}/usr/lib/xorg/modules/drivers" + for drv in $REQUIRED_XORG_DRIVERS; do + pinfo "Compiling $drv" + cd "${MODULE_WORK_DIR}/src/${drv}" || perror "No src dir for xorg driver $drv" + ./autogen.sh || perror "Autogen for $drv failed" + ./configure || perror "configure for $drv failed" + make || perror "Make for $drv failed" + find . -type f -name "*_drv.so" -exec cp {} "${MODULE_BUILD_DIR}/usr/lib/xorg/modules/drivers" \; + done + fi } post_copy() { diff --git a/core/modules/xorg/module.conf b/core/modules/xorg/module.conf index 56784420..9eb611d8 100644 --- a/core/modules/xorg/module.conf +++ b/core/modules/xorg/module.conf @@ -17,14 +17,12 @@ REQUIRED_BINARIES=" xset xdotool xkbcomp - vmmouse_detect " REQUIRED_DIRECTORIES=" /usr/share/X11 /usr/share/fonts /etc/fonts /usr/bin - /bin /usr/lib/udev " REQUIRED_FILES=" diff --git a/core/modules/xorg/module.conf.ubuntu.17 b/core/modules/xorg/module.conf.ubuntu.17 new file mode 100644 index 00000000..520cc3b5 --- /dev/null +++ b/core/modules/xorg/module.conf.ubuntu.17 @@ -0,0 +1,104 @@ +#!/bin/bash +REQUIRED_INSTALLED_PACKAGES=" + fonts-dejavu-core + fonts-dejavu-extra + ttf-dejavu-core + xserver-xorg$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-core$UBUNTU_XORG_PKG_SUFFIX + libgl1-mesa-dri$UBUNTU_XORG_PKG_SUFFIX + libgl1-mesa-glx$UBUNTU_XORG_PKG_SUFFIX + xkb-data + x11-xkb-utils + x11-xserver-utils + x11-utils + xdotool + libtxc-dxtn-s2tc + libinput10 + libwacom2 + xserver-xorg-input-evdev$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-input-synaptics$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-input-wacom$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-input-libinput$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-video-fbdev$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-video-intel$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-video-nouveau$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-video-sisusb$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-video-vesa$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-video-vmware$UBUNTU_XORG_PKG_SUFFIX + libdrm-dev + libgbm-dev + libgl-dev + libgl1-mesa-dev + libudev-dev + pkg-config + x11proto-core-dev + x11proto-dri2-dev + x11proto-fonts-dev + x11proto-randr-dev + x11proto-render-dev + x11proto-video-dev + x11proto-xext-dev + x11proto-xf86dri-dev + xserver-xorg-dev + xutils-dev +" +REQUIRED_CONTENT_PACKAGES=" + fonts-dejavu-core + fonts-dejavu-extra + ttf-dejavu-core + xserver-xorg$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-core$UBUNTU_XORG_PKG_SUFFIX + libgl1-mesa-dri$UBUNTU_XORG_PKG_SUFFIX + libgl1-mesa-glx$UBUNTU_XORG_PKG_SUFFIX + libegl1-mesa + libgbm1 + libcapnp-0.5.3 + libmirclient9 + libwayland-client0 + libwayland-server0 + xkb-data + x11-xkb-utils + x11-xserver-utils + x11-utils + xdotool + libtxc-dxtn-s2tc + xserver-xorg-input-evdev$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-input-libinput$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-input-synaptics$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-input-wacom$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-video-fbdev$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-video-intel$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-video-nouveau$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-video-sisusb$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-video-vesa$UBUNTU_XORG_PKG_SUFFIX + xserver-xorg-video-vmware$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-input-mouse$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-video-openchrome$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-video-savage$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-video-trident$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-video-mach64$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-video-qxl$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-video-siliconmotion$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-video-cirrus$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-video-r128$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-video-neomagic$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-video-geode$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-video-s3$UBUNTU_XORG_PKG_SUFFIX + @xserver-xorg-video-tdfx$UBUNTU_XORG_PKG_SUFFIX +" + +REQUIRED_DIRECTORIES+=" + /usr/lib +" +# TODO: Required because the shipped ones crash on VT switch as of 2017-11-24 +# Remove when fixed in ubuntu repos +REQUIRED_XORG_DRIVERS=" + xf86-video-ati + xf86-video-amdgpu +" +REQUIRED_LIBRARIES+=" + amdgpu_drv + radeon_drv + ati_drv +" +REQUIRED_FILES="" diff --git a/core/rootfs/rootfs-stage31/data/etc/modprobe.d/amdgpu-si-support.conf b/core/rootfs/rootfs-stage31/data/etc/modprobe.d/amdgpu-si-support.conf new file mode 100644 index 00000000..ea4e1281 --- /dev/null +++ b/core/rootfs/rootfs-stage31/data/etc/modprobe.d/amdgpu-si-support.conf @@ -0,0 +1,2 @@ +options amdgpu si_support=1 +options amdgpu cik_support=1 diff --git a/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig b/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig index 0ce6bfae..3f109408 100644 --- a/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig +++ b/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig @@ -17,6 +17,7 @@ fetch_text_config() { echo "# Config fetched from $URL" >> "$CONFIG" echo "#_RCONFIG_TAG" >> "$CONFIG" + CONFIG_DOWNLOAD_TIME=$(sed -r 's/^([0-9]+)\.([0-9]+).*$/\1\2/' /proc/uptime) cat "${CONFIG}-remote" >> "$CONFIG" } ######################################################################### @@ -139,5 +140,11 @@ if [ -n "$SLX_SYSTEMD_TARGET" ]; then done fi +# Activate jumbo frames if requested +( + . /run/network.conf + [ -n "$IFACE" ] && [ "x$SLX_JUMBO_FRAMES" = "xyes" ] && ip link set dev "$IFACE" mtu 9000 +) + true diff --git a/core/rootfs/rootfs-stage31/data/inc/drm.functions b/core/rootfs/rootfs-stage31/data/inc/drm.functions index c62c562b..ab87efb3 100644 --- a/core/rootfs/rootfs-stage31/data/inc/drm.functions +++ b/core/rootfs/rootfs-stage31/data/inc/drm.functions @@ -41,8 +41,12 @@ setup_gfx () { load_gfx @nvidia return fi - if [ "x$GFX" == "xamd" ]; then - load_gfx @amd + if [ "x$GFX" == "xamdgpu" ]; then + load_gfx @amdgpu + return + fi + if [ "x$GFX" == "xradeon" ]; then + load_gfx @radeon return fi # not forced - check which driver to load diff --git a/core/rootfs/rootfs-stage31/data/inc/ntp_sync b/core/rootfs/rootfs-stage31/data/inc/ntp_sync index 940af366..410b56d2 100755 --- a/core/rootfs/rootfs-stage31/data/inc/ntp_sync +++ b/core/rootfs/rootfs-stage31/data/inc/ntp_sync @@ -1,22 +1,48 @@ +#!/bin/ash # Sync time via network func_sync_net_time() { - local SERVER - if [ -n "$SLX_NTP_SERVER" ]; then - for SERVER in $SLX_NTP_SERVER; do - if ntpdate -u -p 2 "$SERVER"; then - echo "Successfully queried $SERVER for time." - if [ "x$SLX_BIOS_CLOCK" = "xlocal" ]; then - usleep 100000 - hwclock -l -w || echo "... but could not set BIOS clock to localtime" - elif [ "x$SLX_BIOS_CLOCK" = "xutc" ]; then - usleep 100000 - hwclock -u -w || echo "... but could not set BIOS clock to UTC" + local SERVER SUCCESS NTPSRV + # Try to merge with servers from DHCP. Prefer DHCP, skip duplicates + touch /run/ntpsrv + for SERVER in $SLX_NTP_SERVER; do + if ! grep -Fxq "$SERVER" /run/ntpsrv; then + echo "$SERVER" >> /run/ntpsrv + fi + done + NTPSRV=$(cat /run/ntpsrv) + SUCCESS= + for SERVER in $NTPSRV; do + if ntpdate -u -p 2 "$SERVER"; then + echo "Successfully queried $SERVER for time." + if [ "x$SLX_BIOS_CLOCK" = "xlocal" ]; then + usleep 100000 + hwclock -l -w || echo "... but could not set BIOS clock to localtime" + elif [ "x$SLX_BIOS_CLOCK" = "xutc" ]; then + usleep 100000 + hwclock -u -w || echo "... but could not set BIOS clock to UTC" + fi + SUCCESS=1 + break + fi + echo "Error querying $SERVER for current time." + done + if [ -z "$SUCCESS" ]; then + echo "No NTP server reachable" + # See if we have a timestamp in our server-config - should only be a few seconds off by now + if [ -n "$SLX_NOW" ] && [ "$SLX_NOW" -gt 1234567890 ]; then + TTS="$SLX_NOW" + if [ -n "$CONFIG_DOWNLOAD_TIME" ]; then + NOW_TIME=$(sed -r 's/^([0-9]+)\.([0-9]+).*$/\1\2/' /proc/uptime) + if [ "$CONFIG_DOWNLOAD_TIME" -gt 0 ] && [ "$NOW_TIME" -gt 0 ]; then + TTS=$(( TTS + ( NOW_TIME - CONFIG_DOWNLOAD_TIME ) / 100 )) fi - break fi - echo "Error querying $SERVER for current time." - done + echo "Setting time to SLX_NOW ($SLX_NOW, corrected $TTS)" + date -s "@$TTS" + else + echo "No fallback option for timesync available, relying on correct RTC setup" + fi fi } diff --git a/core/rootfs/rootfs-stage31/data/inc/parse_kcl b/core/rootfs/rootfs-stage31/data/inc/parse_kcl index 4a69ac25..e0f5a752 100644 --- a/core/rootfs/rootfs-stage31/data/inc/parse_kcl +++ b/core/rootfs/rootfs-stage31/data/inc/parse_kcl @@ -43,8 +43,10 @@ for opts in ${KCL}; do SPLASH=1 ;; nvidia) GFX=nvidia ;; - ati|amd) - GFX=amd ;; + amdgpu) + GFX=amdgpu ;; + radeon) + GFX=radeon ;; esac done diff --git a/core/rootfs/rootfs-stage31/data/inc/setup_network b/core/rootfs/rootfs-stage31/data/inc/setup_network index 0aa033b9..897469cc 100644 --- a/core/rootfs/rootfs-stage31/data/inc/setup_network +++ b/core/rootfs/rootfs-stage31/data/inc/setup_network @@ -42,6 +42,7 @@ Check output of dmesg for missing firmware (dmesg | less)" : fi +ADD_NIC=1 for LINE in $IP_OUT; do IFACE=$(echo "$LINE" | awk -F '==' '{printf $1}') IFMAC=$(echo "$LINE" | awk -F '==' '{printf $2}' | tr '[A-Z]' '[a-z]') # udev requires mac addesses to be lowercase (a-f), see http://www.debianhelp.co.uk/udev.htm @@ -71,6 +72,16 @@ for LINE in $IP_OUT; do fi # Ignore this device later on when systemd handles network interfaces (see hacked 99-systemd.rules in systemd data dir) echo "SUBSYSTEM==\"net\", ACTION==\"add\", KERNEL==\"eth*\", ATTR{address}==\"$IFMAC\", TAG+=\"openslxignore\"" >> "${FUTURE_ROOT}/etc/udev/rules.d/01-ignore-boot-interface.rules" + else + # Additional NIC - prepare bridge in case we want to add these to a VM or do other fancy things + ADD_BR="br-nic-$ADD_NIC" + brctl addbr "$ADD_BR" + brctl stp "$ADD_BR" 0 + ip link set addr "$IFMAC" "$ADD_BR" + ip link set dev "$IFACE" up + brctl addif "$ADD_BR" "$IFACE" + ip link set dev "$ADD_BR" up + ADD_NIC=$(( ADD_NIC + 1 )) fi # youdev echo "SUBSYSTEM==\"net\", ACTION==\"add\", DRIVERS==\"?*\", ATTR{address}==\"$IFMAC\", ATTR{dev_id}==\"0x0\", ATTR{type}==\"1\", KERNEL==\"eth*\", NAME=\"$IFACE\"" >> "${FUTURE_ROOT}/etc/udev/rules.d/70-net-boot-nic-name.rules" @@ -93,5 +104,5 @@ echo "CLIENTIP=$CLIENTIP" >> /run/network.conf echo "GATEWAY=$GATEWAY" >> /run/network.conf echo "BRIDGE=$BRIDGE" >> /run/network.conf -udhcpc $PARAM -O domain -O nissrv -O nisdomain -O wpad -O search -t 5 -T 2 -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE" +udhcpc $PARAM -O ntpsrv -O domain -O wpad -O search -t 5 -T 2 -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE" # udhcpc return value will be return value of this script diff --git a/core/rootfs/rootfs-stage31/data/inc/setup_stage32 b/core/rootfs/rootfs-stage31/data/inc/setup_stage32 index 6568fb7d..81a3da16 100644 --- a/core/rootfs/rootfs-stage31/data/inc/setup_stage32 +++ b/core/rootfs/rootfs-stage31/data/inc/setup_stage32 @@ -47,7 +47,6 @@ FUTURE_ROOT="/mnt" # Move network stuff cp /etc/hostname /etc/hosts "${FUTURE_ROOT}/etc/" cp /etc/resolv.conf "${FUTURE_ROOT}/opt/openslx/" -[ -s "/run/config" ] && cat "/run/config" >> "${FUTURE_ROOT}/opt/openslx/config" # if booting with splash, suppress kernel output in stage32 if [ $SPLASH -eq 1 ]; then diff --git a/core/rootfs/rootfs-stage31/data/inc/setup_stage4 b/core/rootfs/rootfs-stage31/data/inc/setup_stage4 index 585627c2..a00117f2 100644 --- a/core/rootfs/rootfs-stage31/data/inc/setup_stage4 +++ b/core/rootfs/rootfs-stage31/data/inc/setup_stage4 @@ -48,7 +48,6 @@ FUTURE_ROOT="/mnt" cp /etc/hostname /etc/hosts "${FUTURE_ROOT}/etc/" cp /etc/resolv.conf "${FUTURE_ROOT}/opt/openslx/" -[ -s "/run/config" ] && cat "/run/config" >> "${FUTURE_ROOT}/opt/openslx/config" # if booting with splash, suppress kernel output in stage32 if [ $SPLASH -eq 1 ]; then diff --git a/core/rootfs/rootfs-stage31/data/inc/udhcpc-trigger b/core/rootfs/rootfs-stage31/data/inc/udhcpc-trigger index 02987f21..15fb59bf 100755 --- a/core/rootfs/rootfs-stage31/data/inc/udhcpc-trigger +++ b/core/rootfs/rootfs-stage31/data/inc/udhcpc-trigger @@ -62,15 +62,29 @@ if [ -z "$domain" ]; then fqdn=$(timeout -t 3 nslookup "$ip" | grep -E "^Address +[0-9]+: +$ip " | head -n 1 | awk '{print $4}') domain="${fqdn#*.}" fi +# Add domain to list of search domains if not in there yet +if [ -n "$domain" ] && [ -n "$search" ]; then + FOUND=no + for sd in $search; do + [ "x$sd" = "x$domain" ] && FOUND=yes + done + [ "$FOUND" = "no" ] && search="$domain $search" +elif [ -n "$domain" ]; then + search="$domain" +fi +# Write out if [ -n "$domain" ]; then echo "domain $domain" >> "/etc/resolv.conf" + echo "SLX_NET_DOMAIN='$domain'" >> /run/config fi if [ -n "$search" ]; then echo "search $search" >> "/etc/resolv.conf" -elif [ -n "$domain" ]; then - echo "search $domain" >> "/etc/resolv.conf" + echo "SLX_NET_SEARCH='$search'" >> /run/config fi +for i in $ntpsrv; do + echo "$i" >> "/run/ntpsrv" +done # Hostname if [ -z "$hostname" ]; then diff --git a/core/rootfs/rootfs-stage31/data/init b/core/rootfs/rootfs-stage31/data/init index aa8994e2..74324fec 100755 --- a/core/rootfs/rootfs-stage31/data/init +++ b/core/rootfs/rootfs-stage31/data/init @@ -38,7 +38,7 @@ bench_event "KERNEL" "Kernel initialized" # the link had to be dropped, to prevent bugs in the stage32. busybox mount -n -t devtmpfs -o 'rw,relatime,nosuid,noexec,mode=0755' initramfsdevs /dev busybox mount -n -t tmpfs -o 'mode=755,size=10m' run "/run" -busybox mount -n -t tmpfs -o 'mode=755,size=10m' temp "/tmp" +busybox mount -n -t tmpfs -o 'mode=755,size=50m' temp "/tmp" # IMPORTANT - check if kernel modules in initrams match kernel version BASEDIR="/lib/modules/$(uname -r)/kernel/drivers" @@ -85,6 +85,8 @@ mkdir -p "$FUTURE_ROOT/opt/openslx" # Get all variables we care about from the KCL . /inc/parse_kcl +[ $DEBUG -ge 5 ] && drop_shell "Requested Debug Shell: before kernel modules." + # NOTE: this is only relevant when using the distro's kernel # load kernel modules as given in /etc/modules modprobe -a -b $(cat /etc/modules) 2>/dev/null @@ -149,64 +151,37 @@ if [ ! -z "$SLX_DEMO_PASS" ]; then sed -i "s#^demo:[^:]*:#demo:$SLX_DEMO_PASS:#" "${FUTURE_ROOT}/etc/shadow" fi -# one last debug shell if activated -[ $DEBUG -ge 1 ] && drop_shell "Requested Debug Shell: before switch_root." - # Activate debug shell after switchroot? [ -n "$DEBUG_SHELL" ] && ln -s "../debug-shell.service" "${FUTURE_ROOT}/usr/lib/systemd/system/sysinit.target.wants/debug-shell.service" -# need /proc for this ;) -bench_event "PRESWITCH" "Switching to stage 3.2" - -# HACK HACK: Klausurmodus -if [ "x$SLX_PVS_DEDICATED" = "xyes" ] || [ "x$SLX_PVS_HYBRID" = "xyes" ]; then - sed -i '/^SLX_EXAM=/d' "${FUTURE_ROOT}/opt/openslx/config" - SLX_EXAM= -fi -# Putting this here as we're hopefully moving to the all new dracut solution soon -# so there's no reason to make it pretty now - -# Auto login to demo user requested? -if [ -n "$SLX_AUTOLOGIN" ] || [ -z "$SLX_EXAM" -a -n "$SLX_AUTOSTART_UUID" ]; then - # Enable KDM autologin for demo user - sed -i '/^AutoLoginDelay=/d;/^AutoLoginUser=/d;s/^AutoLoginEnable=.*$/AutoLoginEnable=true\nAutoLoginUser=demo\nAutoLoginDelay=0/' "${FUTURE_ROOT}/etc/kde4/kdm/kdmrc" -fi - # Exam mode if [ -n "$SLX_EXAM" ]; then - # Visual: Make kdm all orange - sed -i 's/#e3e4e9/#f9a72b/g' "${FUTURE_ROOT}/usr/share/desktop/themes/kdm/bwlehrpool/theme.xml" - # Logo gray like main runner - sed -r -i 's/#[a-fA-F0-9]{6}/#757575/g' "${FUTURE_ROOT}/usr/share/desktop/themes/kdm/bwlehrpool/bwLehrpool.svg" # Visual: Move splash screen to upper left corner if [ -e "/etc/splash.ppm.gz" ]; then fbsplash -b -s "/etc/splash.ppm.gz" & elif [ -e "/etc/splash.ppm" ]; then fbsplash -b -s "/etc/splash.ppm" & fi - # Visual: ssh banner - echo "+ - - - - KLAUSURMODUS AKTIV - - - - +" >> "${FUTURE_ROOT}/etc/issue.net" - echo "++++++++++++++++++++++++++++++++++++++" >> "${FUTURE_ROOT}/etc/issue.net" - # Disable ctrl-alt-delete - rm -- "${FUTURE_ROOT}/usr/lib/systemd/system/ctrl-alt-del.target" - # No idleaction - rm -- "${FUTURE_ROOT}/etc/cron.d/openslx-idleaction" - # Ignore everything but power button - cat > "${FUTURE_ROOT}/etc/systemd/logind.conf" <<EOF -[Login] -NAutoVTs=0 -ReserveVT=0 -KillUserProcesses=no -HandlePowerKey=poweroff -HandleSuspendKey=ignore -HandleHibernateKey=ignore -HandleLidSwitch=ignore -IdleAction=ignore -EOF - # Link exam.service in sysinit.target - ln -s "../exam.service" "${FUTURE_ROOT}/etc/systemd/system/sysinit.target.wants/exam.service" fi +# Merge freshly generated config to stage32 +if [ -s "/run/config" ]; then + line= + while read -r line || [ -n "$line" ]; do + [ "${line:0:1}" = '#' ] && continue + var="${line%%=*}" + [ "$var" = "$line" ] && continue + sed -i -r "s/^(${var}=)/#<s31>\\1/" "${FUTURE_ROOT}/opt/openslx/config" + done < "/run/config" + cat "/run/config" >> "${FUTURE_ROOT}/opt/openslx/config" +fi + +# one last debug shell if activated +[ $DEBUG -ge 1 ] && drop_shell "Requested Debug Shell: before switch_root." + +# need /proc for this ;) +bench_event "PRESWITCH" "Switching to stage 3.2" + # unmount filesystems for mnt in run tmp; do busybox umount -f -l "/$mnt" 2>/dev/null diff --git a/core/rootfs/rootfs-stage31/templates/drm.cfg b/core/rootfs/rootfs-stage31/templates/drm.cfg index 485d03ac..45006f97 100644 --- a/core/rootfs/rootfs-stage31/templates/drm.cfg +++ b/core/rootfs/rootfs-stage31/templates/drm.cfg @@ -12,7 +12,9 @@ # 10de-0df8: nvidia Quadro 600 # 10de-06dd: nvidia Quadro 4000 # 10de-1382: nvidia GeForce GTX 745 (HN) -# 10de-13ba Quadro K2200 +# 10de-13ba: Quadro K2200 +# 10de-13bb: nvidia Quadro K620 (HN) +# 10de-1381: nvidia GeForce GTX 750 (HN) ## 10de:11c0 @nvidia 10de:11fa @nvidia @@ -23,9 +25,15 @@ 10de:06dd @nvidia 10de:1382 @nvidia 10de:13ba @nvidia +10de:13bb @nvidia +10de:1381 @nvidia + ## intel # Dell GX 620 8086:2772 i915 # aliases @nvidia nvidia/nvidia.ko nvidia/nvidia-uvm.ko nvidia/nvidia-modeset.ko nvidia/nvidia-drm.ko @nvidia_fallback nouveau +@amdgpu amdgpu +@amdgpu_fallback radeon +@radeon radeon diff --git a/core/rootfs/rootfs-stage32/data/etc/profile b/core/rootfs/rootfs-stage32/data/etc/profile index cbc5dba2..125e7195 100644 --- a/core/rootfs/rootfs-stage32/data/etc/profile +++ b/core/rootfs/rootfs-stage32/data/etc/profile @@ -28,13 +28,17 @@ if [ "$PS1" ]; then fi # Stuff we might wanna know -PWENT=`getent passwd $USER` -export USER=`echo "$PWENT" | awk -F ':' '{print $1}'` -export GID=`echo "$PWENT" | awk -F ':' '{print $4}'` -export HOME=`echo "$PWENT" | awk -F ':' '{print $6}'` -export GROUP=`id -gn` -export LOGNAME=$USER -export HOSTNAME=`hostname` +PWENT= +[ -n "$UID" ] && PWENT=`getent passwd "$UID"` +[ -z "$PWENT" ] && [ -n "$USER" ] && PWENT=`getent passwd "$USER"` +if [ -n "$PWENT" ]; then + export USER=`echo "$PWENT" | awk -F ':' '{print $1}'` + export GID=`echo "$PWENT" | awk -F ':' '{print $4}'` + export HOME=`echo "$PWENT" | awk -F ':' '{print $6}'` + export GROUP=`id -gn` + export LOGNAME=$USER + export HOSTNAME=`hostname` +fi # set TERM to xterm on SSH sessions [ -n "$SSH_TTY" ] && export TERM=xterm @@ -42,7 +46,7 @@ export HOSTNAME=`hostname` # Source configuration files from /etc/profile.d for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then - . $i + . "$i" fi done diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions index 6a353b8f..d4042926 100755 --- a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions +++ b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions @@ -42,7 +42,7 @@ format_disk () { if which "mkfs.$fs" ; then case "$fs" in xfs) - fopt="-f -b size=4k -s size=4k -l size=512b" # fastest formatting possible :) + fopt="-f -b size=4k -s size=4k" # fastest formatting possible :) MOUNT_OPTIONS_SET_BY_FORMAT_DISK="-o noexec" ;; ext2) @@ -152,7 +152,7 @@ for PART_DEV in $(get_all_with_id 83); do done # special partition 45 (persistent scratch) to $MOUNT_POINT_45 -for PART_DEV in $(get_all_with_id 45); do +for PART_DEV in $(get_all_with_id 45) '/dev/disk/by-partlabel/OpenSLX-ID45'; do mkdir -p "$MOUNT_POINT_45" if ! mount -t auto -o noexec "${PART_DEV}" "$MOUNT_POINT_45"; then format_disk "$PART_DEV" "ext4 xfs jfs ext3" || continue @@ -171,7 +171,11 @@ for PART_DEV in $(get_all_with_id 46); do # ln -sf /media/${PART_DEV#/dev/*} /var/home echo -e "${PART_DEV}\t/media/${PART_DEV#/dev/*}\tauto\t\tnoauto\t\t 0 0" >> "/etc/fstab" done -if [ "$HAVE_PARTITION_45" = "no" ] && [ -d "$MOUNT_POINT_45" ]; then +if [ "$HAVE_PARTITION_45" = "yes" ]; then + mkdir -p "$MOUNT_POINT_45/data" + chown root:root "$MOUNT_POINT_45" "$MOUNT_POINT_45/data" + chmod a+rwxt "$MOUNT_POINT_45/data" +elif [ -d "$MOUNT_POINT_45" ]; then rm -f -- "$MOUNT_POINT_45" fi diff --git a/core/rootfs/rootfs-stage32/module.conf b/core/rootfs/rootfs-stage32/module.conf index 20baddbd..5fb51bfb 100644 --- a/core/rootfs/rootfs-stage32/module.conf +++ b/core/rootfs/rootfs-stage32/module.conf @@ -18,6 +18,7 @@ REQUIRED_BINARIES=" mount.nfs4 umount.nfs4 mkfs.xfs + mkfs.jfs mkfs.ext3 mkfs.ext4 blkid @@ -47,8 +48,11 @@ REQUIRED_BINARIES=" date cat ls + dd awk sed + ldd + strace " REQUIRED_LIBRARIES=" libcap diff --git a/core/rootfs/rootfs-stage32/module.conf.ubuntu b/core/rootfs/rootfs-stage32/module.conf.ubuntu index 99ce5923..dbb81683 100644 --- a/core/rootfs/rootfs-stage32/module.conf.ubuntu +++ b/core/rootfs/rootfs-stage32/module.conf.ubuntu @@ -4,6 +4,7 @@ REQUIRED_INSTALLED_PACKAGES=" squashfs-tools whois xfsprogs + jfsutils curl openssl gawk diff --git a/core/rootfs/rootfs-stage32/module.conf.ubuntu.17 b/core/rootfs/rootfs-stage32/module.conf.ubuntu.17 new file mode 100644 index 00000000..3b328107 --- /dev/null +++ b/core/rootfs/rootfs-stage32/module.conf.ubuntu.17 @@ -0,0 +1,24 @@ +#!/bin/bash +REQUIRED_INSTALLED_PACKAGES=" + nfs-common + squashfs-tools + whois + xfsprogs + curl + openssl + gawk + kbd +" +REQUIRED_CONTENT_PACKAGES=" + openssl +" +REQUIRED_BINARIES+=" + openssl +" +REQUIRED_SYSTEM_FILES+=" + /usr/lib/x86_64-linux-gnu/xtables +" +REQUIRED_FILES+=" + /etc/X11/app-defaults/Xvidtune + /usr/lib/ssl/openssl.cnf +" diff --git a/core/targets/stage32-bwlp/dnbd3-proxy-mode b/core/targets/stage32-bwlp/dnbd3-proxy-mode new file mode 120000 index 00000000..41ea3e29 --- /dev/null +++ b/core/targets/stage32-bwlp/dnbd3-proxy-mode @@ -0,0 +1 @@ +../../modules/dnbd3-proxy-mode
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/kdm b/core/targets/stage32-bwlp/kdm deleted file mode 120000 index 727ed5b5..00000000 --- a/core/targets/stage32-bwlp/kdm +++ /dev/null @@ -1 +0,0 @@ -../../modules/kdm
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/kdm-theme-bwlp b/core/targets/stage32-bwlp/kdm-theme-bwlp deleted file mode 120000 index db1d5251..00000000 --- a/core/targets/stage32-bwlp/kdm-theme-bwlp +++ /dev/null @@ -1 +0,0 @@ -../../modules/kdm-theme-bwlp
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/lightdm b/core/targets/stage32-bwlp/lightdm new file mode 120000 index 00000000..05feb71c --- /dev/null +++ b/core/targets/stage32-bwlp/lightdm @@ -0,0 +1 @@ +../../modules/lightdm
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/lightdm-greeter-bwlp b/core/targets/stage32-bwlp/lightdm-greeter-bwlp new file mode 120000 index 00000000..694092d5 --- /dev/null +++ b/core/targets/stage32-bwlp/lightdm-greeter-bwlp @@ -0,0 +1 @@ +../../modules/lightdm-greeter-bwlp
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/mgmt-sshd b/core/targets/stage32-bwlp/mgmt-sshd new file mode 120000 index 00000000..52a1f3f6 --- /dev/null +++ b/core/targets/stage32-bwlp/mgmt-sshd @@ -0,0 +1 @@ +../../modules/mgmt-sshd
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/safe-mode b/core/targets/stage32-bwlp/safe-mode new file mode 120000 index 00000000..86422724 --- /dev/null +++ b/core/targets/stage32-bwlp/safe-mode @@ -0,0 +1 @@ +../../modules/safe-mode
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/xscreensaver b/core/targets/stage32-bwlp/xscreensaver index 156ea38f..d2f4f1a8 120000 --- a/core/targets/stage32-bwlp/xscreensaver +++ b/core/targets/stage32-bwlp/xscreensaver @@ -1 +1 @@ -../../modules/xscreensaver/
\ No newline at end of file +../../modules/xscreensaver
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/busybox b/core/targets/stage32-lightdm/busybox deleted file mode 120000 index 4f45cedf..00000000 --- a/core/targets/stage32-lightdm/busybox +++ /dev/null @@ -1 +0,0 @@ -../../modules/busybox
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/consolekit b/core/targets/stage32-lightdm/consolekit deleted file mode 120000 index 261968c7..00000000 --- a/core/targets/stage32-lightdm/consolekit +++ /dev/null @@ -1 +0,0 @@ -../../modules/consolekit
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/cpugovernor b/core/targets/stage32-lightdm/cpugovernor deleted file mode 120000 index 544c1e19..00000000 --- a/core/targets/stage32-lightdm/cpugovernor +++ /dev/null @@ -1 +0,0 @@ -../../modules/cpugovernor
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/dbus b/core/targets/stage32-lightdm/dbus deleted file mode 120000 index dd148715..00000000 --- a/core/targets/stage32-lightdm/dbus +++ /dev/null @@ -1 +0,0 @@ -../../modules/dbus
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/debug b/core/targets/stage32-lightdm/debug deleted file mode 120000 index c05237d6..00000000 --- a/core/targets/stage32-lightdm/debug +++ /dev/null @@ -1 +0,0 @@ -../../modules/debug
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/ldm b/core/targets/stage32-lightdm/ldm deleted file mode 120000 index 0ee07888..00000000 --- a/core/targets/stage32-lightdm/ldm +++ /dev/null @@ -1 +0,0 @@ -../../modules/ldm
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/ldm-gtk-greeter b/core/targets/stage32-lightdm/ldm-gtk-greeter deleted file mode 120000 index 82ef14e4..00000000 --- a/core/targets/stage32-lightdm/ldm-gtk-greeter +++ /dev/null @@ -1 +0,0 @@ -../../modules/ldm-gtk-greeter/
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/policykit b/core/targets/stage32-lightdm/policykit deleted file mode 120000 index 39b77c7f..00000000 --- a/core/targets/stage32-lightdm/policykit +++ /dev/null @@ -1 +0,0 @@ -../../modules/policykit
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/rootfs-stage32 b/core/targets/stage32-lightdm/rootfs-stage32 deleted file mode 120000 index 96dcbb86..00000000 --- a/core/targets/stage32-lightdm/rootfs-stage32 +++ /dev/null @@ -1 +0,0 @@ -../../rootfs/rootfs-stage32
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/rsyslogd b/core/targets/stage32-lightdm/rsyslogd deleted file mode 120000 index 339d02f8..00000000 --- a/core/targets/stage32-lightdm/rsyslogd +++ /dev/null @@ -1 +0,0 @@ -../../modules/rsyslogd
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/sshd b/core/targets/stage32-lightdm/sshd deleted file mode 120000 index 56b4e4b5..00000000 --- a/core/targets/stage32-lightdm/sshd +++ /dev/null @@ -1 +0,0 @@ -../../modules/sshd
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/systemd b/core/targets/stage32-lightdm/systemd deleted file mode 120000 index 2dc58bd3..00000000 --- a/core/targets/stage32-lightdm/systemd +++ /dev/null @@ -1 +0,0 @@ -../../modules/systemd
\ No newline at end of file diff --git a/core/targets/stage32-lightdm/xorg b/core/targets/stage32-lightdm/xorg deleted file mode 120000 index a9494860..00000000 --- a/core/targets/stage32-lightdm/xorg +++ /dev/null @@ -1 +0,0 @@ -../../modules/xorg
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/alsa b/core/targets/stage32-opensuse/alsa deleted file mode 120000 index 7e13d263..00000000 --- a/core/targets/stage32-opensuse/alsa +++ /dev/null @@ -1 +0,0 @@ -../../modules/alsa
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/beamergui b/core/targets/stage32-opensuse/beamergui deleted file mode 120000 index 5e863316..00000000 --- a/core/targets/stage32-opensuse/beamergui +++ /dev/null @@ -1 +0,0 @@ -../../modules/beamergui
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/consolekit b/core/targets/stage32-opensuse/consolekit deleted file mode 120000 index 261968c7..00000000 --- a/core/targets/stage32-opensuse/consolekit +++ /dev/null @@ -1 +0,0 @@ -../../modules/consolekit
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/cpugovernor b/core/targets/stage32-opensuse/cpugovernor deleted file mode 120000 index 544c1e19..00000000 --- a/core/targets/stage32-opensuse/cpugovernor +++ /dev/null @@ -1 +0,0 @@ -../../modules/cpugovernor
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/cron b/core/targets/stage32-opensuse/cron deleted file mode 120000 index 39164da5..00000000 --- a/core/targets/stage32-opensuse/cron +++ /dev/null @@ -1 +0,0 @@ -../../modules/cron
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/cups b/core/targets/stage32-opensuse/cups deleted file mode 120000 index 0ff7101d..00000000 --- a/core/targets/stage32-opensuse/cups +++ /dev/null @@ -1 +0,0 @@ -../../modules/cups
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/dbus b/core/targets/stage32-opensuse/dbus deleted file mode 120000 index dd148715..00000000 --- a/core/targets/stage32-opensuse/dbus +++ /dev/null @@ -1 +0,0 @@ -../../modules/dbus
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/debug b/core/targets/stage32-opensuse/debug deleted file mode 120000 index c05237d6..00000000 --- a/core/targets/stage32-opensuse/debug +++ /dev/null @@ -1 +0,0 @@ -../../modules/debug
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/dhcpc-busybox b/core/targets/stage32-opensuse/dhcpc-busybox deleted file mode 120000 index ea3634e6..00000000 --- a/core/targets/stage32-opensuse/dhcpc-busybox +++ /dev/null @@ -1 +0,0 @@ -../../modules/dhcpc-busybox
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/dnbd3 b/core/targets/stage32-opensuse/dnbd3 deleted file mode 120000 index fa80b45c..00000000 --- a/core/targets/stage32-opensuse/dnbd3 +++ /dev/null @@ -1 +0,0 @@ -../../modules/dnbd3
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/german b/core/targets/stage32-opensuse/german deleted file mode 120000 index 4469f96e..00000000 --- a/core/targets/stage32-opensuse/german +++ /dev/null @@ -1 +0,0 @@ -../../modules/german
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/idleaction b/core/targets/stage32-opensuse/idleaction deleted file mode 120000 index 09fd9493..00000000 --- a/core/targets/stage32-opensuse/idleaction +++ /dev/null @@ -1 +0,0 @@ -../../modules/idleaction
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/iptables-helper b/core/targets/stage32-opensuse/iptables-helper deleted file mode 120000 index e449282d..00000000 --- a/core/targets/stage32-opensuse/iptables-helper +++ /dev/null @@ -1 +0,0 @@ -../../modules/iptables-helper
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/kdm b/core/targets/stage32-opensuse/kdm deleted file mode 120000 index 727ed5b5..00000000 --- a/core/targets/stage32-opensuse/kdm +++ /dev/null @@ -1 +0,0 @@ -../../modules/kdm
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/kernel b/core/targets/stage32-opensuse/kernel deleted file mode 120000 index 044f086d..00000000 --- a/core/targets/stage32-opensuse/kernel +++ /dev/null @@ -1 +0,0 @@ -../../modules/kernel
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/nscd b/core/targets/stage32-opensuse/nscd deleted file mode 120000 index d7e411d2..00000000 --- a/core/targets/stage32-opensuse/nscd +++ /dev/null @@ -1 +0,0 @@ -../../modules/nscd
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/openbox b/core/targets/stage32-opensuse/openbox deleted file mode 120000 index 0fb8d86d..00000000 --- a/core/targets/stage32-opensuse/openbox +++ /dev/null @@ -1 +0,0 @@ -../../modules/openbox
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/pam b/core/targets/stage32-opensuse/pam deleted file mode 120000 index 588acdbf..00000000 --- a/core/targets/stage32-opensuse/pam +++ /dev/null @@ -1 +0,0 @@ -../../modules/pam
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/polkit b/core/targets/stage32-opensuse/polkit deleted file mode 120000 index 0ad0b111..00000000 --- a/core/targets/stage32-opensuse/polkit +++ /dev/null @@ -1 +0,0 @@ -../../modules/polkit
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/printergui b/core/targets/stage32-opensuse/printergui deleted file mode 120000 index 6ccbb628..00000000 --- a/core/targets/stage32-opensuse/printergui +++ /dev/null @@ -1 +0,0 @@ -../../modules/printergui
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/redsocks b/core/targets/stage32-opensuse/redsocks deleted file mode 120000 index 0740c53b..00000000 --- a/core/targets/stage32-opensuse/redsocks +++ /dev/null @@ -1 +0,0 @@ -../../modules/redsocks
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/rootfs-stage32 b/core/targets/stage32-opensuse/rootfs-stage32 deleted file mode 120000 index 96dcbb86..00000000 --- a/core/targets/stage32-opensuse/rootfs-stage32 +++ /dev/null @@ -1 +0,0 @@ -../../rootfs/rootfs-stage32
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/rsyslogd b/core/targets/stage32-opensuse/rsyslogd deleted file mode 120000 index 339d02f8..00000000 --- a/core/targets/stage32-opensuse/rsyslogd +++ /dev/null @@ -1 +0,0 @@ -../../modules/rsyslogd
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/run-virt b/core/targets/stage32-opensuse/run-virt deleted file mode 120000 index 1e4a476c..00000000 --- a/core/targets/stage32-opensuse/run-virt +++ /dev/null @@ -1 +0,0 @@ -../../modules/run-virt
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/smartctl b/core/targets/stage32-opensuse/smartctl deleted file mode 120000 index 3a48434f..00000000 --- a/core/targets/stage32-opensuse/smartctl +++ /dev/null @@ -1 +0,0 @@ -../../modules/smartctl
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/sshd b/core/targets/stage32-opensuse/sshd deleted file mode 120000 index 56b4e4b5..00000000 --- a/core/targets/stage32-opensuse/sshd +++ /dev/null @@ -1 +0,0 @@ -../../modules/sshd
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/systemd b/core/targets/stage32-opensuse/systemd deleted file mode 120000 index 2dc58bd3..00000000 --- a/core/targets/stage32-opensuse/systemd +++ /dev/null @@ -1 +0,0 @@ -../../modules/systemd
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/udisks b/core/targets/stage32-opensuse/udisks deleted file mode 120000 index 06e7da5f..00000000 --- a/core/targets/stage32-opensuse/udisks +++ /dev/null @@ -1 +0,0 @@ -../../modules/udisks
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/vmchooser b/core/targets/stage32-opensuse/vmchooser deleted file mode 120000 index d918fbdc..00000000 --- a/core/targets/stage32-opensuse/vmchooser +++ /dev/null @@ -1 +0,0 @@ -../../modules/vmchooser
\ No newline at end of file diff --git a/core/targets/stage32-opensuse/xorg b/core/targets/stage32-opensuse/xorg deleted file mode 120000 index a9494860..00000000 --- a/core/targets/stage32-opensuse/xorg +++ /dev/null @@ -1 +0,0 @@ -../../modules/xorg
\ No newline at end of file diff --git a/core/targets/stage32-scientific/alsa b/core/targets/stage32-scientific/alsa deleted file mode 120000 index 7e13d263..00000000 --- a/core/targets/stage32-scientific/alsa +++ /dev/null @@ -1 +0,0 @@ -../../modules/alsa
\ No newline at end of file diff --git a/core/targets/stage32-scientific/cpugovernor b/core/targets/stage32-scientific/cpugovernor deleted file mode 120000 index 544c1e19..00000000 --- a/core/targets/stage32-scientific/cpugovernor +++ /dev/null @@ -1 +0,0 @@ -../../modules/cpugovernor
\ No newline at end of file diff --git a/core/targets/stage32-scientific/dbus b/core/targets/stage32-scientific/dbus deleted file mode 120000 index dd148715..00000000 --- a/core/targets/stage32-scientific/dbus +++ /dev/null @@ -1 +0,0 @@ -../../modules/dbus
\ No newline at end of file diff --git a/core/targets/stage32-scientific/debug b/core/targets/stage32-scientific/debug deleted file mode 120000 index c05237d6..00000000 --- a/core/targets/stage32-scientific/debug +++ /dev/null @@ -1 +0,0 @@ -../../modules/debug
\ No newline at end of file diff --git a/core/targets/stage32-scientific/german b/core/targets/stage32-scientific/german deleted file mode 120000 index 4469f96e..00000000 --- a/core/targets/stage32-scientific/german +++ /dev/null @@ -1 +0,0 @@ -../../modules/german
\ No newline at end of file diff --git a/core/targets/stage32-scientific/kdm b/core/targets/stage32-scientific/kdm deleted file mode 120000 index 727ed5b5..00000000 --- a/core/targets/stage32-scientific/kdm +++ /dev/null @@ -1 +0,0 @@ -../../modules/kdm
\ No newline at end of file diff --git a/core/targets/stage32-scientific/kernel b/core/targets/stage32-scientific/kernel deleted file mode 120000 index 044f086d..00000000 --- a/core/targets/stage32-scientific/kernel +++ /dev/null @@ -1 +0,0 @@ -../../modules/kernel
\ No newline at end of file diff --git a/core/targets/stage32-scientific/nscd b/core/targets/stage32-scientific/nscd deleted file mode 120000 index d7e411d2..00000000 --- a/core/targets/stage32-scientific/nscd +++ /dev/null @@ -1 +0,0 @@ -../../modules/nscd
\ No newline at end of file diff --git a/core/targets/stage32-scientific/openbox b/core/targets/stage32-scientific/openbox deleted file mode 120000 index 0fb8d86d..00000000 --- a/core/targets/stage32-scientific/openbox +++ /dev/null @@ -1 +0,0 @@ -../../modules/openbox
\ No newline at end of file diff --git a/core/targets/stage32-scientific/pam b/core/targets/stage32-scientific/pam deleted file mode 120000 index 588acdbf..00000000 --- a/core/targets/stage32-scientific/pam +++ /dev/null @@ -1 +0,0 @@ -../../modules/pam
\ No newline at end of file diff --git a/core/targets/stage32-scientific/policykit b/core/targets/stage32-scientific/policykit deleted file mode 120000 index 39b77c7f..00000000 --- a/core/targets/stage32-scientific/policykit +++ /dev/null @@ -1 +0,0 @@ -../../modules/policykit
\ No newline at end of file diff --git a/core/targets/stage32-scientific/rootfs-stage32 b/core/targets/stage32-scientific/rootfs-stage32 deleted file mode 120000 index 96dcbb86..00000000 --- a/core/targets/stage32-scientific/rootfs-stage32 +++ /dev/null @@ -1 +0,0 @@ -../../rootfs/rootfs-stage32
\ No newline at end of file diff --git a/core/targets/stage32-scientific/rsyslogd b/core/targets/stage32-scientific/rsyslogd deleted file mode 120000 index 339d02f8..00000000 --- a/core/targets/stage32-scientific/rsyslogd +++ /dev/null @@ -1 +0,0 @@ -../../modules/rsyslogd
\ No newline at end of file diff --git a/core/targets/stage32-scientific/sshd b/core/targets/stage32-scientific/sshd deleted file mode 120000 index 56b4e4b5..00000000 --- a/core/targets/stage32-scientific/sshd +++ /dev/null @@ -1 +0,0 @@ -../../modules/sshd
\ No newline at end of file diff --git a/core/targets/stage32-scientific/systemd b/core/targets/stage32-scientific/systemd deleted file mode 120000 index 2dc58bd3..00000000 --- a/core/targets/stage32-scientific/systemd +++ /dev/null @@ -1 +0,0 @@ -../../modules/systemd
\ No newline at end of file diff --git a/core/targets/stage32-scientific/vmchooser b/core/targets/stage32-scientific/vmchooser deleted file mode 120000 index d918fbdc..00000000 --- a/core/targets/stage32-scientific/vmchooser +++ /dev/null @@ -1 +0,0 @@ -../../modules/vmchooser
\ No newline at end of file diff --git a/core/targets/stage32-scientific/vmplayer b/core/targets/stage32-scientific/vmplayer deleted file mode 120000 index 9303aa6a..00000000 --- a/core/targets/stage32-scientific/vmplayer +++ /dev/null @@ -1 +0,0 @@ -../../modules/vmplayer
\ No newline at end of file diff --git a/core/targets/stage32-scientific/xorg b/core/targets/stage32-scientific/xorg deleted file mode 120000 index a9494860..00000000 --- a/core/targets/stage32-scientific/xorg +++ /dev/null @@ -1 +0,0 @@ -../../modules/xorg
\ No newline at end of file diff --git a/core/targets/stage32/consolekit b/core/targets/stage32/consolekit deleted file mode 120000 index 261968c7..00000000 --- a/core/targets/stage32/consolekit +++ /dev/null @@ -1 +0,0 @@ -../../modules/consolekit
\ No newline at end of file diff --git a/core/targets/stage32/dmidecode b/core/targets/stage32/dmidecode new file mode 120000 index 00000000..608c2bb5 --- /dev/null +++ b/core/targets/stage32/dmidecode @@ -0,0 +1 @@ +../../modules/dmidecode
\ No newline at end of file diff --git a/core/targets/stage32/sssd b/core/targets/stage32/sssd new file mode 120000 index 00000000..753208d8 --- /dev/null +++ b/core/targets/stage32/sssd @@ -0,0 +1 @@ +../../modules/sssd
\ No newline at end of file diff --git a/core/targets/stage32/vmchooser b/core/targets/stage32/vmchooser deleted file mode 120000 index d918fbdc..00000000 --- a/core/targets/stage32/vmchooser +++ /dev/null @@ -1 +0,0 @@ -../../modules/vmchooser
\ No newline at end of file diff --git a/core/targets/vbox/kernel b/core/targets/vbox/kernel new file mode 120000 index 00000000..1369e8ff --- /dev/null +++ b/core/targets/vbox/kernel @@ -0,0 +1 @@ +../../modules/kernel-vanilla
\ No newline at end of file diff --git a/core/targets/vbox/vbox b/core/targets/vbox/vbox index 78b3e385..c0ee823e 120000 --- a/core/targets/vbox/vbox +++ b/core/targets/vbox/vbox @@ -1 +1 @@ -../../modules/vbox
\ No newline at end of file +../../modules/vbox-src
\ No newline at end of file diff --git a/data/kernel.wanted.config b/data/kernel.wanted.config index d3ffab9b..490c916a 100644 --- a/data/kernel.wanted.config +++ b/data/kernel.wanted.config @@ -53,7 +53,7 @@ CONFIG_DL2K=y CONFIG_DM9102=y CONFIG_DNET=y CONFIG_DRM=y -CONFIG_DRM_AST=n +CONFIG_DRM_AST=m CONFIG_DRM_CIRRUS_QEMU=m CONFIG_DRM_GMA3600=y CONFIG_DRM_GMA500=m @@ -230,6 +230,9 @@ CONFIG_VGA_SWITCHEROO=y CONFIG_VIA_RHINE=y CONFIG_VIA_RHINE_MMIO=y CONFIG_VIA_VELOCITY=y +CONFIG_VIRTIO_BLK=y +CONFIG_VIRTIO_BLK_SCSI=y +CONFIG_VIRTIO_NET=y CONFIG_VMXNET3=y CONFIG_VORTEX=y CONFIG_VXGE=y @@ -245,4 +248,34 @@ CONFIG_IP_NF_NAT=y CONFIG_IP_NF_FILTER=y CONFIG_IP_NF_MANGLE=y CONFIG_NF_NAT_MASQUERADE_IPV4=y +CONFIG_INTEL_IOMMU_DEFAULT_ON=y +CONFIG_ALLOW_LOCKDOWN_LIFT=y +CONFIG_ARCH_HAS_MMIO_FLUSH=y +CONFIG_ARCH_WANT_FRAME_POINTERS=y +CONFIG_BCMGENET=y +CONFIG_BLK_CPQ_CISS_DA=m +CONFIG_CISS_SCSI_TAPE=y +CONFIG_DRM_KMS_HELPER=y +CONFIG_EFI_ALLOW_SECURE_BOOT_EXIT=y +CONFIG_EFI_SECURE_BOOT_LOCK_DOWN=y +CONFIG_EFI_SIGNATURE_LIST_PARSER=y +CONFIG_HIO=y +CONFIG_I2C_MUX_PINCTRL=m +CONFIG_IGB_DCA=y +CONFIG_IRQ_SIM=n +CONFIG_IXGBE_DCA=y +CONFIG_MEDIA_RC_SUPPORT=y +CONFIG_ORC_UNWINDER=y +CONFIG_ROCKCHIP_PHY=y +CONFIG_SECURITY_NO_EXCLUSIVE_LSM=y +CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y +CONFIG_SFC_MTD=y +CONFIG_VERSION_SIGNATURE="2017-12-22 Config" +CONFIG_X86_5LEVEL=n +CONFIG_ZRAM=m +CONFIG_SPI_INTEL_SPI_PLATFORM=n +CONFIG_CIFS=m +CONFIG_CIFS_DFS_UPCALL=y +CONFIG_CIFS_SMB2=y +CONFIG_CIFS_SMB311=y @@ -103,7 +103,7 @@ check_devtools() { # Checking for needed development tools, compilers etc. # Required: m4 make gcc g++ binutils # no qmake here, qmake (libqt4-devel) should be installed in a module! - local DEV_TOOLS="gcc g++ make cmake m4 strip git depmod patch pkg-config" # 'strip' as marker for binutils + local DEV_TOOLS="gcc g++ make cmake m4 strip git depmod patch pkg-config automake autoconf aclocal" # 'strip' as marker for binutils # DEV_CHECK marks missing dev-tools local DEV_TOOLS_MISSING="" @@ -117,7 +117,7 @@ check_devtools() { pinfo "For $SYS_DISTRIBUTION you probably need to run:" case $SYS_DISTRIBUTION in ubuntu | debian) - pinfo "apt-get install build-essential m4 squashfs-tools pkg-config cmake" + pinfo "apt-get install build-essential m4 squashfs-tools pkg-config cmake automake autoconf" pinfo "to install missing development tools." ;; # FIXME: Don't know how precise this filter works so we might want to have a better matching ... |