diff options
198 files changed, 1162 insertions, 273 deletions
diff --git a/core/bin/setup_target b/core/bin/setup_target index 30fafbf5..667f590e 100755 --- a/core/bin/setup_target +++ b/core/bin/setup_target @@ -324,7 +324,7 @@ generate_target_real() { mkdir -p "$TARGET_BUILD_DIR" || perror "Failed to create $TARGET_BUILD_DIR" prepare_usr_split "${TARGET_BUILD_DIR}" - # if no arguments assume all. + # Set modules first, assume all if no arguments is given. if [ "x$1" = "x" -o "x$1" = "xall" ]; then MODULES=$( ls "${TARGET_DIR}" ) set -- $MODULES @@ -333,16 +333,38 @@ generate_target_real() { MODULES=$@ fi + # Now detect sub-targets + declare -Ag SUBTARGETS=() + for mod in $MODULES; do + SUBTARGET_DIR="${CORE_DIR}/targets/${mod}" + if [ -d "$SUBTARGET_DIR" ]; then + SUBTARGETS["$mod"]="$(ls $SUBTARGET_DIR)" + fi + done + pinfo "Activated modules in '${TARGET}':" pinfo "\t$(echo ${MODULES})" + if [ -n "${SUBTARGETS[*]}" ]; then + pinfo "From subtargets '${!SUBTARGETS[*]}':" + pinfo "\t$(echo ${SUBTARGETS[*]})" + fi # copy basic libs pinfo "Copying libc and ld-linux used by ${SHELL}" tarcopy "$(list_basic_libs)" "${TARGET_BUILD_DIR}" - # now iterate over given tools and copy them + # now iterate over modules and/or subtargets and process them + declare -g MAINTARGET_DIR="$TARGET_DIR" while (( "$#" )); do - process_module "$1" + if [ -n "${SUBTARGETS["$1"]}" ]; then + declare -g TARGET_DIR="${CORE_DIR}/targets/${1}" + for submod in ${SUBTARGETS["$1"]}; do + process_module "$submod" + done + else + declare -g TARGET_DIR="$MAINTARGET_DIR" + process_module "$1" + fi shift done @@ -376,6 +398,15 @@ process_module() { local MD5FILE="${TARGET_BUILD_DIR}/opt/openslx/.mltk/${MODULE}.md5" mkdir -p "${TARGET_BUILD_DIR}/opt/openslx/.mltk" if [ ! -d "${MODULE_DIR}" ]; then + # not in this target's dir, check subtargets... + for target in "$MAINTARGET_DIR" "${!SUBTARGETS[@]}"; do + if [ -d "${target}/${MODULE}" ]; then + MODULE_DIR="${target}/${MODULE}" + break + fi + done + fi + if [ ! -d "${MODULE_DIR}" ]; then if [ -z "$DEPOF" ]; then perror "Module directory for '$MODULE' not found in ${TARGET_DIR}" fi @@ -490,6 +521,53 @@ process_module() { post_process_target() { local TOOL_STR="$TOOL_STR post_process_target:" + # For debugging purposes, install mode does not set TARGET_BUILD_DIR + # to / but rather builds the target traditionally. We then check file + # by file instead of a blind tarcopy + if [ ${REMOTE_LOCAL_INSTALL} -eq 1 ]; then + # default dest and exclude list for non-addons + local RSYNC_DEST='/' + local 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 + 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") + cd "$TARGET_BUILD_DIR" + for entry in $(find . -not -type d); do + # diff them to be sure they are the same? + if [ -e "${entry:1}" ] && diff -q "${entry:1}" "${entry}"; then + echo "${entry:2}" >> "$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 + return 0 + fi # figure out all relevant ld-paths pinfo "Running ldconfig" cp -r -L /etc/ld.so.conf* "${TARGET_BUILD_DIR}/etc/" @@ -518,13 +596,26 @@ clean_modules() { else rm -rf -- "${TARGET_BUILD_DIR}" || perror "Could not delete target build dir for $TARGET" fi - # exclude kernel on "all" - set -- $(ls "${TARGET_DIR}" | grep -vE "^kernel$") + # prepare the list of modules to clean, e.g. <target>:<module> + # and exclude kernel on "all" + modlist=() + for active in $(ls "$TARGET_DIR"); do + [ "$active" = "kernel" ] && continue + if [ -d "${CORE_DIR}/targets/${active}" ]; then + for submod in $( ls ${CORE_DIR}/targets/${active} ); do + [ "$submod" = "kernel" ] && continue + modlist+=( "${active}:${submod}" ) + done + else + modlist+=( "${TARGET}:${active}" ) + fi + done + set -- "${modlist[@]}" fi - cd "$TARGET_DIR" + cd "$TARGET_DIR" while (( "$#" )); do - clean_module "${TARGET}:$1" + clean_module "$1" shift done cd - &> /dev/null @@ -532,7 +623,7 @@ clean_modules() { clean_module() { [ -z "$1" ] && perror "No module given on clean_module()" - pinfo "## clean_module $1" + pinfo "## clean_module $1" local TARGET=${1%:*} local MODULE=${1#*:} 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 <username>" pwarning "OR" pwarning "USER=<username> [GROUP=<groupname>] [USERID=<userid>] [GROUPID=<groupid>] [USERHOME=<homedir>] [USERSHELL=<shell>] [PASSWORD=<pass>] 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/etc/systemd/system/multi-user.target.wants/alsa-default-card.service b/core/modules/alsa/data/etc/systemd/system/sound.target.wants/alsa-default-card.service index 55e393fd..55e393fd 120000 --- a/core/modules/alsa/data/etc/systemd/system/multi-user.target.wants/alsa-default-card.service +++ b/core/modules/alsa/data/etc/systemd/system/sound.target.wants/alsa-default-card.service 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..61e83e00 100755 --- a/core/modules/alsa/data/opt/openslx/scripts/alsa-default_card +++ b/core/modules/alsa/data/opt/openslx/scripts/alsa-default_card @@ -1,7 +1,20 @@ #!/bin/ash +export PATH=$PATH:/opt/openslx/sbin:/opt/openslx/bin + PROC="/proc/asound/pcm" +# give it some time if it is not directly found. +i=0 +while true; do + if [ "$i" -eq 10 ]; then + echo "'${PROC}' not found or not readable." + exit 1 + fi + [ -r "$PROC" ] && break + usleep "$(( ++i * 500000 ))" +done + if [ ! -r "$PROC" ]; then echo "'${PROC}' not found or not readable. Not setting default sound card." exit 0 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/alsa/module.conf.ubuntu b/core/modules/alsa/module.conf.ubuntu index bae01ed1..92ffbf36 100644 --- a/core/modules/alsa/module.conf.ubuntu +++ b/core/modules/alsa/module.conf.ubuntu @@ -6,6 +6,9 @@ REQUIRED_CONTENT_PACKAGES=" libasound2-data libasound2-plugins " +REQUIRED_INSTALLED_PACKAGES=" + $REQUIRED_CONTENT_PACKAGES +" REQUIRED_DIRECTORIES+=" /etc/modprobe.d diff --git a/core/modules/busybox/module.build b/core/modules/busybox/module.build index 9b83e1e7..2643bf15 100644 --- a/core/modules/busybox/module.build +++ b/core/modules/busybox/module.build @@ -34,10 +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="${MODULE_BUILD_DIR}/opt/openslx" + make CONFIG_PREFIX="${INSTALL_PREFIX}" install || perror "failed" + rm -f "${INSTALL_PREFIX}/bin/mount" "${INSTALL_PREFIX}/bin/umount" "${INSTALL_PREFIX}/bin/bash" + cd - &> /dev/null } post_copy() { - : + mkdir -p "${TARGET_BUILD_DIR}/bin" || perror "Failed to create '${TARGET_BUILD_DIR}/bin'." + ln -sf "/opt/openslx/bin/busybox" "${TARGET_BUILD_DIR}/bin/ash" || \ + perror "Failed to link '${TARGET_BUILD_DIR}/bin/ash' to '/opt/openslx/bin/busybox'." } diff --git a/core/modules/busybox/module.conf b/core/modules/busybox/module.conf index 265f53f3..d5bb5c41 100644 --- a/core/modules/busybox/module.conf +++ b/core/modules/busybox/module.conf @@ -3,6 +3,6 @@ REQUIRED_GIT="git://git.busybox.net/busybox" REQUIRED_BRANCH="1_31_1" REQUIRED_BINARIES="busybox" REQUIRED_DIRECTORIES=" - /bin - /sbin + /opt/openslx/bin + /opt/openslx/sbin " diff --git a/core/modules/cron/module.conf b/core/modules/cron/module.conf index 31573eb0..0a9c52c3 100644 --- a/core/modules/cron/module.conf +++ b/core/modules/cron/module.conf @@ -1,4 +1,7 @@ #!/bin/bash +REQUIRED_MODULES=" + slxlog +" REQUIRED_GIT="https://github.com/cronie-crond/cronie.git" REQUIRED_COMMIT="d582556168e740fbd19e777a6733b404084e69d8" REQUIRED_BINARIES=" diff --git a/core/modules/demo-user/module.build b/core/modules/demo-user/module.build new file mode 100644 index 00000000..92c3dde3 --- /dev/null +++ b/core/modules/demo-user/module.build @@ -0,0 +1,13 @@ +#!/bin/bash +fetch_source() { + : +} + +build() { + : +} + +post_copy() { + DEMO_ID="$(USER=demo PASSWORD= USERHOME=/home/demo USERSHELL=/bin/bash add_user)" + [ -n "$DEMO_ID" ] && pinfo "Created user demo" +} diff --git a/core/modules/demo-user/module.conf b/core/modules/demo-user/module.conf new file mode 100644 index 00000000..8811668a --- /dev/null +++ b/core/modules/demo-user/module.conf @@ -0,0 +1,4 @@ +#!/bin/bash +REQUIRED_BINARIES="" +REQUIRED_LIBRARIES="" +REQUIRED_DIRECTORIES="" diff --git a/core/modules/dhcpc-busybox/data/etc/systemd/system/bridge-additional-nics.service b/core/modules/dhcpc-busybox/data/etc/systemd/system/bridge-additional-nics.service new file mode 100644 index 00000000..751f3598 --- /dev/null +++ b/core/modules/dhcpc-busybox/data/etc/systemd/system/bridge-additional-nics.service @@ -0,0 +1,8 @@ +[Unit] +Description=Setup bridges for addition network interfaces +Wants=systemd-udevd.service +After=systemd-udev-settle.service systemd-udevd.service + +[Service] +Type=oneshot +ExecStart=/opt/openslx/scripts/systemd-bridge_additional_nics diff --git a/core/modules/dhcpc-busybox/data/etc/udev/rules.d/99-openslx-net.rules b/core/modules/dhcpc-busybox/data/etc/udev/rules.d/99-openslx-net.rules index 17c0068c..1d8778dc 100644 --- a/core/modules/dhcpc-busybox/data/etc/udev/rules.d/99-openslx-net.rules +++ b/core/modules/dhcpc-busybox/data/etc/udev/rules.d/99-openslx-net.rules @@ -1 +1 @@ -ACTION=="add", SUBSYSTEM=="net", KERNEL=="br0|br-nic-*", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/net/devices/$name", ENV{SYSTEMD_WANTS}="network-interface@$name.service" +ACTION=="add", SUBSYSTEM=="net", KERNEL=="br-nic-*", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/net/devices/$name", ENV{SYSTEMD_WANTS}="network-interface@$name.service" diff --git a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-bridge_additional_nics b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-bridge_additional_nics new file mode 100755 index 00000000..fd820909 --- /dev/null +++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-bridge_additional_nics @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Small script scanning sysfs for physical network interfaces +# and creating additional network bridges 'br-nic-[0-9]'. + +. /opt/openslx/config + +# do nothing if not netbooted +[ -z "$SLX_PXE_NETIF" ] && exit 1 + +declare -g id=1 +for nic in /sys/class/net/*; do + # The presence of this symlink pointing to the physical device + # seems to be the better way to detect them. + [ -h "${nic}/device" ] || continue + + # do not handle the primary interface + [ "$SLX_PXE_NETIF" = "${nic##*/}" ] && continue + + # physical nic found, create a bridge with the same MAC + bridge="br-nic-${id}" + mac="$(cat "${nic}/address")" + if ! [[ $mac =~ ^([0-9a-f]{2}:){5}[0-9a-f]{2}$ ]]; then + echo "'$mac' does not seems like a valid MAC address." + continue + fi + + ( + set -e + brctl addbr "$bridge" + brctl stp "$bridge" 0 + ip link set addr "$mac" "$bridge" + ip link set dev "${nic##*/}" up + brctl addif "$bridge" "${nic##*/}" + ip link set dev "$bridge" up + ) + ret=$? + if [ "$ret" != 0 ]; then + echo "Failed to setup additional bridge '$bridge' for '$nic'." + brctl delbr "$bridge" + continue + fi + + # all fine, increase counter and continue + (( id++ )) +done + +exit 0 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 c034efb5..b2a4e896 100755 --- a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx +++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx @@ -155,10 +155,13 @@ case "$1" in rebuild_resolv_conf fi - + # NOTE: The udev rule triggering our network setup is changed in *installer* + # to only trigger this script on additional interfaces bridges. Keeping the code + # here for now and for easier merging... # Things that should only happen for the main interface that was used for booting if [ "$interface" = "$primary" ]; then - # Update IP + # Update IP, TODO: check if we really want/need to overwrite the PXE_IP, + # it might be better/clearer to change the SLX_DHCP_CLIENT_IP... sed -i "s/^\(SLX_PXE_CLIENT_IP=\).*$/\1'$ip'/" /opt/openslx/config # Write DOMAIN and SEARCH to /opt/openslx/config if empty if [ -z "$SLX_NET_DOMAIN" ] && [ -n "$domain" ]; then @@ -175,36 +178,6 @@ case "$1" in echo "SLX_NET_WINS='$wins'" >> /opt/openslx/config fi - # Only if network is not ready yet - if ! [ -e "/run/network/network-ready" ] || ! [ -e "/etc/hostname" ] || grep -q '^noname-' "/etc/hostname"; then - # Update hostname - if [ -z "$dns_fqdn" ] && [ -n "$domain" ] && [ -n "$hostname" ]; then - # fallback to what the dhcp told us - dns_fqdn="${hostname}.${domain}" - fi - if [ -z "$dns_fqdn" ]; then - # only if there is no /etc/hostname, we fall back (far back, that is) - [ ! -s "/etc/hostname" ] && dns_fqdn="slx-client" - fi - # finally, if dns_fqdn was set to anything, apply it - if [ -n "$dns_fqdn" ]; then - dns_short="${dns_fqdn%%.*}" - echo "$dns_short" > "/proc/sys/kernel/hostname" - echo "$dns_short" > "/etc/hostname" - if grep '^SLX_HOSTNAME=' /opt/openslx/config 2>/dev/null; then - sed -i "s/^\(SLX_HOSTNAME=\).*$/\1'$dns_short'/" /opt/openslx/config - else - echo "# Config written by openslx-dhcp-script (1)" >> /opt/openslx/config - echo "SLX_HOSTNAME='$dns_short'" >> /opt/openslx/config - fi - fi - - # Update /etc/issue for proper spacing - /opt/openslx/scripts/openslx-create_issue - touch "/run/network/network-ready" - # Mark network target as reached - systemctl start network.target & - fi # end "network not ready yet" # Remove any stray addresses; we expect the primary interface to only have one # address supplied via DHCP. We do this after adding the new one, obviously. rem_list=$( ip -o addr show "$interface" | awk '{ for (i=1;i<NF;++i) if ($i == "inet") print $(i+1) }' | grep -v "^${ip}/" ) @@ -217,7 +190,7 @@ case "$1" in done fi fi # end "primary only" - + # Hostname in /etc/hosts touch "/etc/hosts" hostlist="" @@ -238,20 +211,10 @@ case "$1" in fi # Get rid of orphaned lines in /etc/hosts sed -i -r '/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\s*$/d' /etc/hosts - - # "dns ready" target - if [ -n "$dns" ] && [ ! -e "/run/network/dns-ready" ]; then - touch "/run/network/dns-ready" - # Write to openslx-config - echo "# Config written by openslx-dhcp-script (2)" >> /opt/openslx/config - echo "SLX_DNS='$dns'" >> /opt/openslx/config - systemctl start network-dns.target & - fi - # "default route exists" target - if [ -n "$router" ] && [ ! -e "/run/network/gateway-ready" ]; then - touch "/run/network/gateway-ready" - systemctl start network-gateway.target & - fi + # Write to openslx-config + echo "# Config written by openslx-dhcp-script (2)" >> /opt/openslx/config + sed -i "/^SLX_DNS=/d" /opt/openslx/config + echo "SLX_DNS='$dns'" >> /opt/openslx/config ;; deconfig) diff --git a/core/modules/dhcpc-busybox/module.conf b/core/modules/dhcpc-busybox/module.conf index d8961801..8dd62c4c 100644 --- a/core/modules/dhcpc-busybox/module.conf +++ b/core/modules/dhcpc-busybox/module.conf @@ -1,4 +1,5 @@ #!/bin/bash REQUIRED_MODULES=" + slxlog rdns " diff --git a/core/modules/disk-partitions/data/etc/systemd/system/local-fs.target.wants/setup-partitions.service b/core/modules/disk-partitions/data/etc/systemd/system/local-fs.target.wants/setup-partitions.service new file mode 120000 index 00000000..af2957f8 --- /dev/null +++ b/core/modules/disk-partitions/data/etc/systemd/system/local-fs.target.wants/setup-partitions.service @@ -0,0 +1 @@ +../setup-partitions.service
\ No newline at end of file diff --git a/core/modules/disk-partitions/data/etc/systemd/system/setup-partitions.service b/core/modules/disk-partitions/data/etc/systemd/system/setup-partitions.service new file mode 100644 index 00000000..16e3b990 --- /dev/null +++ b/core/modules/disk-partitions/data/etc/systemd/system/setup-partitions.service @@ -0,0 +1,11 @@ +[Unit] +Description=Setup local disk partitions (tmp, swap) +After=systemd-udev-settle.service systemd-udevd.service +Wants=tmp.target systemd-udevd.service +Before=tmp.target +DefaultDependencies=no + +[Service] +Type=oneshot +ExecStart=/opt/openslx/scripts/systemd-setup_partitions +RemainAfterExit=yes diff --git a/core/modules/disk-partitions/data/etc/systemd/system/tmp.target b/core/modules/disk-partitions/data/etc/systemd/system/tmp.target new file mode 100644 index 00000000..12f8a679 --- /dev/null +++ b/core/modules/disk-partitions/data/etc/systemd/system/tmp.target @@ -0,0 +1,2 @@ +[Unit] +Description=Backwards compatibility target diff --git a/core/modules/disk-partitions/data/opt/openslx/scripts/systemd-setup_partitions b/core/modules/disk-partitions/data/opt/openslx/scripts/systemd-setup_partitions new file mode 100755 index 00000000..641ae372 --- /dev/null +++ b/core/modules/disk-partitions/data/opt/openslx/scripts/systemd-setup_partitions @@ -0,0 +1,272 @@ +#!/bin/bash +# Arrays etc and $(( )) with big numbers +# ----------------------------------------------------------------------------- +# +# Copyright (c) 2018 bwLehrpool-Projektteam +# +# This program/file is free software distributed under the GPL version 2. +# See https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html +# +# If you have any feedback please consult https://bwlehrpool.de and +# send your feedback to bwlehrpool@hs-offenburg.de. +# +# General information about bwLehrpool can be found at https://bwlehrpool.de +# +# ----------------------------------------------------------------------------- +# +# Local hard disk autodetection script for OpenSLX linux stateless clients, +# detecting swap and special partitions + +############################################################################# + +. /opt/openslx/bin/slx-tools + +# Mount point for persistent scratch partition (type 45) +MOUNT_POINT_45="/opt/openslx/persistent" +PARTITION_FILE="/run/openslx/partitions" +readonly MOUNT_POINT_45 PARTITION_FILE +mkdir -p "/run/openslx" + +declare -a TMPFILES +gettmp () { + local vn file + for vn in "$@"; do + file=$(mktemp -p /run/openslx) # since we fiddle around with /tmp in this script + declare -g "${vn}=${file}" + TMPFILES+=("$file") + done +} +delalltmp () { + rm -f -- "${TMPFILES[@]}" +} +trap delalltmp EXIT + +# get_mount_options <fstype> <varname> +get_mount_options () { + case "$1" in + ext2) + declare -ag "${2}=(-o nocheck)" + ;; + ext4) + declare -ag "${2}=(-o 'errors=remount-ro,data=ordered,relatime,quota')" + ;; + *) + declare -ag "${2}=()" + esac +} + +# General formatter for the /tmp partition on a local harddisk +format_disk () { + declare -ag MOUNT_OPTIONS_SET_BY_FORMAT_DISK=() # Global var! + local target="$1" + local fslist="xfs jfs ext3 ext2 ext4" + local fs + declare -a fopt + [ $# -ge 2 ] && fslist="$2" + for fs in $fslist ; do + if grep -q "\\b${fs}\\b" "/proc/filesystems"; then + # Filesystem already supported by running kernel + : + elif modprobe "${fs}"; then + # Filesystem module could be loaded and should be supported now + : + else + # Not supported, try next one + continue + fi + if which "mkfs.$fs" ; then + case "$fs" in + reiserfs) + fopt=("-f") + ;; + xfs) + fopt=("-f" "-K") + ;; + ext2|ext3) + fopt=("-F") + ;; + ext4) + fopt=(-F -b 4096 -O "extent,huge_file,flex_bg,metadata_csum,64bit,dir_nlink,extra_isize,quota" -E "nodiscard,quotatype=usrquota:prjquota" -I 256) + ;; + jfs) + fopt=() + ;; + *) + fopt=() + ;; + esac + get_mount_options "$fs" MOUNT_OPTIONS_SET_BY_FORMAT_DISK + "mkfs.$fs" "${fopt[@]}" "${target}" && return 0 # Success! + fi + done + return 1 +} + +wait_for_udev () { + local upid ctr hdd + hdd= + if [ "x$1" = "x--hdd" ]; then + hdd=true + shift + fi + ctr=$(( "$1" * 10 )) + if ! [ "$ctr" -gt 0 ]; then # Negation to catch NaN + ctr=1 + fi + udevadm trigger & + usleep 20000 # 20ms + udevadm settle &> /dev/null & # --timeout doesn't work reliably, sometimes the process just hangs + upid=$! + while [ "$ctr" -gt 0 ]; do + [ -n "$hdd" ] && has_hdd && break + [ -z "$hdd" ] && ! [ -d "/proc/$upid" ] && break + usleep 100000 # 100ms + ctr=$(( ctr - 1 )) + done + if [ -d "/proc/$upid" ]; then + kill -9 "$upid" &> /dev/null & + fi +} + +has_hdd () { + [ -n "$( ls -U -1 /dev/disk/by-path/ )" ] +} + +wait_for_udev 2 + +if ! has_hdd; then + wait_for_udev --hdd 4 +fi + +shopt -s extglob +for disk in /dev/disk/by-path/!(*-part*|*-usb-*); do + [ -L "$disk" ] || continue + fdisk -l "$( readlink -f "$disk" )" +done > "$PARTITION_FILE" +shopt -u extglob +if ! [ -s "$PARTITION_FILE" ]; then + echo "none" > "$PARTITION_FILE" +fi +echo "Partitions:" +cat "$PARTITION_FILE" + +# Check for standard swap partitions and make them available to the system +HAVE_SWAP=no +for PART_DEV in $(dev_find_partitions "82" "0657fd6d-a4ab-43c4-84e5-0933c84b4f4f"); do + if swapon "$PART_DEV" -p 10; then + HAVE_SWAP=yes # low priority, in case we have zram swap, prefer that) + echo -e "$PART_DEV\tswap\t\tswap\t\tdefaults\t 0 0" >> "/etc/fstab" + fi +done + +# Put detected linux partitions (83) into /etc/fstab with "noauto" +for PART_DEV in $(dev_find_partitions "83"); do + mkdir -p "/media/${PART_DEV#/dev/*}" + echo -e "${PART_DEV}\t/media/${PART_DEV#/dev/*}\tauto\t\tnoauto,noexec\t 0 0" >> "/etc/fstab" +done + +# special partition 45 (persistent scratch) to $MOUNT_POINT_45 +HAVE_PARTITION_45=no +get_mount_options "ext4" mopts +# try all the ID45 partitions until one succeeds, from large to small +for PART_DEV in $(dev_find_partitions "45" "87f86132-ff94-4987-b250-454545454545"); do + mkdir -p "$MOUNT_POINT_45" + # Let's see if this is an ext4 partition and if so, whether it has the proper size + # Any fixing should happen first + gettmp "logfile" + COUNT=0 + while true; do + [ "$COUNT" -ge 4 ] && break + let COUNT++ + fsck.ext4 -y "$PART_DEV" &> "$logfile" + RET=$? + if [ "$(( RET & 7 ))" = 4 ]; then + slxlog "partition-45-fsck" "Error fixing file system errors on ID45 partition" "$logfile" + break + fi + [ "$(( RET & 3 ))" != 1 ] && break + done + # awk script to take block count and block size from dumpe2fs output and multiply them to get byte size + fs_size=$(dumpe2fs -h "$PART_DEV" | awk -F: 'BEGIN{a=0;b=0}{if ($1 == "Block count") a=$2; if($1 == "Block size") b=$2;}END{ if (a>0 && b>0) print a" * "b}' | bc) + echo "$PART_DEV has ext4 fs of size $fs_size" + if [ -n "$fs_size" ] && [ "$fs_size" -gt 1000000 ]; then + # It's ext4, see if partition size was changed offline + dev_size=$(blockdev --getsize64 "$PART_DEV") + echo "$PART_DEV has actual size of $dev_size" + if [ -n "$dev_size" ] && [ "$dev_size" -gt 1000000 ]; then + # somewhat sane, see what to do + dev_mb=$(( dev_size / 1024 / 1024 )) + fs_mb=$(( fs_size / 1024 / 1024 )) + echo "Dev: $dev_mb, fs: $fs_mb" + if [ "$(( fs_mb + 100 ))" -lt "$dev_mb" ]; then + # dev size plus 100MB is still smaller than reported fs size -- resize fs + gettmp "logfile" + fsck.ext4 -f -y "$PART_DEV" &> "$logfile" + if resize2fs "$PART_DEV" &>> "$logfile"; then + slxlog "partition-45-resize-ok" "Resized partition $PART_DEV from $fs_mb MiB to $dev_mb MiB" "$logfile" + else + slxlog "partition-45-resize-fail" "Could not enlarge file system size of $PART_DEV from $fs_mb MiB to $dev_mb MiB" "$logfile" + dd if=/dev/zero of="$PART_DEV" bs=1M count=1 &>/dev/null + fi + elif [ "$dev_size" -lt "$fs_size" ]; then + # partition is smaller than expected by fs -- killall + slxlog "partition-45-shrink" "$PART_DEV has ext4 file system which is $fs_mb MiB, but partition size is only $dev_mb MiB. Will wipe partition to be safe..." + dd if=/dev/zero of="$PART_DEV" bs=1M count=1 &>/dev/null + fi + fi + fi + # try to mount + if ! mount -v -t ext4 "${mopts[@]}" "${PART_DEV}" "$MOUNT_POINT_45"; then + # failed, try to format + gettmp "logfile" + if ! format_disk "$PART_DEV" "ext4" &> "$logfile"; then + slxlog "partition-45-format" "Cannot format $PART_DEV with ext4" "$logfile" + continue + fi + gettmp "logfile" + if ! mount -v -t ext4 "${mopts[@]}" "${PART_DEV}" "$MOUNT_POINT_45" &> "$logfile"; then + slxlog "partition-45-newmount" "Cannot mount $PART_DEV with ext4 right after formatting" "$logfile" + continue + fi + fi + # Mount success -- clean up lost+found + find "${MOUNT_POINT_45}/slx_lost+found" -mindepth 1 -maxdepth 1 -mtime +90 -type d -exec rm -rf -- {} \; + if [ -d "${MOUNT_POINT_45}/lost+found" ]; then + touch "${MOUNT_POINT_45}/lost+found" + mkdir -p "${MOUNT_POINT_45}/slx_lost+found" + mv -f -- "${MOUNT_POINT_45}/lost+found" "${MOUNT_POINT_45}/slx_lost+found/$(date +%s)_$$-$RANDOM" + fi + chmod 0700 "${MOUNT_POINT_45}/slx_lost+found" + chown 0:0 "${MOUNT_POINT_45}/slx_lost+found" + # fstab entry + echo -e "${PART_DEV}\t${MOUNT_POINT_45}\tauto\t\tnoauto\t\t 0 0" >> "/etc/fstab" + HAVE_PARTITION_45=yes + break # success, done +done + +# and 46 to /media/devXX +for PART_DEV in $(dev_find_partitions "46"); do + mkdir -p "/media/${PART_DEV#/dev/*}" + echo -e "${PART_DEV}\t/media/${PART_DEV#/dev/*}\tauto\t\tnoauto\t\t 0 0" >> "/etc/fstab" +done + +# finally, prepare the data subdir on persistent part +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 + +mount -a + +if [ "$HAVE_SWAP" = "no" ]; then + TOTAL_RAM=$(grep ^MemTotal /proc/meminfo | awk '{print $2}') + if [ -n "$TOTAL_RAM" ] && [ "$TOTAL_RAM" -lt "3000000" ]; then + slxlog "partition-swap" "Have no (formatted) swap partition, using zram swap only!" "$PARTITION_FILE" + fi +fi + +exit 0 + diff --git a/core/modules/disk-partitions/module.build b/core/modules/disk-partitions/module.build new file mode 100644 index 00000000..241bcd5e --- /dev/null +++ b/core/modules/disk-partitions/module.build @@ -0,0 +1,12 @@ +#!/bin/bash +fetch_source() { + : +} + +build() { + pinfo "Static module, nothing to build." +} + +post_copy() { + : +} diff --git a/core/modules/disk-partitions/module.conf b/core/modules/disk-partitions/module.conf new file mode 100644 index 00000000..d5d021fa --- /dev/null +++ b/core/modules/disk-partitions/module.conf @@ -0,0 +1,2 @@ +#!/bin/bash +# Nothing diff --git a/core/modules/disk-partitions/module.conf.ubuntu b/core/modules/disk-partitions/module.conf.ubuntu new file mode 100644 index 00000000..33a76ec0 --- /dev/null +++ b/core/modules/disk-partitions/module.conf.ubuntu @@ -0,0 +1,5 @@ +REQUIRED_INSTALLED_PACKAGES=" + xfsprogs + e2fsprogs + dosfstools +" 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..771bc707 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,30 @@ if [ -n "$islocal" ]; then adduser dnbd3 fuse # Start service, is not symlinked when not in proxy mode systemctl --no-block start dnbd3-proxy.service + ( + # give it some time to start + usleep 500000 + for i in 1 2 3 4 5 ""; do + [ -z "$i" ] && exit 1 + if echo | busybox timeout 1 busybox nc 127.0.0.1 "$DNBD3_PORT"; then + break + fi + echo "fail #$i" + sleep 1 + done + + # it's up, so let's try to add the server + if ! dnbd3-client -A 127.0.0.1 -d /dev/dnbd0; then + # failed, either the dnbd3-client doesn't support -A or + # it is still not up. + exit 1 + fi + + if ! dnbd3-client -s 127.0.0.1 -d /dev/dnbd0; then + # localhost still not found even though its in alt-servers !? + exit 1337 + 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/dnbd3/module.conf b/core/modules/dnbd3/module.conf index e671dcdf..575d7de7 100644 --- a/core/modules/dnbd3/module.conf +++ b/core/modules/dnbd3/module.conf @@ -1,4 +1,8 @@ #!/bin/bash +REQUIRED_MODULES=" + kernel + slxlog +" REQUIRED_MODULES="kernel" REQUIRED_GIT="https://git.openslx.org/dnbd3.git" REQUIRED_BINARIES=" diff --git a/core/modules/gdisk/module.conf b/core/modules/gdisk/module.conf index 2c00fc76..58915682 100644 --- a/core/modules/gdisk/module.conf +++ b/core/modules/gdisk/module.conf @@ -1,6 +1,7 @@ #!/bin/bash REQUIRED_MODULES=" kernel + slxlog " REQUIRED_BINARIES=" sgdisk diff --git a/core/rootfs/rootfs-stage32/data/etc/systemd/system/load-gfx-driver.service b/core/modules/gfx-driver/data/etc/systemd/system/load-gfx-driver.service index 0534f45c..0534f45c 100644 --- a/core/rootfs/rootfs-stage32/data/etc/systemd/system/load-gfx-driver.service +++ b/core/modules/gfx-driver/data/etc/systemd/system/load-gfx-driver.service diff --git a/core/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/load-gfx-driver.service b/core/modules/gfx-driver/data/etc/systemd/system/sysinit.target.wants/load-gfx-driver.service index b72d0453..b72d0453 120000 --- a/core/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/load-gfx-driver.service +++ b/core/modules/gfx-driver/data/etc/systemd/system/sysinit.target.wants/load-gfx-driver.service diff --git a/core/modules/gfx-driver/data/opt/openslx/scripts/systemd-load_gfx_driver b/core/modules/gfx-driver/data/opt/openslx/scripts/systemd-load_gfx_driver new file mode 100755 index 00000000..7d6ddb88 --- /dev/null +++ b/core/modules/gfx-driver/data/opt/openslx/scripts/systemd-load_gfx_driver @@ -0,0 +1,7 @@ +#!/bin/ash +# nvidia-libs is handled as a stage4 addon during stage3 + +# Seems we can finally always do that; in fact, not doing so seems to crash VMs left and right +echo -e "# Written by load-gfx-driver\nSLX_VMWARE_3D=yes" >> "/opt/openslx/config" + +exit 0 diff --git a/core/modules/gfx-driver/module.build b/core/modules/gfx-driver/module.build new file mode 100644 index 00000000..241bcd5e --- /dev/null +++ b/core/modules/gfx-driver/module.build @@ -0,0 +1,12 @@ +#!/bin/bash +fetch_source() { + : +} + +build() { + pinfo "Static module, nothing to build." +} + +post_copy() { + : +} diff --git a/core/modules/gfx-driver/module.conf b/core/modules/gfx-driver/module.conf new file mode 100644 index 00000000..bcd2acc3 --- /dev/null +++ b/core/modules/gfx-driver/module.conf @@ -0,0 +1,3 @@ +REQUIRED_MODULES=" + rootfs-kernel +" 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..48733d91 100644 --- a/core/modules/kdm-theme-bwlp/module.build +++ b/core/modules/kdm-theme-bwlp/module.build @@ -1,14 +1,26 @@ #!/bin/bash - -fetch_source () { +fetch_source() { : } -build () { +build() { : } post_copy() { - : + # Try to fetch distro logo + if [ ! -s "$TARGET_BUILD_DIR/etc/distro.png" ]; then + 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=' + 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" + pwarning "Could not download distro-logo" + fi + else + pwarning "Could not determine distribution" + fi + fi } diff --git a/core/modules/kernel-vanilla/module.build b/core/modules/kernel-vanilla/module.build index a6a33f48..ffa1f53d 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 [ "$REMOTE_LOCAL_INSTALL" -eq 0 ]; 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-greeter-bwlp/module.build b/core/modules/lightdm-greeter-bwlp/module.build index 9698970e..e3d51560 100644 --- a/core/modules/lightdm-greeter-bwlp/module.build +++ b/core/modules/lightdm-greeter-bwlp/module.build @@ -18,9 +18,14 @@ build() { popd &>/dev/null # "install" mkdir -p "${DESTDIR}" || perror "Could not mkdir ${DESTDIR}!" - mv "${BUILDDIR}/qt-lightdm-greeter" "${DESTDIR}" - mkdir -p "${MODULE_BUILD_DIR}/usr/share/xgreeters" - cp "${SRCDIR}/qt-lightdm-greeter.desktop" "${MODULE_BUILD_DIR}/usr/share/xgreeters" + mv "${BUILDDIR}/qt-lightdm-greeter" "${DESTDIR}" || \ + perror "Failed to mv greeter to ${DESTDIR}." + mkdir -p "${MODULE_BUILD_DIR}/usr/share/xgreeters" || \ + perror "Failed to mkdir: ${MODULE_BUILD_DIR}/usr/share/xgreeters" + sed 's;^Exec=.*;Exec='"${DESTDIR#${MODULE_BUILD_DIR}}"'/qt-lightdm-greeter;' \ + "${SRCDIR}/qt-lightdm-greeter.desktop" > \ + "${MODULE_BUILD_DIR}/usr/share/xgreeters/qt-lightdm-greeter.desktop" \ + perror "Failed to fix greeter's path in .desktop file." COPYLIST="list_dpkg_output" [ -e "$COPYLIST" ] && rm "$COPYLIST" 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/data/etc/systemd/system/display-manager.service b/core/modules/lightdm/data/etc/systemd/system/display-manager.service deleted file mode 120000 index 4fcfbb14..00000000 --- a/core/modules/lightdm/data/etc/systemd/system/display-manager.service +++ /dev/null @@ -1 +0,0 @@ -lightdm.service
\ No newline at end of file diff --git a/core/modules/lightdm/module.build b/core/modules/lightdm/module.build index 656d71a9..a86d0baa 100644 --- a/core/modules/lightdm/module.build +++ b/core/modules/lightdm/module.build @@ -12,9 +12,29 @@ 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." + + # NOTE this might cause problems on systemd-based systems where use our + # own systemd module instead of using the distro's module, which we shouldn't + # in the first place! First, check if service file is present on system: + local LIGHTDM_SERVICE_PATH="$(systemctl show -p FragmentPath lightdm.service | cut -c 14-)" + if [ -z "${LIGHTDM_SERVICE_PATH}" ]; then + # Not found, so use our template + local LIGHTDM_SERVICE_TPL="${MODULE_DIR}/templates/lightdm.service" + [ -s "${LIGHTDM_SERVICE_TPL}" ] || perror "Unable to find template at ${LIGHTDM_SERVICE_TPL}." + local LIGHTDM_SERVICE_DEST="${TARGET_BUILD_DIR}/etc/systemd/system/lightdm.service" + mkdir -p "${LIGHTDM_SERVICE_DEST%/*}" || perror "Could not create '${LIGHTDM_SERVICE_DEST%/*}'." + cp "${MODULE_DIR}/templates/lightdm.service" "${LIGHTDM_SERVICE_DEST}" || \ + perror "Could not cp lightdm.service template to '${LIGHTDM_SERVICE_DEST}'." + LIGHTDM_SERVICE_PATH="${LIGHTDM_SERVICE_DEST//${TARGET_BUILD_DIR}/}" + fi + # either way link display-manager to LIGHTDM_SERVICE_PATH + ln -sf "${LIGHTDM_SERVICE_PATH}" \ + "${TARGET_BUILD_DIR}/etc/systemd/system/display-manager.service" || \ + perror "Could not set lightdm as display-manager!" } diff --git a/core/modules/lightdm/data/etc/systemd/system/lightdm.service b/core/modules/lightdm/templates/lightdm.service index baa93f2f..d9002404 100644 --- a/core/modules/lightdm/data/etc/systemd/system/lightdm.service +++ b/core/modules/lightdm/templates/lightdm.service @@ -1,7 +1,7 @@ [Unit] Description=LightDM Display Manager Conflicts=getty@tty7.service -After=dev-tty7.device systemd-user-sessions.service load-gfx-driver.service setup-slx-addon@vmware.service setup-slx-addon@virtualbox.service +After=systemd-user-sessions.service load-gfx-driver.service [Service] ExecStart=/usr/sbin/lightdm 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/data/addon-init b/core/modules/nvidia-libs/data/addon-init index ae0734c2..ebbf0b62 100755 --- a/core/modules/nvidia-libs/data/addon-init +++ b/core/modules/nvidia-libs/data/addon-init @@ -1,10 +1,10 @@ #!/bin/ash -[ -e "/opt/openslx/etc/nvidia.whiteout" ] || exit 0 +[ -e "/opt/openslx/etc/nvidia_libs.whiteout" ] || exit 0 while read line; do rm -f -- "$line" -done < "/opt/openslx/etc/nvidia.whiteout" +done < "/opt/openslx/etc/nvidia_libs.whiteout" exit 0 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/graphical.target.wants/run-virt-dhcpd.service b/core/modules/run-virt/data/etc/systemd/system/basic.target.wants/run-virt-dhcpd.service index a47d9c0b..a47d9c0b 120000 --- a/core/modules/run-virt/data/etc/systemd/system/graphical.target.wants/run-virt-dhcpd.service +++ b/core/modules/run-virt/data/etc/systemd/system/basic.target.wants/run-virt-dhcpd.service diff --git a/core/modules/run-virt/data/etc/systemd/system/graphical.target.wants/run-virt-env.service b/core/modules/run-virt/data/etc/systemd/system/basic.target.wants/run-virt-env.service index c47218eb..c47218eb 120000 --- a/core/modules/run-virt/data/etc/systemd/system/graphical.target.wants/run-virt-env.service +++ b/core/modules/run-virt/data/etc/systemd/system/basic.target.wants/run-virt-env.service 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/rootfs/rootfs-stage32/data/etc/tmpfiles.d/openslx-log.conf b/core/modules/run-virt/data/etc/tmpfiles.d/openslx-log.conf index 4d93fb9c..4d93fb9c 100644 --- a/core/rootfs/rootfs-stage32/data/etc/tmpfiles.d/openslx-log.conf +++ b/core/modules/run-virt/data/etc/tmpfiles.d/openslx-log.conf 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..2a4d75da 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 @@ -24,6 +24,7 @@ ################################################################################ # source config file with vars (e.g. ipaddr, macaddr, HOSTNAME) +[ -s /opt/openslx/config ] || exit 0 . /opt/openslx/config # from plugins/vmchooser/XX_vmchooser.sh @@ -193,8 +194,13 @@ getips () { # Output in one line by using echo without quotes echo $(busybox timeout 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}') } - +getresolvconf() { + awk -vattr="$1" '$1 == attr {for (i=2; i<=NF; i++) printf "%s ",$i}' /etc/resolv.conf +} # read the DNS configuration and configure the udhcpd +SLX_DNS="$(getresolvconf nameserver)" +SLX_NET_DOMAIN="$(getresolvconf domain)" +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/run-virt/module.conf b/core/modules/run-virt/module.conf index b6de1789..0af71cbe 100644 --- a/core/modules/run-virt/module.conf +++ b/core/modules/run-virt/module.conf @@ -1,5 +1,7 @@ #!/bin/bash REQUIRED_MODULES=" + busybox + slxlog iptables " REQUIRED_BINARIES=" 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..287b2b44 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 +Requires=getty-pre.target +Before=getty-pre.target shutdown.target DefaultDependencies=no [Service] diff --git a/core/modules/slxlog/data/opt/openslx/bin/slxlog b/core/modules/slxlog/data/opt/openslx/bin/slxlog new file mode 100755 index 00000000..09cb9b79 --- /dev/null +++ b/core/modules/slxlog/data/opt/openslx/bin/slxlog @@ -0,0 +1,104 @@ +#!/bin/ash + +################## +# Remote logging # +################## +# +# Usage: slxlog [-e | --echo] "logtype" "Human readable string" ["file name which's contents should be sent too"] +# -e or --echo will echo message to stdout too +# + +export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin" + +. /opt/openslx/config +[ -z "$SLX_REMOTE_LOG" ] && exit 3 + +USER=$(whoami) +LOGCHECK="/tmp/remote_log_check-$USER" +NOW=$(date +%s) +DELFILE= +SYNC= + +while [ $# -gt 0 ]; do + case "$1" in + -e|--echo) + echo "$@" + ;; + -d|--delete) + DELFILE=yes + ;; + -s|--sync) + SYNC=yes + ;; + *) + break + ;; + esac + shift +done + +[ $# -eq 0 ] && exit 0 + +TYPE="$1" + +# Simple spamcheck. Not very tamper-proof, but if you'd want to spam the server +# you could do it anyways. This is to protect from accidental loops calling this. +if [ -r "$LOGCHECK" ]; then + # Allow max 150 messages in total + LINES=$(cat "$LOGCHECK" | wc -l) + [ "$LINES" -gt "150" ] && exit 1 + # Allow max 5 of same type messages in 30 seconds + LINES=$(grep "$TYPE" "$LOGCHECK" | wc -l) + if [ "$LINES" -ge "5" ]; then + LAST=$(grep "$TYPE" "$LOGCHECK" | tail -n 5 | head -n 1 | awk '{print $1}') + if [ -n "$LAST" ]; then + DIFF="$(( $NOW - $LAST ))" + [ "$DIFF" -lt "30" ] && exit 2 + fi + fi +fi +echo "$NOW $TYPE" >> "$LOGCHECK" +chmod 0600 "$LOGCHECK" 2>/dev/null + +if [ $# -lt 2 ]; then + MSG="Missing text for $@" +else + MSG="$2" +fi +MSG="[$USER] $MSG" + +if [ $# -gt 2 ]; then + EXTRA="$3" +fi + +if [ -n "$SLX_DEBUG" ]; then + CURLLOG="/tmp/slxlog.$USER" +else + CURLLOG="/dev/null" +fi + +UUID= +if [ -s /run/system-uuid ]; then + UUID=$(cat /run/system-uuid) +fi + +submitlog () { + if [ -n "$EXTRA" ] && [ -r "$EXTRA" -a -s "$EXTRA" ] && [ "$(stat -c %s "$EXTRA")" -lt "10000" ]; then # valid file attachment + curl --data-urlencode "uuid=$UUID" --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc@$EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 + elif [ -z "$EXTRA" ]; then # no attachment + curl --data-urlencode "uuid=$UUID" --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 + elif [ -s "$EXTRA" ]; then # attachment file to big (more than 10k) + curl --data-urlencode "uuid=$UUID" --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc=Attachment too large: $EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 + else # empty attachment file (or missing) + curl --data-urlencode "uuid=$UUID" --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc=Attachment missing/empty: $EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 + fi + [ -n "$DELFILE" ] && [ -n "$EXTRA" ] && rm -f -- "$EXTRA" +} + +if [ -z "$SYNC" ]; then + submitlog & + exit 0 +fi + +submitlog + diff --git a/core/modules/slxlog/module.build b/core/modules/slxlog/module.build new file mode 100644 index 00000000..241bcd5e --- /dev/null +++ b/core/modules/slxlog/module.build @@ -0,0 +1,12 @@ +#!/bin/bash +fetch_source() { + : +} + +build() { + pinfo "Static module, nothing to build." +} + +post_copy() { + : +} diff --git a/core/modules/slxlog/module.conf b/core/modules/slxlog/module.conf new file mode 100644 index 00000000..d5d021fa --- /dev/null +++ b/core/modules/slxlog/module.conf @@ -0,0 +1,2 @@ +#!/bin/bash +# Nothing diff --git a/core/modules/smartctl/module.conf b/core/modules/smartctl/module.conf index a2c8a665..36738c3e 100644 --- a/core/modules/smartctl/module.conf +++ b/core/modules/smartctl/module.conf @@ -1,4 +1,7 @@ #!/bin/bash +REQUIRED_MODULES=" + slxlog +" REQUIRED_BINARIES=" smartctl " diff --git a/core/modules/sshd/data/etc/issue.net b/core/modules/sshd/data/etc/issue.net index 7dfbddb5..b59a27ea 100644 --- a/core/modules/sshd/data/etc/issue.net +++ b/core/modules/sshd/data/etc/issue.net @@ -1,6 +1,6 @@ ++++++++++++++++++++++++++++++++++++++ + + -+ MiniLinux SSH Session + ++ MaxiLinux SSH Session + + + ++++++++++++++++++++++++++++++++++++++ diff --git a/core/modules/sshd/data/etc/systemd/system/ssh.service b/core/modules/sshd/data/etc/systemd/system/ssh.service new file mode 120000 index 00000000..4899eed6 --- /dev/null +++ b/core/modules/sshd/data/etc/systemd/system/ssh.service @@ -0,0 +1 @@ +sshd.service
\ No newline at end of file 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/vbox-src/data/addon-init b/core/modules/vbox-src/data/addon-init deleted file mode 100755 index e52bf941..00000000 --- a/core/modules/vbox-src/data/addon-init +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/ash - -addgroup --system vboxusers - -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/basic.target.wants/vbox.service index b8591bd1..b8591bd1 120000 --- a/core/modules/vbox-src/data/etc/systemd/system/graphical.target.wants/vbox.service +++ b/core/modules/vbox-src/data/etc/systemd/system/basic.target.wants/vbox.service diff --git a/core/modules/vbox-src/data/etc/systemd/system/vbox.service b/core/modules/vbox-src/data/etc/systemd/system/vbox.service index 6b6347da..14645f19 100644 --- a/core/modules/vbox-src/data/etc/systemd/system/vbox.service +++ b/core/modules/vbox-src/data/etc/systemd/system/vbox.service @@ -1,7 +1,8 @@ [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 +Requires=run-virt-env.service +After=run-virt-env.service +DefaultDependencies=no [Service] Type=oneshot 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 index ec0e4dde..a511a911 100755 --- 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 @@ -182,8 +182,8 @@ setup_usb() { } setup_sound() { - # force ALSA driver for now and change when others become available - set_attr "/VirtualBox/Machine/Hardware/AudioAdapter" "driver" "ALSA" + # Use Pulse driver + set_attr "/VirtualBox/Machine/Hardware/AudioAdapter" "driver" "Pulse" } setup_displays() { diff --git a/core/modules/vbox-src/module.build b/core/modules/vbox-src/module.build index c5d89c65..4d4daa60 100644 --- a/core/modules/vbox-src/module.build +++ b/core/modules/vbox-src/module.build @@ -106,5 +106,5 @@ build() { } post_copy() { - : + add_system_group "vboxusers" } 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/vmchooser2/module.conf b/core/modules/vmchooser2/module.conf index c62a84c9..e73bbbbd 100644 --- a/core/modules/vmchooser2/module.conf +++ b/core/modules/vmchooser2/module.conf @@ -1,5 +1,6 @@ #!/bin/bash REQUIRED_MODULES=" + slxlog qt5core " REQUIRED_GIT="git://git.openslx.org/openslx-ng/vmchooser2.git" diff --git a/core/modules/vmware-common/data/etc/systemd/system/graphical.target.wants/vmware.service b/core/modules/vmware-common/data/etc/systemd/system/basic.target.wants/vmware.service index 7deb4820..7deb4820 120000 --- a/core/modules/vmware-common/data/etc/systemd/system/graphical.target.wants/vmware.service +++ b/core/modules/vmware-common/data/etc/systemd/system/basic.target.wants/vmware.service diff --git a/core/modules/vmware-common/data/etc/systemd/system/vmware.service b/core/modules/vmware-common/data/etc/systemd/system/vmware.service index 78f75726..baab3747 100644 --- a/core/modules/vmware-common/data/etc/systemd/system/vmware.service +++ b/core/modules/vmware-common/data/etc/systemd/system/vmware.service @@ -1,7 +1,8 @@ [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 +Requires=run-virt-env.service +After=run-virt-env.service +DefaultDependencies=no [Service] Type=oneshot diff --git a/core/modules/vmware-common/data/opt/openslx/pam/hooks/session-open.d/vmware-tmpfs-dir b/core/modules/vmware-common/data/opt/openslx/pam/hooks/session-open.d/vmware-tmpfs-dir new file mode 100644 index 00000000..ed5633ed --- /dev/null +++ b/core/modules/vmware-common/data/opt/openslx/pam/hooks/session-open.d/vmware-tmpfs-dir @@ -0,0 +1,17 @@ +create_vmware_tmpdir() { + local tmpdir="/tmp/vmware-${PAM_USER}" + [ -d "$tmpdir" ] || mkdir -p "$tmpdir" + grep -qE '^tmpfs\s+'"$tmpdir" /proc/mounts && return 0 + + local mount_opts="-o mode=0700,size=100%" + local user_uid="$(id -u $PAM_USER)" + [ -n "$user_uid" ] && mount_opts="${mount_opts},uid=${user_uid}" + local user_gid="$(id -g $PAM_USER)" + [ -n "$user_gid" ] && mount_opts="${mount_opts},gid=${user_gid}" + # NO QUOTES!!!1 + mount -t tmpfs tmpfs ${mount_opts} "$tmpdir" +} +if [ "x$PAM_SERVICE" != "xsu" -a "x$PAM_SERVICE" != "xsudo" ]; then + create_vmware_tmpdir +fi +true diff --git a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc index 41f5840e..4c62bb38 100644 --- a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc +++ b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc @@ -158,6 +158,9 @@ setup_vcpu_ram() { MemAllowAutoScaleDown = "FALSE" MemTrimRate = "-1" HEREEND + + # temporary solution: RAM backing file on a tmpfs + echo 'mainmem.backing = "unnamed"' >> "$TMPCONFIG" } setup_usb() { diff --git a/core/modules/vmware-common/module.conf b/core/modules/vmware-common/module.conf index 8811668a..9b75fd6b 100644 --- a/core/modules/vmware-common/module.conf +++ b/core/modules/vmware-common/module.conf @@ -1,4 +1,5 @@ #!/bin/bash +REQUIRED_MODULES="slxlog" REQUIRED_BINARIES="" REQUIRED_LIBRARIES="" REQUIRED_DIRECTORIES="" 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/core/modules/xorg/data/etc/X11/Xsession b/core/modules/xorg/data/etc/X11/Xsession index 33a003ac..86ecfc14 100755 --- a/core/modules/xorg/data/etc/X11/Xsession +++ b/core/modules/xorg/data/etc/X11/Xsession @@ -28,8 +28,10 @@ errormsg () { # Make sure we source the global profile - needed for ssh-agent, etc. [ -e "/etc/profile" ] && . "/etc/profile" -# Workaround to start Xsession. The original Xsession script includes error handling functionality and sources other scrips from the Xsession.d/ directory. +# Make sure we source the global profile - needed for ssh-agent, etc. +[ -e "/etc/profile" ] && source "/etc/profile" +# Workaround to start Xsession. The original Xsession script includes error handling functionality and sources other scrips from the Xsession.d/ directory. SESSIONDIR="/etc/X11/Xsession.d" tmpfile="$( mktemp "/tmp/xsession-log-$( date +%s )-XXXXXX" )" diff --git a/core/modules/xorg/data/usr/share/backgrounds/bwlp-1920x1080.png b/core/modules/xorg/data/usr/share/backgrounds/bwlp-1920x1080.png Binary files differnew file mode 100644 index 00000000..bcad928e --- /dev/null +++ b/core/modules/xorg/data/usr/share/backgrounds/bwlp-1920x1080.png diff --git a/core/modules/xorg/module.conf b/core/modules/xorg/module.conf index dfa86b3a..402b22e1 100644 --- a/core/modules/xorg/module.conf +++ b/core/modules/xorg/module.conf @@ -1,4 +1,7 @@ #!/bin/bash +REQUIRED_MODULES=" + slxlog +" REQUIRED_BINARIES=" X Xorg diff --git a/core/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/zram-swap.service b/core/modules/zram-swap/data/etc/systemd/system/sysinit.target.wants/zram-swap.service index c1754b11..c1754b11 120000 --- a/core/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/zram-swap.service +++ b/core/modules/zram-swap/data/etc/systemd/system/sysinit.target.wants/zram-swap.service diff --git a/core/rootfs/rootfs-stage32/data/etc/systemd/system/zram-swap.service b/core/modules/zram-swap/data/etc/systemd/system/zram-swap.service index a458b380..a458b380 100644 --- a/core/rootfs/rootfs-stage32/data/etc/systemd/system/zram-swap.service +++ b/core/modules/zram-swap/data/etc/systemd/system/zram-swap.service diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-zram_swap b/core/modules/zram-swap/data/opt/openslx/scripts/systemd-zram_swap index 413ce215..28a803d8 100755 --- a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-zram_swap +++ b/core/modules/zram-swap/data/opt/openslx/scripts/systemd-zram_swap @@ -18,6 +18,7 @@ ############################################################################# +export PATH=$PATH:/opt/openslx/sbin:/opt/openslx/bin # Add zram swap # Some older ubuntu kernels had a problem here, see https://bugs.launchpad.net/ubuntu/+source/linux-lts-raring/+bug/1217189 diff --git a/core/modules/zram-swap/module.build b/core/modules/zram-swap/module.build new file mode 100644 index 00000000..302131f1 --- /dev/null +++ b/core/modules/zram-swap/module.build @@ -0,0 +1,20 @@ +#!/bin/bash +fetch_source() { + : +} + +build() { + local BIN_LOCS= + for BIN in ${REQUIRED_BINARIES}; do + pinfo "checking $BIN" + BIN_LOCS+="$(which $BIN) " + pinfo "BINLOC: $BIN_LOC" + [ $? -ne 0 ] && perror "Failed to find ${BIN} on this system." + done + pinfo "TARCOPY: $BIN_LOCS" + tarcopy "${BIN_LOCS}" "${MODULE_BUILD_DIR}" +} + +post_copy() { + : +} diff --git a/core/modules/zram-swap/module.conf b/core/modules/zram-swap/module.conf new file mode 100644 index 00000000..6c9a90e4 --- /dev/null +++ b/core/modules/zram-swap/module.conf @@ -0,0 +1,4 @@ +REQUIRED_BINARIES=" + mkswap + swapon +" diff --git a/core/modules/zram-swap/module.conf.ubuntu b/core/modules/zram-swap/module.conf.ubuntu new file mode 100644 index 00000000..b009a960 --- /dev/null +++ b/core/modules/zram-swap/module.conf.ubuntu @@ -0,0 +1,3 @@ +REQUIRED_INSTALLED_PACKAGES=" + util-linux +" diff --git a/core/rootfs/rootfs-kernel/README b/core/rootfs/rootfs-kernel/README new file mode 100644 index 00000000..87cb6c88 --- /dev/null +++ b/core/rootfs/rootfs-kernel/README @@ -0,0 +1 @@ +-- This module is mostly for the install mode -- diff --git a/core/rootfs/rootfs-kernel/module.build b/core/rootfs/rootfs-kernel/module.build new file mode 100644 index 00000000..0ac57b6f --- /dev/null +++ b/core/rootfs/rootfs-kernel/module.build @@ -0,0 +1,31 @@ +#!/bin/bash +fetch_source() { + : +} + +build() { + : +} + +post_copy() { + # first copy kernel + copy_kernel + + # now copy all the firmware and kernel modules + # to preserve the build environment, we copy instead of moving + mkdir -p "${TARGET_BUILD_DIR}/lib" + rsync -aAXv "${KERNEL_BASE_DIR}/lib/firmware" "${TARGET_BUILD_DIR}/lib" || \ + perror "Failed to copy firmware to '${TARGET_BUILD_DIR}/lib'." + rsync -aAXv "${KERNEL_BASE_DIR}/lib/modules" "${TARGET_BUILD_DIR}/lib" || \ + perror "Failed to copy kernel modules to '${TARGET_BUILD_DIR}/lib'." + + # NOTE: if symlinks are present in ./lib/modules/<version>/kernel, they + # are likely pointing to mltk's kernel work dir, thus unusable in live + # systems. We just delete those for now. + for LINK in "${TARGET_BUILD_DIR}/lib/modules/${TARGET_KERNEL_LONG}/"{build,source}; do + if [ -h "${LINK}" ]; then + pinfo "Removing '${LINK}' as it won't point to a valid path on live systems." + unlink "${LINK}" || perror "Failed to unlink '${LINK}'." + fi + done +} diff --git a/core/rootfs/rootfs-kernel/module.conf b/core/rootfs/rootfs-kernel/module.conf new file mode 100644 index 00000000..ce993cdd --- /dev/null +++ b/core/rootfs/rootfs-kernel/module.conf @@ -0,0 +1 @@ +REQUIRED_MODULES="kernel" diff --git a/core/rootfs/rootfs-stage31/data/init b/core/rootfs/rootfs-stage31/data/init index 4615a4fb..5857362c 100755 --- a/core/rootfs/rootfs-stage31/data/init +++ b/core/rootfs/rootfs-stage31/data/init @@ -1,4 +1,4 @@ -#!/bin/ash +#!/opt/openslx/bin/ash # ----------------------------------------------------------------------------- # # Copyright (c) 2012..2018 bwLehrpool-Projektteam @@ -16,8 +16,18 @@ # First script for initial ramfs for OpenSLX linux stateless clients ############################################################################# -# set PATH correctly -export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/openslx/bin +# set PATH correctly including busybox's in /opt/openslx/* +export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/opt/openslx/bin:/opt/openslx/sbin + +# TODO fix this ugly part... +# some binaries have hardcoded path to /sbin, e.g. brctl needs /sbin/modprobe +# to load bridge.ko - thus we provide this by symlinking busybox's sbin folder. +# this hopefully covers most such hardcoded calls... +[ ! -d /sbin ] && ln -s /opt/openslx/sbin /sbin +# if /sbin is present, at least make sure we have modprobe... +[ ! -e /sbin/modprobe ] && ln -s /opt/openslx/sbin/modprobe /sbin/modprobe +# also make sure other script can use /bin/ash safely... +[ ! -e /bin/ash ] && ln -s /opt/openslx/bin/busybox /bin/ash # import common functions . "/inc/functions" @@ -153,7 +163,7 @@ showicon --icon "/opt/openslx/icons/active/??-rootfs.ppm" # copy files needed for stage3.2 to FUTURE_ROOT echo "Copying busybox etc. to stage32..." -tar -cp /bin/* /sbin/* | tar -xp -C "${FUTURE_ROOT}/opt/openslx/" +tar -cp /opt/openslx/bin/* /opt/openslx/sbin/* | tar -xp -C "${FUTURE_ROOT}/" mkdir -p "${FUTURE_ROOT}/opt/openslx/inc" cp -a "/inc/functions" "${FUTURE_ROOT}/opt/openslx/inc/" diff --git a/core/rootfs/rootfs-stage31/module.conf b/core/rootfs/rootfs-stage31/module.conf index e14b1c94..e95a1182 100644 --- a/core/rootfs/rootfs-stage31/module.conf +++ b/core/rootfs/rootfs-stage31/module.conf @@ -5,6 +5,7 @@ REQUIRED_BINARIES=" REQUIRED_MODULES=" busybox kernel + slxlog system-uuid haveged " diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver deleted file mode 100755 index 2d113638..00000000 --- a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -if lsmod | grep -q '^nvidia\s'; then - # nvidia kernel module was loaded in stage31 - download libs - version=$( cat /sys/module/nvidia/version ) - if [ -n "$version" ]; then - echo "Proprietary nvidia kernel drivers v$version loaded - fetch user space libs" - /opt/openslx/scripts/systemd-download_slx_addons "nvidia-libs@$version" - /opt/openslx/scripts/systemd-setup_slx_addons "nvidia-libs@$version" || exit 1 - fi -fi - -# Seems we can finally always do that; in fact, not doing so seems to crash VMs left and right -echo -e "# Written by load-gfx-driver\nSLX_VMWARE_3D=yes" >> "/opt/openslx/config" - -exit 0 diff --git a/core/rootfs/rootfs-stage32/module.build b/core/rootfs/rootfs-stage32/module.build index f20c5196..d6760002 100644 --- a/core/rootfs/rootfs-stage32/module.build +++ b/core/rootfs/rootfs-stage32/module.build @@ -101,9 +101,9 @@ post_copy() { init_users_and_groups # quick fix for missing group in /etc/group - add_group "lock" - add_group "nogroup" 65534 - USERID=65534 GROUPID=65534 add_user "nobody" + add_system_group "lock" + add_system_group "nogroup" 65534 + USERID=65534 GROUPID=65534 add_system_user "nobody" # setup root account PASSWORD= USER=root add_user diff --git a/core/rootfs/rootfs-stage32/module.conf b/core/rootfs/rootfs-stage32/module.conf index 5fb5a08a..f875a1eb 100644 --- a/core/rootfs/rootfs-stage32/module.conf +++ b/core/rootfs/rootfs-stage32/module.conf @@ -2,6 +2,7 @@ REQUIRED_MODULES=" kernel vmware-version-check + slxlog " REQUIRED_BINARIES=" bash diff --git a/core/targets/bwlp/cpugovernor b/core/targets/bwlp/cpugovernor deleted file mode 120000 index 544c1e19..00000000 --- a/core/targets/bwlp/cpugovernor +++ /dev/null @@ -1 +0,0 @@ -../../modules/cpugovernor
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/cups b/core/targets/bwlp/cups index 0ff7101d..0ff7101d 120000 --- a/core/targets/stage32-bwlp/cups +++ b/core/targets/bwlp/cups diff --git a/core/targets/stage32-bwlp/cups-sicgs b/core/targets/bwlp/cups-sicgs index b1a9410a..b1a9410a 120000 --- a/core/targets/stage32-bwlp/cups-sicgs +++ b/core/targets/bwlp/cups-sicgs diff --git a/core/targets/stage32-bwlp/dbus b/core/targets/bwlp/dbus index dd148715..dd148715 120000 --- a/core/targets/stage32-bwlp/dbus +++ b/core/targets/bwlp/dbus diff --git a/core/targets/bwlp/demo-user b/core/targets/bwlp/demo-user new file mode 120000 index 00000000..4629e7c2 --- /dev/null +++ b/core/targets/bwlp/demo-user @@ -0,0 +1 @@ +../../modules/demo-user
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/dhcpc-busybox b/core/targets/bwlp/dhcpc-busybox index ea3634e6..ea3634e6 120000 --- a/core/targets/stage32-bwlp/dhcpc-busybox +++ b/core/targets/bwlp/dhcpc-busybox diff --git a/core/targets/stage32-bwlp/dnbd3-proxy-mode b/core/targets/bwlp/dnbd3-proxy-mode index 41ea3e29..41ea3e29 120000 --- a/core/targets/stage32-bwlp/dnbd3-proxy-mode +++ b/core/targets/bwlp/dnbd3-proxy-mode diff --git a/core/targets/stage32-bwlp/etherwake b/core/targets/bwlp/etherwake index ffab42e9..ffab42e9 120000 --- a/core/targets/stage32-bwlp/etherwake +++ b/core/targets/bwlp/etherwake diff --git a/core/targets/stage32-bwlp/german b/core/targets/bwlp/german index 4469f96e..4469f96e 120000 --- a/core/targets/stage32-bwlp/german +++ b/core/targets/bwlp/german diff --git a/core/targets/bwlp/haveged b/core/targets/bwlp/haveged new file mode 120000 index 00000000..0b7544e6 --- /dev/null +++ b/core/targets/bwlp/haveged @@ -0,0 +1 @@ +../../modules/haveged
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/iperf b/core/targets/bwlp/iperf index 29aec282..29aec282 120000 --- a/core/targets/stage32-bwlp/iperf +++ b/core/targets/bwlp/iperf diff --git a/core/targets/stage32-bwlp/iptables b/core/targets/bwlp/iptables index 1f5e94e4..1f5e94e4 120000 --- a/core/targets/stage32-bwlp/iptables +++ b/core/targets/bwlp/iptables diff --git a/core/targets/bwlp/kernel b/core/targets/bwlp/kernel index 041dc99f..1369e8ff 120000 --- a/core/targets/bwlp/kernel +++ b/core/targets/bwlp/kernel @@ -1 +1 @@ -../../modules/kernel-system
\ No newline at end of file +../../modules/kernel-vanilla
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/kexec-reboot b/core/targets/bwlp/kexec-reboot index ee22d7f9..ee22d7f9 120000 --- a/core/targets/stage32-bwlp/kexec-reboot +++ b/core/targets/bwlp/kexec-reboot diff --git a/core/targets/bwlp/kiosk-netpoint b/core/targets/bwlp/kiosk-netpoint deleted file mode 120000 index 71d41c3e..00000000 --- a/core/targets/bwlp/kiosk-netpoint +++ /dev/null @@ -1 +0,0 @@ -../../modules/kiosk-netpoint
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/kiosk-slxbrowser b/core/targets/bwlp/kiosk-slxbrowser index acbe5acc..acbe5acc 120000 --- a/core/targets/stage32-bwlp/kiosk-slxbrowser +++ b/core/targets/bwlp/kiosk-slxbrowser diff --git a/core/targets/stage32-bwlp/mgmt-sshd b/core/targets/bwlp/mgmt-sshd index 52a1f3f6..52a1f3f6 120000 --- a/core/targets/stage32-bwlp/mgmt-sshd +++ b/core/targets/bwlp/mgmt-sshd diff --git a/core/targets/bwlp/network-online-slx-targets b/core/targets/bwlp/network-online-slx-targets new file mode 120000 index 00000000..b022ecc2 --- /dev/null +++ b/core/targets/bwlp/network-online-slx-targets @@ -0,0 +1 @@ +../../modules/network-online-slx-targets
\ No newline at end of file diff --git a/core/targets/bwlp/networkd-dispatcher b/core/targets/bwlp/networkd-dispatcher deleted file mode 120000 index f2363cfe..00000000 --- a/core/targets/bwlp/networkd-dispatcher +++ /dev/null @@ -1 +0,0 @@ -../../modules/networkd-dispatcher
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/openbox b/core/targets/bwlp/openbox index 0fb8d86d..0fb8d86d 120000 --- a/core/targets/stage32-bwlp/openbox +++ b/core/targets/bwlp/openbox diff --git a/core/targets/stage32-bwlp/pam-slx-plug b/core/targets/bwlp/pam-slx-plug index 46dc9d79..46dc9d79 120000 --- a/core/targets/stage32-bwlp/pam-slx-plug +++ b/core/targets/bwlp/pam-slx-plug diff --git a/core/targets/stage32-bwlp/pam-slxlog-session b/core/targets/bwlp/pam-slxlog-session index 6b69e710..6b69e710 120000 --- a/core/targets/stage32-bwlp/pam-slxlog-session +++ b/core/targets/bwlp/pam-slxlog-session diff --git a/core/targets/stage32-bwlp/parse-edid b/core/targets/bwlp/parse-edid index b6213669..b6213669 120000 --- a/core/targets/stage32-bwlp/parse-edid +++ b/core/targets/bwlp/parse-edid diff --git a/core/targets/stage32-bwlp/qt5core b/core/targets/bwlp/qt5core index 18ee398d..18ee398d 120000 --- a/core/targets/stage32-bwlp/qt5core +++ b/core/targets/bwlp/qt5core diff --git a/core/targets/stage32-bwlp/rdns b/core/targets/bwlp/rdns index 6fe47dc5..6fe47dc5 120000 --- a/core/targets/stage32-bwlp/rdns +++ b/core/targets/bwlp/rdns diff --git a/core/targets/bwlp/remote-access b/core/targets/bwlp/remote-access new file mode 120000 index 00000000..228ddbc4 --- /dev/null +++ b/core/targets/bwlp/remote-access @@ -0,0 +1 @@ +../../modules/remote-access
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/safe-mode b/core/targets/bwlp/safe-mode index 86422724..86422724 120000 --- a/core/targets/stage32-bwlp/safe-mode +++ b/core/targets/bwlp/safe-mode diff --git a/core/targets/stage32-bwlp/slx-issue b/core/targets/bwlp/slx-issue index 83768536..83768536 120000 --- a/core/targets/stage32-bwlp/slx-issue +++ b/core/targets/bwlp/slx-issue diff --git a/core/targets/stage32-bwlp/slx-tools b/core/targets/bwlp/slx-tools index 20c7450b..20c7450b 120000 --- a/core/targets/stage32-bwlp/slx-tools +++ b/core/targets/bwlp/slx-tools diff --git a/core/targets/bwlp/slxbrowser b/core/targets/bwlp/slxbrowser new file mode 120000 index 00000000..033414fa --- /dev/null +++ b/core/targets/bwlp/slxbrowser @@ -0,0 +1 @@ +../../modules/slxbrowser
\ No newline at end of file diff --git a/core/targets/bwlp/slxlog b/core/targets/bwlp/slxlog deleted file mode 120000 index ed2687a9..00000000 --- a/core/targets/bwlp/slxlog +++ /dev/null @@ -1 +0,0 @@ -../../modules/slxlog/
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/smbclient b/core/targets/bwlp/smbclient index 9fed855f..9fed855f 120000 --- a/core/targets/stage32-bwlp/smbclient +++ b/core/targets/bwlp/smbclient diff --git a/core/targets/stage32-bwlp/sshd b/core/targets/bwlp/sshd index 56b4e4b5..56b4e4b5 120000 --- a/core/targets/stage32-bwlp/sshd +++ b/core/targets/bwlp/sshd diff --git a/core/targets/stage32-bwlp/sudo b/core/targets/bwlp/sudo index 5c0a121b..5c0a121b 120000 --- a/core/targets/stage32-bwlp/sudo +++ b/core/targets/bwlp/sudo diff --git a/core/targets/stage32-bwlp/system-check b/core/targets/bwlp/system-check index c1fbcf69..c1fbcf69 120000 --- a/core/targets/stage32-bwlp/system-check +++ b/core/targets/bwlp/system-check diff --git a/core/targets/bwlp/system-uuid b/core/targets/bwlp/system-uuid new file mode 120000 index 00000000..83bcac51 --- /dev/null +++ b/core/targets/bwlp/system-uuid @@ -0,0 +1 @@ +../../modules/system-uuid
\ No newline at end of file diff --git a/core/targets/bwlp/vmware b/core/targets/bwlp/vmware deleted file mode 120000 index 81fa2c91..00000000 --- a/core/targets/bwlp/vmware +++ /dev/null @@ -1 +0,0 @@ -../../modules/vmware
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/xscreensaver b/core/targets/bwlp/xscreensaver index d2f4f1a8..d2f4f1a8 120000 --- a/core/targets/stage32-bwlp/xscreensaver +++ b/core/targets/bwlp/xscreensaver diff --git a/core/targets/nvidia-libs@NVIDIA_VERSIONS/.addon b/core/targets/nvidia-libs@NVIDIA_VERSIONS/.addon new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/core/targets/nvidia-libs@NVIDIA_VERSIONS/.addon diff --git a/core/targets/stage32-bwlp/alsa b/core/targets/stage32-bwlp/alsa deleted file mode 120000 index 7e13d263..00000000 --- a/core/targets/stage32-bwlp/alsa +++ /dev/null @@ -1 +0,0 @@ -../../modules/alsa
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/beamergui b/core/targets/stage32-bwlp/beamergui deleted file mode 120000 index 5e863316..00000000 --- a/core/targets/stage32-bwlp/beamergui +++ /dev/null @@ -1 +0,0 @@ -../../modules/beamergui
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/bwlp b/core/targets/stage32-bwlp/bwlp new file mode 120000 index 00000000..b98ed014 --- /dev/null +++ b/core/targets/stage32-bwlp/bwlp @@ -0,0 +1 @@ +../../targets/bwlp
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/debug-report-bwlp b/core/targets/stage32-bwlp/debug-report-bwlp deleted file mode 120000 index 54a528ce..00000000 --- a/core/targets/stage32-bwlp/debug-report-bwlp +++ /dev/null @@ -1 +0,0 @@ -../../modules/debug-report-bwlp
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/dmidecode b/core/targets/stage32-bwlp/dmidecode deleted file mode 120000 index 608c2bb5..00000000 --- a/core/targets/stage32-bwlp/dmidecode +++ /dev/null @@ -1 +0,0 @@ -../../modules/dmidecode
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/dnbd3 b/core/targets/stage32-bwlp/dnbd3 deleted file mode 120000 index fa80b45c..00000000 --- a/core/targets/stage32-bwlp/dnbd3 +++ /dev/null @@ -1 +0,0 @@ -../../modules/dnbd3
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/dunst b/core/targets/stage32-bwlp/dunst deleted file mode 120000 index e3927e25..00000000 --- a/core/targets/stage32-bwlp/dunst +++ /dev/null @@ -1 +0,0 @@ -../../modules/dunst
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/gfx-driver b/core/targets/stage32-bwlp/gfx-driver new file mode 120000 index 00000000..0047710f --- /dev/null +++ b/core/targets/stage32-bwlp/gfx-driver @@ -0,0 +1 @@ +../../modules/gfx-driver
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/hardware-stats b/core/targets/stage32-bwlp/hardware-stats deleted file mode 120000 index 3e5e637b..00000000 --- a/core/targets/stage32-bwlp/hardware-stats +++ /dev/null @@ -1 +0,0 @@ -../../modules/hardware-stats
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/idleaction b/core/targets/stage32-bwlp/idleaction deleted file mode 120000 index 09fd9493..00000000 --- a/core/targets/stage32-bwlp/idleaction +++ /dev/null @@ -1 +0,0 @@ -../../modules/idleaction
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/iptables-helper b/core/targets/stage32-bwlp/iptables-helper deleted file mode 120000 index e449282d..00000000 --- a/core/targets/stage32-bwlp/iptables-helper +++ /dev/null @@ -1 +0,0 @@ -../../modules/iptables-helper
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/kernel b/core/targets/stage32-bwlp/kernel deleted file mode 120000 index 1369e8ff..00000000 --- a/core/targets/stage32-bwlp/kernel +++ /dev/null @@ -1 +0,0 @@ -../../modules/kernel-vanilla
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/kiosk-common b/core/targets/stage32-bwlp/kiosk-common deleted file mode 120000 index 885bb3d6..00000000 --- a/core/targets/stage32-bwlp/kiosk-common +++ /dev/null @@ -1 +0,0 @@ -../../modules/kiosk-common
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/lightdm b/core/targets/stage32-bwlp/lightdm deleted file mode 120000 index 05feb71c..00000000 --- a/core/targets/stage32-bwlp/lightdm +++ /dev/null @@ -1 +0,0 @@ -../../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 deleted file mode 120000 index 694092d5..00000000 --- a/core/targets/stage32-bwlp/lightdm-greeter-bwlp +++ /dev/null @@ -1 +0,0 @@ -../../modules/lightdm-greeter-bwlp
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/nscd b/core/targets/stage32-bwlp/nscd deleted file mode 120000 index d7e411d2..00000000 --- a/core/targets/stage32-bwlp/nscd +++ /dev/null @@ -1 +0,0 @@ -../../modules/nscd
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/pam b/core/targets/stage32-bwlp/pam deleted file mode 120000 index 588acdbf..00000000 --- a/core/targets/stage32-bwlp/pam +++ /dev/null @@ -1 +0,0 @@ -../../modules/pam
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/pam-bwidm b/core/targets/stage32-bwlp/pam-bwidm deleted file mode 120000 index b6847cd8..00000000 --- a/core/targets/stage32-bwlp/pam-bwidm +++ /dev/null @@ -1 +0,0 @@ -../../modules/pam-bwidm
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/printergui b/core/targets/stage32-bwlp/printergui deleted file mode 120000 index 6ccbb628..00000000 --- a/core/targets/stage32-bwlp/printergui +++ /dev/null @@ -1 +0,0 @@ -../../modules/printergui
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/pvs2 b/core/targets/stage32-bwlp/pvs2 deleted file mode 120000 index 01875515..00000000 --- a/core/targets/stage32-bwlp/pvs2 +++ /dev/null @@ -1 +0,0 @@ -../../modules/pvs2
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/redsocks b/core/targets/stage32-bwlp/redsocks deleted file mode 120000 index 0740c53b..00000000 --- a/core/targets/stage32-bwlp/redsocks +++ /dev/null @@ -1 +0,0 @@ -../../modules/redsocks
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/run-virt b/core/targets/stage32-bwlp/run-virt deleted file mode 120000 index 1e4a476c..00000000 --- a/core/targets/stage32-bwlp/run-virt +++ /dev/null @@ -1 +0,0 @@ -../../modules/run-virt
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/slxlog b/core/targets/stage32-bwlp/slxlog new file mode 120000 index 00000000..53e65a12 --- /dev/null +++ b/core/targets/stage32-bwlp/slxlog @@ -0,0 +1 @@ +../../modules/slxlog
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/smartctl b/core/targets/stage32-bwlp/smartctl deleted file mode 120000 index 3a48434f..00000000 --- a/core/targets/stage32-bwlp/smartctl +++ /dev/null @@ -1 +0,0 @@ -../../modules/smartctl
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/speedcheck b/core/targets/stage32-bwlp/speedcheck deleted file mode 120000 index dfed5b4e..00000000 --- a/core/targets/stage32-bwlp/speedcheck +++ /dev/null @@ -1 +0,0 @@ -../../modules/speedcheck
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/ssh-auth-keys b/core/targets/stage32-bwlp/ssh-auth-keys deleted file mode 120000 index 7dc12941..00000000 --- a/core/targets/stage32-bwlp/ssh-auth-keys +++ /dev/null @@ -1 +0,0 @@ -../../modules/ssh-auth-keys
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/sssd b/core/targets/stage32-bwlp/sssd deleted file mode 120000 index 753208d8..00000000 --- a/core/targets/stage32-bwlp/sssd +++ /dev/null @@ -1 +0,0 @@ -../../modules/sssd
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/vmchooser2 b/core/targets/stage32-bwlp/vmchooser2 deleted file mode 120000 index bfdabcb7..00000000 --- a/core/targets/stage32-bwlp/vmchooser2 +++ /dev/null @@ -1 +0,0 @@ -../../modules/vmchooser2
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/x11vnc b/core/targets/stage32-bwlp/x11vnc deleted file mode 120000 index eb755d19..00000000 --- a/core/targets/stage32-bwlp/x11vnc +++ /dev/null @@ -1 +0,0 @@ -../../modules/x11vnc
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/xorg b/core/targets/stage32-bwlp/xorg deleted file mode 120000 index a9494860..00000000 --- a/core/targets/stage32-bwlp/xorg +++ /dev/null @@ -1 +0,0 @@ -../../modules/xorg
\ No newline at end of file diff --git a/core/targets/stage32-bwlp/zram-swap b/core/targets/stage32-bwlp/zram-swap new file mode 120000 index 00000000..e95089cc --- /dev/null +++ b/core/targets/stage32-bwlp/zram-swap @@ -0,0 +1 @@ +../../modules/zram-swap
\ No newline at end of file diff --git a/core/targets/stage4/bwlp b/core/targets/stage4/bwlp new file mode 120000 index 00000000..b98ed014 --- /dev/null +++ b/core/targets/stage4/bwlp @@ -0,0 +1 @@ +../../targets/bwlp
\ No newline at end of file diff --git a/core/targets/stage4/disk-partitions b/core/targets/stage4/disk-partitions new file mode 120000 index 00000000..49705f9a --- /dev/null +++ b/core/targets/stage4/disk-partitions @@ -0,0 +1 @@ +../../modules/disk-partitions
\ No newline at end of file diff --git a/core/targets/stage4/gfx-driver b/core/targets/stage4/gfx-driver new file mode 120000 index 00000000..0047710f --- /dev/null +++ b/core/targets/stage4/gfx-driver @@ -0,0 +1 @@ +../../modules/gfx-driver
\ No newline at end of file diff --git a/core/targets/bwlp/kiosk-chromium b/core/targets/stage4/kiosk-chromium index 703f83b0..703f83b0 120000 --- a/core/targets/bwlp/kiosk-chromium +++ b/core/targets/stage4/kiosk-chromium diff --git a/core/targets/stage4/nvidia-common b/core/targets/stage4/nvidia-common new file mode 120000 index 00000000..b44a22fe --- /dev/null +++ b/core/targets/stage4/nvidia-common @@ -0,0 +1 @@ +../../modules/nvidia-common
\ No newline at end of file diff --git a/core/targets/stage4/nvidia-kernel b/core/targets/stage4/nvidia-kernel new file mode 120000 index 00000000..41abd1ca --- /dev/null +++ b/core/targets/stage4/nvidia-kernel @@ -0,0 +1 @@ +../../modules/nvidia-kernel
\ No newline at end of file diff --git a/core/targets/stage4/rootfs-kernel b/core/targets/stage4/rootfs-kernel new file mode 120000 index 00000000..052f597a --- /dev/null +++ b/core/targets/stage4/rootfs-kernel @@ -0,0 +1 @@ +../../rootfs/rootfs-kernel
\ No newline at end of file diff --git a/core/targets/stage4/run-virt-docker b/core/targets/stage4/run-virt-docker new file mode 120000 index 00000000..cb7ab8f1 --- /dev/null +++ b/core/targets/stage4/run-virt-docker @@ -0,0 +1 @@ +../../modules/run-virt-docker
\ No newline at end of file diff --git a/core/targets/stage4/slxlog b/core/targets/stage4/slxlog new file mode 120000 index 00000000..53e65a12 --- /dev/null +++ b/core/targets/stage4/slxlog @@ -0,0 +1 @@ +../../modules/slxlog
\ No newline at end of file diff --git a/core/targets/stage4/virtualbox b/core/targets/stage4/virtualbox new file mode 120000 index 00000000..c0ee823e --- /dev/null +++ b/core/targets/stage4/virtualbox @@ -0,0 +1 @@ +../../modules/vbox-src
\ No newline at end of file diff --git a/core/targets/stage4/vmware-version-check b/core/targets/stage4/vmware-version-check new file mode 120000 index 00000000..fac1392c --- /dev/null +++ b/core/targets/stage4/vmware-version-check @@ -0,0 +1 @@ +../../modules/vmware-version-check
\ No newline at end of file diff --git a/core/targets/stage4/zram-swap b/core/targets/stage4/zram-swap new file mode 120000 index 00000000..e95089cc --- /dev/null +++ b/core/targets/stage4/zram-swap @@ -0,0 +1 @@ +../../modules/zram-swap
\ No newline at end of file diff --git a/core/targets/vmware-legacy/.addon b/core/targets/vmware-legacy/.addon new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/core/targets/vmware-legacy/.addon diff --git a/core/targets/vmware-legacy/slxlog b/core/targets/vmware-legacy/slxlog new file mode 120000 index 00000000..53e65a12 --- /dev/null +++ b/core/targets/vmware-legacy/slxlog @@ -0,0 +1 @@ +../../modules/slxlog
\ No newline at end of file diff --git a/core/targets/vmware-legacy/vmware b/core/targets/vmware-legacy/vmware12 index ea1b2f86..ea1b2f86 120000 --- a/core/targets/vmware-legacy/vmware +++ b/core/targets/vmware-legacy/vmware12 diff --git a/core/targets/vmware/.addon b/core/targets/vmware/.addon new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/core/targets/vmware/.addon diff --git a/core/targets/vmware/slxlog b/core/targets/vmware/slxlog new file mode 120000 index 00000000..53e65a12 --- /dev/null +++ b/core/targets/vmware/slxlog @@ -0,0 +1 @@ +../../modules/slxlog
\ No newline at end of file @@ -205,6 +205,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'." @@ -250,6 +254,7 @@ REMOTE_EXPORT="0" REMOTE_LIST_CLEAN="" REMOTE_LIST_BUILD="" REMOTE_AUTOMATIC_BUILD=0 +REMOTE_LOCAL_INSTALL=0 initial_checks read_params $@ |