From eec5e1576e70d27caa639f36e34679ed18817458 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 8 Jul 2021 16:05:57 +0200 Subject: Add installer mode for stage4 --- core/bin/setup_target | 64 ++++++- core/includes/useradd.inc | 196 ++++++++++++--------- .../data/opt/openslx/scripts/alsa-default_card | 7 +- .../vmchooser/sessionstart.d/default-sound-volume | 15 ++ core/modules/busybox/module.build | 10 +- core/modules/busybox/module.conf | 3 +- core/modules/cron/module.conf | 3 + core/modules/distro-logo/module.build | 1 + .../opt/openslx/scripts/systemd-setup_dnbd3_proxy | 18 ++ core/modules/dnbd3-proxy-mode/module.build | 4 +- core/modules/dnbd3/module.build | 2 +- core/modules/idleaction/module.conf | 3 + core/modules/iptables-helper/module.conf | 1 + core/modules/kdm-theme-bwlp/module.build | 2 +- core/modules/kdm-theme-bwlp/module.conf | 5 +- core/modules/kernel-vanilla/module.build | 16 +- .../basic.target.wants/enable-kexec-reboot.service | 1 - .../data/etc/systemd/system/ctrl-alt-del.target | 1 + .../etc/systemd/system/enable-kexec-reboot.service | 7 - .../data/opt/openslx/scripts/systemd-kexec_load | 6 +- core/modules/kiosk-chromium/module.conf.ubuntu | 5 +- .../lightdm/data/etc/X11/default-display-manager | 1 + core/modules/lightdm/module.build | 7 +- .../network-online.target.d/00-slx-targets.conf | 3 +- core/modules/nvidia-libs/module.build | 8 + core/modules/pam-bwidm/module.conf | 3 + core/modules/pam-common-share/module.conf | 3 + core/modules/pam/data/etc/profile.d/00-user-env.sh | 14 ++ core/modules/pam/module.conf | 3 + core/modules/polkit/module.build | 2 +- .../openslx/scripts/systemd-printergui_preparation | 2 +- core/modules/printergui/module.conf | 3 + core/modules/redsocks/module.build | 2 +- .../data/etc/systemd/system/run-virt-env.service | 5 +- .../run-virt/data/etc/tmpfiles.d/openslx-log.conf | 1 + .../data/opt/openslx/scripts/systemd-run_virt_env | 6 + .../safe-mode/data/etc/systemd/system/exam.service | 3 +- .../etc/systemd/system/update-etc_issue.service | 2 +- .../sshd/data/etc/systemd/system/sshd.service | 2 + core/modules/systemd/module.build | 4 +- .../lightdm/lightdm.conf.d/00-slx-xsessions.conf | 2 + .../opt/openslx/bin/vmware-get-supported-version | 3 + core/modules/vmware12/data/addon-required | 19 ++ .../modules/vmware12/data/opt/openslx/bin/vmplayer | 5 +- core/modules/vmware15/data/addon-required | 19 ++ core/modules/vmware15/module.build | 3 - core/modules/vmware16/data/addon-required | 19 ++ mltk | 26 +-- 48 files changed, 390 insertions(+), 150 deletions(-) create mode 100755 core/modules/alsa/data/opt/openslx/vmchooser/sessionstart.d/default-sound-volume delete mode 120000 core/modules/kexec-reboot/data/etc/systemd/system/basic.target.wants/enable-kexec-reboot.service create mode 120000 core/modules/kexec-reboot/data/etc/systemd/system/ctrl-alt-del.target delete mode 100644 core/modules/kexec-reboot/data/etc/systemd/system/enable-kexec-reboot.service create mode 100644 core/modules/lightdm/data/etc/X11/default-display-manager create mode 100644 core/modules/pam/data/etc/profile.d/00-user-env.sh create mode 100644 core/modules/run-virt/data/etc/tmpfiles.d/openslx-log.conf create mode 100644 core/modules/vmchooser2/data/etc/lightdm/lightdm.conf.d/00-slx-xsessions.conf create mode 100644 core/modules/vmware12/data/addon-required create mode 100644 core/modules/vmware15/data/addon-required create mode 100644 core/modules/vmware16/data/addon-required diff --git a/core/bin/setup_target b/core/bin/setup_target index ae96b691..7a343055 100755 --- a/core/bin/setup_target +++ b/core/bin/setup_target @@ -552,13 +552,65 @@ process_module() { post_process_target() { local TOOL_STR="$TOOL_STR post_process_target:" - # figure out all relevant ld-paths - pinfo "Running ldconfig" - cp -r -L /etc/ld.so.conf* "${TARGET_BUILD_DIR}/etc/" - ldconfig -v -r "${TARGET_BUILD_DIR}" + if [ -z "$REMOTE_LOCAL_INSTALL" ]; then + # traditional minilinux approach + # figure out all relevant ld-paths + pinfo "Running ldconfig" + cp -r -L /etc/ld.so.conf* "${TARGET_BUILD_DIR}/etc/" + ldconfig -v -r "${TARGET_BUILD_DIR}" + + # run depmod to generate the final modules.* files + depmod -b "${TARGET_BUILD_DIR}" -a "${TARGET_KERNEL_LONG}" + return 0 + fi - # run depmod to generate the final modules.* files - depmod -b "${TARGET_BUILD_DIR}" -a "${TARGET_KERNEL_LONG}" + # Installer mode + local RSYNC_DEST RSYNC_EXCLUDE_LIST entry filelist target_file system_file + # default dest and exclude list for non-addons + RSYNC_DEST='/' + RSYNC_EXCLUDE_LIST="$( mktemp )" + # always exclude ld.so.cache, we handle that separately + echo 'etc/ld.so*' > "$RSYNC_EXCLUDE_LIST" + echo 'autoexec.bat' >> "$RSYNC_EXCLUDE_LIST" + if [ -e "${TARGET_DIR}/.addon" ]; then + # This is an addon, don't sync to / but to dedicated directory + RSYNC_DEST="/opt/openslx/addons/${TARGET_BUILD_DIR##*/}" + pinfo "Target is an addon, preparing install to '${RSYNC_DEST}'." + mkdir -p "${RSYNC_DEST}" || perror "Failed to mkdir '${RSYNC_DEST}'." + RSYNC_OPTS+=( "--delete" "--delete-excluded" ) + cde "$TARGET_BUILD_DIR" + readarray -t -d '' filelist < <( find . -not -type d -print0 ) + for entry in "${filelist[@]}"; do + # diff them to be sure they are the same? + system_file="${entry:1}" + target_file="${entry:2}" + if [ -e "$system_file" ] && cmp "$system_file" "$target_file"; then + echo "$target_file" >> "$RSYNC_EXCLUDE_LIST" + fi + done + cd - &> /dev/null + pinfo "Calling ldconfig on overlay'ed ${TARGET_BUILD_DIR##*/}..." + chroot_run "${TARGET_BUILD_DIR}" <<< "ldconfig" + if [ -f "${TARGET_BUILD_DIR}/etc/ld.so.cache" ]; then + mkdir -p "${TARGET_BUILD_DIR}/opt/openslx/etc" + mv -f -- "${TARGET_BUILD_DIR}/etc/ld.so.cache" \ + "${TARGET_BUILD_DIR}/opt/openslx/etc/${TARGET_BUILD_DIR##*/}.ld.so.cache" + pinfo "... generated cache at '${TARGET_BUILD_DIR}/opt/openslx/etc/${TARGET_BUILD_DIR##*/}.ld.so.cache'." + fi + fi + pinfo "Rsyncing local build of '${TARGET_BUILD_DIR}' to '${RSYNC_DEST}'..." + rsync -aAXv "${RSYNC_OPTS[@]}" \ + --exclude-from="${RSYNC_EXCLUDE_LIST}" \ + "${TARGET_BUILD_DIR}/" "${RSYNC_DEST}" || \ + perror "Failed to rsync, your system is probably trashed ;-(" + + [ "$REMOTE_DEBUG" -eq 0 ] && rm -f -- "$RSYNC_EXCLUDE_LIST" + + # finish by running ldconfig for the running system (when processing non-addons). + if [ ! -e "${TARGET_DIR}/.addon" ]; then + ldconfig -v + depmod -a "${TARGET_KERNEL_LONG}" + fi } clean_modules() { diff --git a/core/includes/useradd.inc b/core/includes/useradd.inc index 47e74e79..46b680d8 100644 --- a/core/includes/useradd.inc +++ b/core/includes/useradd.inc @@ -46,6 +46,13 @@ get_gid_for_user() echo ${_GID} } +get_gid_for_group() { + [ $# -ne 1 ] && perror "get_gid_for_group fail. want 1 argument." + [ -z "${_GROUP}" ] && perror "group file not set." + local _GID=$(grep -E "^$1:[^:]*:[0-9]+:" "${_GROUP}" | head -1 | awk -F ':' '{print $3}') + echo ${_GID} +} + # Echo group name of given gid, nothing if non-existent get_group_for_gid() { @@ -78,26 +85,42 @@ generate_gid() echo ${_GID} } +add_system_user() { + SYSTEM_ENTITY="yes" add_user $@ +} + add_user() { [ -z "${TARGET_BUILD_DIR}" ] && perror "add_user: TARGET_BUILD_DIR not set" - if [ -z "${USER}" -a $# -eq 0 ] - then + if [ -z "${USER}" -a $# -eq 0 ]; then pwarning " ** add_user usage **" pwarning "add_user " pwarning "OR" pwarning "USER= [GROUP=] [USERID=] [GROUPID=] [USERHOME=] [USERSHELL=] [PASSWORD=] add_user" perror "Aborting, please fix your script." fi - local _PASSWD=${TARGET_BUILD_DIR}/etc/passwd - local _GROUP=${TARGET_BUILD_DIR}/etc/group - local _SHADOW=${TARGET_BUILD_DIR}/etc/shadow - init_users_and_groups - [ ! -f "${_PASSWD}" ] && perror "add_user: password file does not exist in target system. (build base first)" - [ ! -f "${_GROUP}" ] && perror "add_user: group file does not exist in target system. (build base first)" - [ ! -f "${_SHADOW}" ] && perror "add_user: shadow file does not exist in target system. (build base first)" - if [ "x$1" != "x" ] - then - local USER=$1 + + # In install mode, only work on the system's files directly and do *not* copy to TARGET_BUILD_DIR + declare -a _USERADD_OPTS + if [ "$REMOTE_LOCAL_INSTALL" -eq 0 ]; then + # regular mltk mode, copy the current user-related files to TARGET_BUILD_DIR + local _PASSWD="${TARGET_BUILD_DIR}/etc/passwd" + local _GROUP="${TARGET_BUILD_DIR}/etc/group" + local _SHADOW="${TARGET_BUILD_DIR}/etc/shadow" + init_users_and_groups + [ ! -f "${_PASSWD}" ] && perror "add_user: password file does not exist in target system. (build base first)" + [ ! -f "${_GROUP}" ] && perror "add_user: group file does not exist in target system. (build base first)" + [ ! -f "${_SHADOW}" ] && perror "add_user: shadow file does not exist in target system. (build base first)" + + # also add the --root options + _USERADD_OPTS+=("--root" "$TARGET_BUILD_DIR") + else + local _PASSWD="/etc/passwd" + local _GROUP="/etc/group" + local _SHADOW="/etc/shadow" + fi + + if [ "x$1" != "x" ]; then + local USER="$1" local GROUP="" local USERID="" local GROUPID="" @@ -105,106 +128,102 @@ add_user() { local USERSHELL="" local PASSWORD="" fi + USER=$(trim "$USER") if ! [[ $USER =~ $NAME_REGEX ]]; then perror "Invalid username: $USER" fi - [ -z "$GROUPID" ] && local GROUPID=$(get_gid_for_user "${USER}") - [ -z "$GROUP" -a -n "$GROUPID" ] && local GROUP=$(get_group_for_gid "${GROUPID}") - [ -z "$GROUP" ] && local GROUP=$USER - GROUP=$(trim "$GROUP") - if ! [[ $GROUP =~ $NAME_REGEX ]]; then - perror "Invalid group: $GROUP" - fi - [ "x$USERID" = "x" ] && local USERID=$(generate_uid "${USER}") - USERID=$(trim "$USERID") - [ "$USERID" -lt "0" -o "$USERID" -gt "65535" ] && perror "Invalid userid: $USERID" - [ -z "$GROUPID" ] && local GROUPID=$(generate_gid "${GROUP}" "${USERID}") - GROUPID=$(trim "$GROUPID") - [ "$GROUPID" -lt "0" -o "$GROUPID" -gt "65535" ] && perror "Invalid groupid: $GROUPID" - # all required variables have been set - # does the desired username already exist? if so, check if UID matches, otherwise bail out - local _UID=$(grep -E "^${USER}:[^:]*:[0-9]+:" "${_PASSWD}" | head -1 | awk -F ':' '{print $3}') - [ -n "${_UID}" ] && [ "x${_UID}" != "x${USERID}" ] && perror "User ${USER}(${USERID}) already exists with UID ${_UID}" - # do the same for the group - local _GID=$(grep -E "^${GROUP}:[^:]*:[0-9]+:" "${_GROUP}" | head -1 | awk -F ':' '{print $3}') - [ -n "${_GID}" ] && [ "x${_GID}" != "x${GROUPID}" ] && perror "Group ${GROUP}(${GROUPID}) already exists with GID ${_GID}" - # if user already exists, check if he is in another group than the one requested. if so, bail out - # (TODO: don't bail out and add user to the new group) - if [ ! -z "${_UID}" ] - then - local _EXGID=$(grep -E "^${USER}:[^:]*:[0-9]+:" "${_PASSWD}" | head -1 | awk -F ':' '{print $4}') - [ "x${GROUPID}" != "x${_EXGID}" ] && perror "Requested GID $GROUPID differs from existing GID $_EXGID" + + [ -z "$USERID" ] && local USERID="$(generate_uid "${USER}")" + [ -z "$USERID" ] && perror "add_user: could not generate a user id for $USER" + [ -n "$USERID" ] && _USERADD_OPTS+=("--uid" "$USERID") + if [ -z "$GROUP" ]; then + [ -z "$GROUPID" ] && local GROUPID=$(get_gid_for_user "${USER}") + [ -n "$GROUPID" ] && local GROUP=$(get_group_for_gid "${GROUPID}") + [ -z "$GROUP" ] && local GROUP="$USER" fi - # if user does not exist, try to add it - if [ -z "${_UID}" ] - then - local _TEST=$(grep -E "^[^:]+:[^:]*:${USERID}:" "${_PASSWD}") - [ -n "${_TEST}" ] && perror "Cannot add $USER - desired UID $USERID already in use." + + if [ -n "$GROUP" ]; then + GROUP=$(trim "$GROUP") + if ! [[ $GROUP =~ $NAME_REGEX ]]; then + perror "Invalid group: $GROUP" + fi + # swallow stdout output since only user id is expected to be echo'ed + add_group "$GROUP" "$GROUPID" >/dev/null 2>&1 + _USERADD_OPTS+=("--no-user-group" "--gid" "$GROUP") fi - if [ -z "${_GID}" ] - then - local _TEST=$(grep -E "^[^:]+:[^:]*:${GROUPID}:" "${_GROUP}") - [ -n "${_TEST}" ] && perror "Cannot add $GROUP - desired GID $GROUPID already in use." + + if [ -z "${USERHOME}" ]; then + local USERHOME=/nonexistent + else + _USERADD_OPTS+=("--create-home") + # make sure the parent directory exists + if [ "$REMOTE_LOCAL_INSTALL" -eq 0 ]; then + _udir="${TARGET_BUILD_DIR}/${USERHOME}" + else + _udir="$USERHOME" + fi + mkdir -p "${_udir%/*}" + fi - [ -z "${USERHOME}" ] && local USERHOME=/nonexistent + _USERADD_OPTS+=("--home-dir" "$USERHOME") + [ -z "${USERSHELL}" ] && local USERSHELL=/bin/false + _USERADD_OPTS+=("--shell" "$USERSHELL") + # create password - if [ -z "${PASSWORD}" ] - then - local PASSWORD='*' - else + if [ -n "${PASSWORD}" ]; then pdebug "Hashing password '$PASSWORD' for '$USER'" local PW=$(mkpasswd -m sha-512 "${PASSWORD}") [ -z "${PW}" ] && PW=$(openssl passwd -1 "${PASSWORD}") [ -z "${PW}" ] && perror "Error generating hashed password for $USER" PASSWORD=$PW fi - # add user, or replace password - if [ -z "${_UID}" ]; then - # create user - echo "${USER}:x:${USERID}:${GROUPID}:${USER}:${USERHOME}:${USERSHELL}" >> "${_PASSWD}" - echo "${USER}:${PASSWORD}:15555:0:99999:7:::" >> "${_SHADOW}" - pinfo "Created user $USER" - elif [ "$PASSWORD" != "*" ]; then - # update user's password - sed -i -r "s#^${USER}:[^:]*:(.*)\$"'#'"${USER}:${PASSWORD}:\1#g" "${_SHADOW}" - pinfo "Updated password of $USER" - fi - [ -z "${_GID}" ] && pinfo "Created group $GROUP" && echo "${GROUP}:x:${GROUPID}:" >> "${_GROUP}" + _USERADD_OPTS+=("--password" "${PASSWORD:-*}") + + [ -n "$SYSTEM_ENTITY" ] && _USERADD_OPTS+=("--system") + # everything is ready, run useradd + useradd "${_USERADD_OPTS[@]}" "$USER" >/dev/null 2>&1 + local ret=$? + [ "$ret" -ne 0 -a "$ret" -ne 9 ] && perror "add_user: useradd failed for: ${_USERADD_OPTS[@]} $USER" echo "${USERID}" } +add_system_group() { + SYSTEM_ENTITY="yes" add_group $@ +} + add_group () { [ $# -lt 1 ] && perror "add_group called without argument." [ -z "${TARGET_BUILD_DIR}" ] && perror "add_group: TARGET_BUILD_DIR not set" - local _PASSWD=${TARGET_BUILD_DIR}/etc/passwd - local _GROUP=${TARGET_BUILD_DIR}/etc/group - local _SHADOW=${TARGET_BUILD_DIR}/etc/shadow - init_users_and_groups - [ ! -f "${_GROUP}" ] && perror "add_user: group file does not exist in target system. (build base first)" - local GROUP=$1 - local GROUPID="-" - if ! [[ $GROUP =~ $NAME_REGEX ]]; then - perror "Invalid group: $GROUP" - fi - [ $# -ge 2 ] && [ ! -z "$2" ] && GROUPID=$2 - local _GID=$(grep -E "^${GROUP}:[^:]*:[0-9]+:" "${_GROUP}" | head -1 | awk -F ':' '{print $3}') - [ "x${_GID}" != "x" ] && [ "x$GROUPID" = "x-" -o "x$GROUPID" = "x${_GID}" ] && echo "${_GID}" && return # nothing to do, already exists - [ "x${_GID}" != "x" ] && perror "Group $GROUP already exists with GID ${_GID}, but creation was requested with GID $GROUPID" - if [ "x$GROUPID" = "x-" ]; then - local _UID=$(grep -E "^${GROUP}:[^:]*:[0-9]+:" "${_PASSWD}" | head -1 | awk -F ':' '{print $3}') - [ -z "${_UID}" ] && _UID=100 - GROUPID=$(generate_gid "$GROUP" "${_UID}") - fi - if ! [[ $GROUPID =~ [0-9]+ ]]; then - perror "add_group: GROUPID not numeric (is '$GROUPID')" + declare -a _GROUPADD_OPTS + if [ "$REMOTE_LOCAL_INSTALL" -eq 0 ]; then + # regular mltk mode, copy the current user-related files to TARGET_BUILD_DIR + local _PASSWD=${TARGET_BUILD_DIR}/etc/passwd + local _GROUP=${TARGET_BUILD_DIR}/etc/group + init_users_and_groups + [ ! -f "${_PASSWD}" ] && perror "add_user: passwd file does not exist in target system. (build base first)" + [ ! -f "${_GROUP}" ] && perror "add_user: group file does not exist in target system. (build base first)" + + # also add the --root options + _GROUPADD_OPTS+=("--root" "$TARGET_BUILD_DIR") + else + local _PASSWD=/etc/passwd + local _GROUP=/etc/group fi - echo "${GROUP}:x:${GROUPID}:" >> "${_GROUP}" - pinfo "Created group $GROUP" + local GROUP=$1 + local GROUPID="" + [[ $GROUP =~ $NAME_REGEX ]] || perror "Invalid group: $GROUP" + [ $# -ge 2 ] && [ -n "$2" ] && _GROUPADD_OPTS+=("--gid" "$2") + [ -n "$SYSTEM_ENTITY" ] && _GROUPADD_OPTS+=("--system") + groupadd "${_GROUPADD_OPTS[@]}" "$GROUP" >/dev/null 2>&1 + local ret=$? + [ "$ret" -ne 0 -a "$ret" -ne 9 ] && perror "add_group: groupadd failed: ${_GROUPADD_OPTS[@]}" + [ -z "$GROUPID" ] && local GROUPID="$(get_gid_for_group "$GROUP")" echo "${GROUPID}" } + init_users_and_groups() { [ -z "$TARGET_BUILD_DIR" -o "$TARGET_BUILD_DIR" == "/" ] && perror "Almost wrecked your local passwd, group and shadow file. phew." local USER @@ -236,5 +255,8 @@ init_users_and_groups() { mv "${PASSWD}.tmp" "${PASSWD}" # generate fresh shadow file awk -F ':' '{print $1":*:15555:0:99999:7:::"}' "${PASSWD}" > "${SHADOW}" + # all user-related tools that support "--root" option require nss libs in the + # chroot target, thus we need to copy the libs over there. + tarcopy "$(find /lib /lib64 /usr/lib /usr/lib64 -maxdepth 4 -name "libnss_files*")" "$TARGET_BUILD_DIR" } diff --git a/core/modules/alsa/data/opt/openslx/scripts/alsa-default_card b/core/modules/alsa/data/opt/openslx/scripts/alsa-default_card index 4e372f9c..976c5543 100755 --- a/core/modules/alsa/data/opt/openslx/scripts/alsa-default_card +++ b/core/modules/alsa/data/opt/openslx/scripts/alsa-default_card @@ -2,7 +2,12 @@ PROC="/proc/asound/pcm" -if [ ! -r "$PROC" ]; then +i=0 +while (( ++i < 10 )); do + [ -r "$PROC" ] && break + sleep 1 +done +if ! [ -r "$PROC" ]; then echo "'${PROC}' not found or not readable. Not setting default sound card." exit 0 fi diff --git a/core/modules/alsa/data/opt/openslx/vmchooser/sessionstart.d/default-sound-volume b/core/modules/alsa/data/opt/openslx/vmchooser/sessionstart.d/default-sound-volume new file mode 100755 index 00000000..2eaa7060 --- /dev/null +++ b/core/modules/alsa/data/opt/openslx/vmchooser/sessionstart.d/default-sound-volume @@ -0,0 +1,15 @@ +#!/bin/ash +# +# This hook evaluates the SLX_VM_SOUND configuration option +# and mutes the sound via ALSA if appropriate. This will only +# take effect in non-virtual sessions (determined by the +# env variable SESSION_TYPE given by vmchooser). + +if [ "$SESSION_TYPE" = "XSESSION" ]; then + . /opt/openslx/config + + if [ "$SLX_VM_SOUND" = "DEFAULT_MUTED" -o "$SLX_VM_SOUND" = "FORCE_MUTED" ]; then + amixer set Master mute + fi +fi +: # fake success to not trigger slxlog diff --git a/core/modules/busybox/module.build b/core/modules/busybox/module.build index 9b83e1e7..ae009259 100644 --- a/core/modules/busybox/module.build +++ b/core/modules/busybox/module.build @@ -34,8 +34,14 @@ build() { pinfo "Running make (if this hangs, check for unset options, ie. when you increased the REQUIRED_BRANCH)" make || perror "failed." pinfo "Running make install" - make CONFIG_PREFIX="$MODULE_BUILD_DIR" install || perror "failed" - rm -f "$MODULE_BUILD_DIR/bin/mount" "$MODULE_BUILD_DIR/bin/umount" "$MODULE_BUILD_DIR/bin/bash" + local INSTALL_PREFIX + if [ -n "$REMOTE_LOCAL_INSTALL" ]; then + INSTALL_PREFIX="${MODULE_BUILD_DIR}/opt/openslx" + else + INSTALL_PREFIX="${MODULE_BUILD_DIR}" + fi + make CONFIG_PREFIX="${INSTALL_PREFIX}" install || perror "failed" + rm -f "${INSTALL_PREFIX}/bin/mount" "${INSTALL_PREFIX}/bin/umount" "${INSTALL_PREFIX}/bin/bash" } post_copy() { diff --git a/core/modules/busybox/module.conf b/core/modules/busybox/module.conf index 265f53f3..6f29188b 100644 --- a/core/modules/busybox/module.conf +++ b/core/modules/busybox/module.conf @@ -3,6 +3,5 @@ REQUIRED_GIT="git://git.busybox.net/busybox" REQUIRED_BRANCH="1_31_1" REQUIRED_BINARIES="busybox" REQUIRED_DIRECTORIES=" - /bin - /sbin + / " diff --git a/core/modules/cron/module.conf b/core/modules/cron/module.conf index 31573eb0..33dcdcc3 100644 --- a/core/modules/cron/module.conf +++ b/core/modules/cron/module.conf @@ -1,4 +1,7 @@ #!/bin/bash +REQUIRED_MODULES=" + slx-log +" REQUIRED_GIT="https://github.com/cronie-crond/cronie.git" REQUIRED_COMMIT="d582556168e740fbd19e777a6733b404084e69d8" REQUIRED_BINARIES=" diff --git a/core/modules/distro-logo/module.build b/core/modules/distro-logo/module.build index 4e30667f..8c2813c8 100644 --- a/core/modules/distro-logo/module.build +++ b/core/modules/distro-logo/module.build @@ -13,6 +13,7 @@ post_copy() { local DIST=$(lsb_release -si) if [ -n "$DIST" ]; then [ -z "$CFG_DISTLOGO_URL" ] && CFG_DISTLOGO_URL='http://mltk-services.ruf.uni-freiburg.de/distro_logo.php?distro=' + mkdir -p "$TARGET_BUILD_DIR/etc" wget -t 3 -T 3 -O "$TARGET_BUILD_DIR/etc/distro.png" "${CFG_DISTLOGO_URL}${DIST}" if [ ! -s "$TARGET_BUILD_DIR/etc/distro.png" ]; then rm -f "$TARGET_BUILD_DIR/etc/distro.png" 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 index e45272a6..e44fc15a 100755 --- 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 @@ -283,6 +283,24 @@ if [ -n "$islocal" ]; then adduser dnbd3 fuse # Start service, is not symlinked when not in proxy mode systemctl --no-block start dnbd3-proxy.service + if [ -d /dev/dnbd0 ] && [ "$( cat /sys/block/dnbd0/net/rid )" -gt 0 ]; then + # give it some time to start + usleep 500000 + # add the server + if ! dnbd3-client -A "127.0.0.1:$DNBD3_PORT" -d /dev/dnbd0; then + echo "Cannot add localhost to dnbd0" >&2 + else + for i in 1 2 3 4 5 ""; do + echo | busybox timeout 1 busybox nc 127.0.0.1 "$DNBD3_PORT" && break + echo "port wait fail #$i" + [ -z "$i" ] && break + sleep 1 + done + if ! dnbd3-client -s "127.0.0.1:$DNBD3_PORT" -d /dev/dnbd0; then + echo "Cannot switch dnbd0 to localhost" >&2 + fi + fi + fi fi exit 0 diff --git a/core/modules/dnbd3-proxy-mode/module.build b/core/modules/dnbd3-proxy-mode/module.build index a2c0bd22..4ab661f9 100644 --- a/core/modules/dnbd3-proxy-mode/module.build +++ b/core/modules/dnbd3-proxy-mode/module.build @@ -8,6 +8,6 @@ build() { } post_copy() { - add_group "dnbd3" - USER="dnbd3" GROUP="dnbd3" add_user + add_system_group "dnbd3" + USER="dnbd3" GROUP="dnbd3" add_system_user } diff --git a/core/modules/dnbd3/module.build b/core/modules/dnbd3/module.build index 671bf120..1c877c8f 100644 --- a/core/modules/dnbd3/module.build +++ b/core/modules/dnbd3/module.build @@ -38,5 +38,5 @@ build() { } post_copy() { - : + add_system_group "fuse" } diff --git a/core/modules/idleaction/module.conf b/core/modules/idleaction/module.conf index 24d0a301..503a35a7 100644 --- a/core/modules/idleaction/module.conf +++ b/core/modules/idleaction/module.conf @@ -1,4 +1,7 @@ #!/bin/bash +REQUIRED_MODULES=" + slxlog +" REQUIRED_BINARIES=" idle-daemon xprintidle diff --git a/core/modules/iptables-helper/module.conf b/core/modules/iptables-helper/module.conf index 46eb4e93..2c41c13c 100644 --- a/core/modules/iptables-helper/module.conf +++ b/core/modules/iptables-helper/module.conf @@ -1,4 +1,5 @@ #!/bin/bash REQUIRED_MODULES=" + slxlog iptables " diff --git a/core/modules/kdm-theme-bwlp/module.build b/core/modules/kdm-theme-bwlp/module.build index 135bddfc..eb6f479b 100644 --- a/core/modules/kdm-theme-bwlp/module.build +++ b/core/modules/kdm-theme-bwlp/module.build @@ -8,7 +8,7 @@ build () { : } -post_copy() { +post_copy () { : } diff --git a/core/modules/kdm-theme-bwlp/module.conf b/core/modules/kdm-theme-bwlp/module.conf index b3907425..3bfd1cf4 100644 --- a/core/modules/kdm-theme-bwlp/module.conf +++ b/core/modules/kdm-theme-bwlp/module.conf @@ -1,3 +1,6 @@ #!/bin/bash -REQUIRED_MODULES="kdm" +REQUIRED_MODULES=" + distro-logo + kdm +" diff --git a/core/modules/kernel-vanilla/module.build b/core/modules/kernel-vanilla/module.build index a6a33f48..9e7b1ed3 100644 --- a/core/modules/kernel-vanilla/module.build +++ b/core/modules/kernel-vanilla/module.build @@ -34,13 +34,15 @@ fetch_source() { rm -rf "./ksrc" git clone --depth 1 "${REQUIRED_GIT}" -b "v${REQUIRED_KERNEL}" ksrc || perror "Could not clone kernel git." fi - # check for aufs - local RSL=$(find ksrc/ -type d -name aufs) - if [ -z "$RSL" ]; then - pinfo "aufs not found in kernel sources, patching it..." - patch_aufs - else - pinfo "aufs detected in kernel source :)" + if [ -z "$REMOTE_LOCAL_INSTALL" ]; then + # check for aufs + local RSL="$( find ksrc/ -type d -name aufs )" + if [ -z "$RSL" ]; then + pinfo "aufs not found in kernel sources, patching it..." + patch_aufs + else + pinfo "aufs detected in kernel source :)" + fi fi # Other patches local patch diff --git a/core/modules/kexec-reboot/data/etc/systemd/system/basic.target.wants/enable-kexec-reboot.service b/core/modules/kexec-reboot/data/etc/systemd/system/basic.target.wants/enable-kexec-reboot.service deleted file mode 120000 index 510ad25a..00000000 --- a/core/modules/kexec-reboot/data/etc/systemd/system/basic.target.wants/enable-kexec-reboot.service +++ /dev/null @@ -1 +0,0 @@ -../enable-kexec-reboot.service \ No newline at end of file diff --git a/core/modules/kexec-reboot/data/etc/systemd/system/ctrl-alt-del.target b/core/modules/kexec-reboot/data/etc/systemd/system/ctrl-alt-del.target new file mode 120000 index 00000000..b202bdcb --- /dev/null +++ b/core/modules/kexec-reboot/data/etc/systemd/system/ctrl-alt-del.target @@ -0,0 +1 @@ +/lib/systemd/system/kexec.target \ No newline at end of file diff --git a/core/modules/kexec-reboot/data/etc/systemd/system/enable-kexec-reboot.service b/core/modules/kexec-reboot/data/etc/systemd/system/enable-kexec-reboot.service deleted file mode 100644 index 9b0bf175..00000000 --- a/core/modules/kexec-reboot/data/etc/systemd/system/enable-kexec-reboot.service +++ /dev/null @@ -1,7 +0,0 @@ -[Unit] -Description=Enable kexec-reboot via ctrl-alt-del -DefaultDependencies=no - -[Service] -Type=oneshot -ExecStart=/bin/sh -c "rm -f /etc/systemd/system/ctrl-alt-del.target; systemctl enable kexec.target; exit 0" diff --git a/core/modules/kexec-reboot/data/opt/openslx/scripts/systemd-kexec_load b/core/modules/kexec-reboot/data/opt/openslx/scripts/systemd-kexec_load index c7dae7bc..27be324a 100755 --- a/core/modules/kexec-reboot/data/opt/openslx/scripts/systemd-kexec_load +++ b/core/modules/kexec-reboot/data/opt/openslx/scripts/systemd-kexec_load @@ -53,15 +53,15 @@ kexec_load() { if ! dl_long "${base}/boot/ipxe?type=bash&entryid=$ipxeId&uuid=$(cat /etc/system-uuid)" > "${tempdir}/bootentry"; then echo "Could not download iPXE menu entry, falling back..." else - local ip="$( ip addr show dev br0 | awk '{ if ($1 == "inet") { print $2; exit 0 }}' )" - local gateway="$( ip route show dev br0 | awk '{ if ($1 == "default") {print $3; exit 0 }}' )" + local ip="$( ip addr show dev $SLX_PXE_NETIF | awk '{ if ($1 == "inet") { print $2; exit 0 }}' )" + local gateway="$( ip route show dev $SLX_PXE_NETIF | awk '{ if ($1 == "default") {print $3; exit 0 }}' )" local dns="${SLX_DNS// /,}" local hostname="${SLX_HOSTNAME}" local domain="${SLX_NET_DOMAIN}" local dnssl="${SLX_NET_SEARCH// /,}" local mac="${SLX_PXE_MAC}" local ntpsrv="${SLX_NTP_SERVER// /,}" - [ -z "$mac" ] && mac="$( ip addr show dev br0 | awk '{ if ($1 == "link/ether") { print $2; exit 0 }}' )" + [ -z "$mac" ] && mac="$( ip addr show dev $SLX_PXE_NETIF | awk '{ if ($1 == "link/ether") { print $2; exit 0 }}' )" . "${tempdir}/bootentry" if [ -z "$kernel" ]; then echo "iPXE boot entry is missing kernel, falling back..." diff --git a/core/modules/kiosk-chromium/module.conf.ubuntu b/core/modules/kiosk-chromium/module.conf.ubuntu index f5d87627..7cb1575c 100644 --- a/core/modules/kiosk-chromium/module.conf.ubuntu +++ b/core/modules/kiosk-chromium/module.conf.ubuntu @@ -1,10 +1,13 @@ #!/bin/bash REQUIRED_CONTENT_PACKAGES=" + chromium-browser + chromium-browser-l10n + fonts-noto-color-emoji jq xbindkeys libnss3-tools " -REQUIRED_INSTALLED_PACKAGES="$REQUIRED_CONTENT_PACKAGES" +REQUIRED_INSTALLED_PACKAGES="" REQUIRED_BINARIES="" REQUIRED_LIBRARIES="" REQUIRED_DIRECTORIES="" diff --git a/core/modules/lightdm/data/etc/X11/default-display-manager b/core/modules/lightdm/data/etc/X11/default-display-manager new file mode 100644 index 00000000..7d4e29bb --- /dev/null +++ b/core/modules/lightdm/data/etc/X11/default-display-manager @@ -0,0 +1 @@ +/usr/sbin/lightdm diff --git a/core/modules/lightdm/module.build b/core/modules/lightdm/module.build index 656d71a9..340f6444 100644 --- a/core/modules/lightdm/module.build +++ b/core/modules/lightdm/module.build @@ -12,9 +12,10 @@ build() { post_copy() { mkdir -p "${TARGET_BUILD_DIR}/var/lib/lightdm"{,-data} - local LDMUID=$(add_user "lightdm") - local LDMGID=$(add_group "lightdm") + local LDMUID=$(add_system_user "lightdm") + local LDMGID=$(add_system_group "lightdm") pinfo "lightdm user and group is $LDMUID $LDMGID" - chown -R "${LDMUID}:${LDMGID}" "${TARGET_BUILD_DIR}/var/lib/lightdm/" || perror "chowning '${TARGET_BUILD_DIR}/var/lib/lightdm/' failed." + chown -R "${LDMUID}:${LDMGID}" "${TARGET_BUILD_DIR}/var/lib/lightdm/" \ + || perror "chowning '${TARGET_BUILD_DIR}/var/lib/lightdm/' failed." } diff --git a/core/modules/network-online-slx-targets/data/etc/systemd/system/network-online.target.d/00-slx-targets.conf b/core/modules/network-online-slx-targets/data/etc/systemd/system/network-online.target.d/00-slx-targets.conf index 898d20b1..81208043 100644 --- a/core/modules/network-online-slx-targets/data/etc/systemd/system/network-online.target.d/00-slx-targets.conf +++ b/core/modules/network-online-slx-targets/data/etc/systemd/system/network-online.target.d/00-slx-targets.conf @@ -1,3 +1,4 @@ [Unit] -Wants=network-gateway.target network-dns.target +Wants=network-gateway.target network-dns.target network.target Before=network-gateway.target network-dns.target +After=network.target diff --git a/core/modules/nvidia-libs/module.build b/core/modules/nvidia-libs/module.build index b35e6fd2..d2a5ee63 100644 --- a/core/modules/nvidia-libs/module.build +++ b/core/modules/nvidia-libs/module.build @@ -9,3 +9,11 @@ module_load() { MODULE_BUILD_DIR="$SRC" } +post_copy() { + # generate addon-required for this version + cat <<-EOF > "${TARGET_BUILD_DIR}/addon-required" + #!/bin/ash + [ "\$( cat /sys/module/nvidia/version )" = "$VERSION" ] + EOF + chmod +x "${TARGET_BUILD_DIR}/addon-required" +} diff --git a/core/modules/pam-bwidm/module.conf b/core/modules/pam-bwidm/module.conf index 237dd69c..c8a55dfb 100644 --- a/core/modules/pam-bwidm/module.conf +++ b/core/modules/pam-bwidm/module.conf @@ -1,3 +1,6 @@ #!/bin/bash +REQUIRED_MODULES=" + slxlog +" REQUIRED_BINARIES=" " diff --git a/core/modules/pam-common-share/module.conf b/core/modules/pam-common-share/module.conf index 8811668a..f20668f6 100644 --- a/core/modules/pam-common-share/module.conf +++ b/core/modules/pam-common-share/module.conf @@ -1,4 +1,7 @@ #!/bin/bash +REQUIRED_MODULES=" + slxlog +" REQUIRED_BINARIES="" REQUIRED_LIBRARIES="" REQUIRED_DIRECTORIES="" diff --git a/core/modules/pam/data/etc/profile.d/00-user-env.sh b/core/modules/pam/data/etc/profile.d/00-user-env.sh new file mode 100644 index 00000000..a2d10989 --- /dev/null +++ b/core/modules/pam/data/etc/profile.d/00-user-env.sh @@ -0,0 +1,14 @@ +#!/bin/ash + +# Stuff we might wanna know +PWENT= +[ -n "$UID" ] && PWENT=`getent passwd "$UID"` +[ -z "$PWENT" ] && [ -n "$PAM_USER" ] && PWENT=`getent passwd "$PAM_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 diff --git a/core/modules/pam/module.conf b/core/modules/pam/module.conf index 86b91b8d..7789139d 100644 --- a/core/modules/pam/module.conf +++ b/core/modules/pam/module.conf @@ -1,4 +1,7 @@ #!/bin/bash +REQUIRED_MODULES=" + slxlog +" REQUIRED_BINARIES=" ldapsearch rpc.gssd diff --git a/core/modules/polkit/module.build b/core/modules/polkit/module.build index b956f23c..b1e61f66 100644 --- a/core/modules/polkit/module.build +++ b/core/modules/polkit/module.build @@ -17,6 +17,6 @@ build () { post_copy() { #Add Polkit User/Group/Shadow to Stage3.2, required on opensuse pinfo "Adding polkitd user to target system..." - add_user "polkitd" + add_system_user "polkitd" } diff --git a/core/modules/printergui/data/opt/openslx/scripts/systemd-printergui_preparation b/core/modules/printergui/data/opt/openslx/scripts/systemd-printergui_preparation index 29971666..d130f470 100755 --- a/core/modules/printergui/data/opt/openslx/scripts/systemd-printergui_preparation +++ b/core/modules/printergui/data/opt/openslx/scripts/systemd-printergui_preparation @@ -13,7 +13,7 @@ mv -n "$SRCDIR"/* "$DESTDIR" cd "$SRCDIR" for i in "$DESTDIR"/*; do - ln -s "$PRINTPWGUI" $(basename "$i") + ln -sf "$PRINTPWGUI" $(basename "$i") done exit 0 diff --git a/core/modules/printergui/module.conf b/core/modules/printergui/module.conf index 2746168f..3875944b 100644 --- a/core/modules/printergui/module.conf +++ b/core/modules/printergui/module.conf @@ -1,4 +1,7 @@ #!/bin/bash +REQUIRED_MODULES=" + slxlog +" REQUIRED_GIT="git://git.openslx.org/openslx-ng/printergui.git" REQUIRED_COMMIT="HEAD" REQUIRED_BINARIES=" diff --git a/core/modules/redsocks/module.build b/core/modules/redsocks/module.build index 9dacd88b..b1298c9d 100644 --- a/core/modules/redsocks/module.build +++ b/core/modules/redsocks/module.build @@ -20,6 +20,6 @@ build () { } post_copy() { - add_user redsocks + add_system_user redsocks } diff --git a/core/modules/run-virt/data/etc/systemd/system/run-virt-env.service b/core/modules/run-virt/data/etc/systemd/system/run-virt-env.service index 88b76789..2c602076 100644 --- a/core/modules/run-virt/data/etc/systemd/system/run-virt-env.service +++ b/core/modules/run-virt/data/etc/systemd/system/run-virt-env.service @@ -1,8 +1,9 @@ [Unit] Description=Sets up the virtualization environment Before=graphical.target system-check.service -Wants=network-dns.target system-check.service -After=network-dns.target +After=systemd-tmpfiles-setup.service bridge-additional-nics.service +Wants=systemd-tmpfiles-setup.service system-check.service bridge-additional-nics.service +DefaultDependencies=no [Service] Type=oneshot diff --git a/core/modules/run-virt/data/etc/tmpfiles.d/openslx-log.conf b/core/modules/run-virt/data/etc/tmpfiles.d/openslx-log.conf new file mode 100644 index 00000000..4d93fb9c --- /dev/null +++ b/core/modules/run-virt/data/etc/tmpfiles.d/openslx-log.conf @@ -0,0 +1 @@ +d /var/log/openslx 0777 root root 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 6b79d0ec..526f69a6 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 @@ -195,6 +195,12 @@ getips () { } # read the DNS configuration and configure the udhcpd +getresolvconf() { + awk -vattr="$1" '$1 == attr {for (i=2; i<=NF; i++) printf "%s ",$i}' /etc/resolv.conf +} +[ -z "${SLX_DNS}" ] && SLX_DNS="$( getresolvconf nameserver )" +[ -z "${SLX_NET_DOMAIN}" ] && SLX_NET_DOMAIN="$( getresolvconf domain )" +[ -z "${SLX_NET_SEARCH}" ] && SLX_NET_SEARCH="$( getresolvconf search )" [ -z "${SLX_DNS}" ] && SLX_DNS="8.8.8.8 8.8.4.4" [ -z "${SLX_NET_DOMAIN}" ] && SLX_NET_DOMAIN="$FALLBACK_DOMAIN" [ -z "${SLX_NET_SEARCH}" ] && SLX_NET_SEARCH="$FALLBACK_DOMAIN" 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 14473a6f..646c8b36 100644 --- a/core/modules/safe-mode/data/etc/systemd/system/exam.service +++ b/core/modules/safe-mode/data/etc/systemd/system/exam.service @@ -1,7 +1,8 @@ [Unit] Description=Sets up safe mode (no magic keys, no tty switch, no openbox menu) DefaultDependencies=no -Before=graphical.target display-manager.target +Before=basic.target systemd-logind.service +After=systemd-sysctl.service [Service] Type=oneshot diff --git a/core/modules/slx-issue/data/etc/systemd/system/update-etc_issue.service b/core/modules/slx-issue/data/etc/systemd/system/update-etc_issue.service index bdfab085..1f040d6d 100644 --- a/core/modules/slx-issue/data/etc/systemd/system/update-etc_issue.service +++ b/core/modules/slx-issue/data/etc/systemd/system/update-etc_issue.service @@ -1,7 +1,7 @@ [Unit] Description=Update /etc/issue After=setup-partitions.service -Before=getty.target shutdown.target +Before=getty-pre.target getty.target shutdown.target DefaultDependencies=no [Service] diff --git a/core/modules/sshd/data/etc/systemd/system/sshd.service b/core/modules/sshd/data/etc/systemd/system/sshd.service index fc711808..999187cd 100644 --- a/core/modules/sshd/data/etc/systemd/system/sshd.service +++ b/core/modules/sshd/data/etc/systemd/system/sshd.service @@ -1,5 +1,7 @@ [Unit] Description=OpenSSH Daemon +Requires=systemd-tmpfiles-setup.service +After=systemd-tmpfiles-setup.service [Service] ExecStart=/usr/sbin/sshd -D diff --git a/core/modules/systemd/module.build b/core/modules/systemd/module.build index 2e11bcd7..3cca1928 100644 --- a/core/modules/systemd/module.build +++ b/core/modules/systemd/module.build @@ -96,7 +96,7 @@ build () { } post_copy() { - add_user "kvm" - add_user "systemd-journal-upload" + add_system_user "kvm" + add_system_user "systemd-journal-upload" } diff --git a/core/modules/vmchooser2/data/etc/lightdm/lightdm.conf.d/00-slx-xsessions.conf b/core/modules/vmchooser2/data/etc/lightdm/lightdm.conf.d/00-slx-xsessions.conf new file mode 100644 index 00000000..7ba5cd56 --- /dev/null +++ b/core/modules/vmchooser2/data/etc/lightdm/lightdm.conf.d/00-slx-xsessions.conf @@ -0,0 +1,2 @@ +[LightDM] +sessions-directory=/opt/openslx/xsessions diff --git a/core/modules/vmware-version-check/data/opt/openslx/bin/vmware-get-supported-version b/core/modules/vmware-version-check/data/opt/openslx/bin/vmware-get-supported-version index 887e995b..7d1190c5 100755 --- a/core/modules/vmware-version-check/data/opt/openslx/bin/vmware-get-supported-version +++ b/core/modules/vmware-version-check/data/opt/openslx/bin/vmware-get-supported-version @@ -2,6 +2,9 @@ # This script checks whether given VMware version supports the CPU: # * Intel: check for "VMX Unrestricted Guest" CPU flag # * AMD: check if CPU family is Bulldozer or newer +# +# It can be called inside a dracut context and tries to do +# chroot magic to call/load the required tools. VIRTTYPE="$( grep -m1 '^flags\s*:' /proc/cpuinfo | grep -woF -e svm -e vmx )" diff --git a/core/modules/vmware12/data/addon-required b/core/modules/vmware12/data/addon-required new file mode 100644 index 00000000..6261292c --- /dev/null +++ b/core/modules/vmware12/data/addon-required @@ -0,0 +1,19 @@ +#!/bin/bash + +# the vmware helper needs the kmod msr and the tool rdmsr, +# /dev, /sys and /proc to properly detect the CPU info. + +bindmount=("/dev" "/proc" "/sys") + +for bm in "${bindmount[@]}"; do + mount --bind "$bm" "${NEWROOT}/${bm}" +done + +export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin" +version="$(chroot "$NEWROOT" vmware-get-supported-version)" + +for bm in "${bindmount[@]}"; do + umount "${NEWROOT}/${bm}" +done + +[ -n "$version" ] && [ "$version" = "legacy" ] diff --git a/core/modules/vmware12/data/opt/openslx/bin/vmplayer b/core/modules/vmware12/data/opt/openslx/bin/vmplayer index f94c8794..afac3c94 100755 --- a/core/modules/vmware12/data/opt/openslx/bin/vmplayer +++ b/core/modules/vmware12/data/opt/openslx/bin/vmplayer @@ -9,7 +9,10 @@ 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}' ) +export LD_LIBRARY_PATH=$( \ + find /usr/lib/vmware/lib/ -maxdepth 1 -mindepth 1 -type d \ + | grep -v libfontconfig \ + | awk 'BEGIN{p=""}{p=p$0":"}END{print p}' ) exec "$PREFIX/lib/wrapper-gtk24.sh" \ "$PREFIX/lib" \ diff --git a/core/modules/vmware15/data/addon-required b/core/modules/vmware15/data/addon-required new file mode 100644 index 00000000..a86e41bc --- /dev/null +++ b/core/modules/vmware15/data/addon-required @@ -0,0 +1,19 @@ +#!/bin/bash + +# the vmware helper needs the kmod msr and the tool rdmsr, +# /dev, /sys and /proc to properly detect the CPU info. + +bindmount=("/dev" "/proc" "/sys") + +for bm in "${bindmount[@]}"; do + mount --bind "$bm" "${NEWROOT}/${bm}" +done + +export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin" +version="$(chroot "$NEWROOT" vmware-get-supported-version)" + +for bm in "${bindmount[@]}"; do + umount "${NEWROOT}/${bm}" +done + +[ -n "$version" ] && [ "$version" = "new" ] diff --git a/core/modules/vmware15/module.build b/core/modules/vmware15/module.build index c85754ad..f5e96f9c 100644 --- a/core/modules/vmware15/module.build +++ b/core/modules/vmware15/module.build @@ -185,9 +185,6 @@ post_copy() { "$guid" "${TARGET_BUILD_DIR}/usr/share/icons/hicolor/" done - # 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!" diff --git a/core/modules/vmware16/data/addon-required b/core/modules/vmware16/data/addon-required new file mode 100644 index 00000000..a86e41bc --- /dev/null +++ b/core/modules/vmware16/data/addon-required @@ -0,0 +1,19 @@ +#!/bin/bash + +# the vmware helper needs the kmod msr and the tool rdmsr, +# /dev, /sys and /proc to properly detect the CPU info. + +bindmount=("/dev" "/proc" "/sys") + +for bm in "${bindmount[@]}"; do + mount --bind "$bm" "${NEWROOT}/${bm}" +done + +export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin" +version="$(chroot "$NEWROOT" vmware-get-supported-version)" + +for bm in "${bindmount[@]}"; do + umount "${NEWROOT}/${bm}" +done + +[ -n "$version" ] && [ "$version" = "new" ] diff --git a/mltk b/mltk index 7e8159ad..061abe09 100755 --- a/mltk +++ b/mltk @@ -82,6 +82,7 @@ print_usage() { echo -e " -d activates debug output for the task (spamy)" echo -e " -b build module(s) and copy them to the target build directory" echo -e " -c clean build directory of module(s) and target dir" + echo -e " -i run in 'installer mode' for stage4 system" echo -e " -n bind mount all the local builds (var/builds) to /export/builds;" echo -e " the optional parameter name allows to change the default mount target" echo -e " -> /export/" @@ -106,7 +107,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 automake autoconf aclocal lsb_release strings wget rsync lsof" # 'strip' as marker for binutils + local DEV_TOOLS="gcc g++ make cmake m4 strip git depmod patch pkg-config automake autoconf aclocal lsb_release strings wget rsync lsof diff cmp" # 'strip' as marker for binutils # DEV_CHECK marks missing dev-tools local DEV_TOOLS_MISSING="" @@ -120,16 +121,16 @@ check_devtools() { pinfo "For $SYS_DISTRIBUTION you probably need to run:" case $SYS_DISTRIBUTION in ubuntu | debian) - pinfo "apt-get install build-essential m4 pkg-config cmake automake autoconf binutils lsb-release wget rsync" + pinfo "apt install build-essential m4 pkg-config cmake automake autoconf binutils lsb-release wget rsync diffutils" pinfo "to install missing development tools." ;; # FIXME: Don't know how precise this filter works so we might want to have a better matching ... opensuse) - pinfo "zypper install gcc gcc-c++ make m4 binutils git module-init-tools patch pkg-config cmake lsb-release wget rsync" + pinfo "zypper install gcc gcc-c++ make m4 binutils git module-init-tools patch pkg-config cmake lsb-release wget rsync diffutils" pinfo "to install missing development tools." ;; fedora | scientific | centos) - pinfo "yum install redhat-lsb gcc-c++ gcc make m4 binutils pkgconfig patch cmake lsb-release wget rsync" + pinfo "yum install redhat-lsb gcc-c++ gcc make m4 binutils pkgconfig patch cmake lsb-release wget rsync diffutils" ;; *) perror "No installation help for $SYS_DISTRIBUTION available." @@ -205,6 +206,10 @@ read_params() { REMOTE_EXPORT="1" continue ;; + -i) + REMOTE_LOCAL_INSTALL=1 + continue + ;; --force-sys-version) if [ -z "$1" ]; then perror "--force-sys-version requires an argument, e.g. '18.04'." @@ -234,15 +239,14 @@ read_params() { } run() { - if [[ $REMOTE_CLEAN == 1 || $REMOTE_BUILD == 1 || $REMOTE_EXPORT == 1 ]]; then - [[ $REMOTE_DEBUG == 1 ]] && unset_quiet || set_quiet - . "${REMOTE_SETUP_TARGET}" || perror "Cannot source ${REMOTE_SETUP_TARGET}" - [[ $REMOTE_CLEAN == 1 ]] && clean_modules $TARGET $REMOTE_LIST_CLEAN - [[ $REMOTE_BUILD == 1 ]] && generate_target $TARGET $REMOTE_LIST_BUILD - [[ $REMOTE_EXPORT == 1 ]] && export_builds - fi + [[ $REMOTE_DEBUG == 1 ]] && unset_quiet || set_quiet + . "${REMOTE_SETUP_TARGET}" || perror "Cannot source ${REMOTE_SETUP_TARGET}" + [[ $REMOTE_CLEAN == 1 ]] && clean_modules $TARGET $REMOTE_LIST_CLEAN + [[ $REMOTE_BUILD == 1 ]] && generate_target $TARGET $REMOTE_LIST_BUILD + [[ $REMOTE_EXPORT == 1 ]] && export_builds } +REMOTE_LOCAL_INSTALL= REMOTE_DEBUG="0" REMOTE_CLEAN="0" REMOTE_BUILD="0" -- cgit v1.2.3-55-g7522