summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rwxr-xr-xcore/modules/debug-report-bwlp/data/opt/openslx/bin/debug_report3
-rwxr-xr-xcore/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx12
-rwxr-xr-xcore/modules/dnbd3-proxy-mode/data/opt/openslx/scripts/systemd-setup_dnbd3_proxy6
-rw-r--r--core/modules/kernel-vanilla/module.conf2
-rwxr-xr-xcore/modules/openbox/data/etc/xdg/openbox/autostart21
-rwxr-xr-xcore/modules/pam-slx-plug/data/opt/openslx/pam/systemd/create-pam-config6
-rw-r--r--core/modules/pam/module.build27
-rw-r--r--core/modules/pam/module.conf5
-rwxr-xr-xcore/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/90_runscript.inc8
-rw-r--r--core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc49
-rw-r--r--core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc73
-rw-r--r--core/modules/sudo/data/etc/sudoers2
-rw-r--r--core/modules/sudo/module.build14
-rw-r--r--core/modules/sudo/module.conf11
-rw-r--r--core/modules/sudo/module.conf.ubuntu4
-rw-r--r--core/modules/vbox-src/module.conf2
-rw-r--r--core/modules/vmware12/module.build2
-rw-r--r--core/modules/vmware15/module.build2
-rw-r--r--core/rootfs/rootfs-stage31/data/inc/network.functions45
-rw-r--r--core/rootfs/rootfs-stage31/data/inc/setup_network27
-rw-r--r--core/rootfs/rootfs-stage31/data/inc/setup_network_retry41
l---------core/targets/stage32-bwlp/sudo1
22 files changed, 247 insertions, 116 deletions
diff --git a/core/modules/debug-report-bwlp/data/opt/openslx/bin/debug_report b/core/modules/debug-report-bwlp/data/opt/openslx/bin/debug_report
index 9f01a1ed..308cb9e2 100755
--- a/core/modules/debug-report-bwlp/data/opt/openslx/bin/debug_report
+++ b/core/modules/debug-report-bwlp/data/opt/openslx/bin/debug_report
@@ -73,8 +73,7 @@ fi
echo -n "."
-cp /var/log/Xorg.0.lo* static/ 2> /dev/null
-cp -r /var/log/{auth.log,kdm.log,syslog,messages,user.log,cups} static/ 2> /dev/null
+cp -r /var/log/Xorg.0.lo* /var/log/{auth.log,kdm.log,syslog,messages,user.log,cups,openslx,lightdm} static/ 2> /dev/null
cp /proc/{cpu,mem}info /proc/{mtrr,interrupts} /proc/driver/nvidia/{params,registry} static/proc/ 2> /dev/null
echo -n "."
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 98421b78..eb97458a 100755
--- a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx
+++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/udhcpc-openslx
@@ -77,12 +77,16 @@ case "$1" in
check_env "$1"
mkdir -p "/run/dhcpc"
# Set address on interface
- ip addr add "$ip/$(ipcalc -s -p "$ip" "$subnet" | sed s/.*=//)" dev "$interface"
+ ip addr add "$ip/$( ipcalc -s -p "$ip" "$subnet" | sed 's/.*=//' )" dev "$interface"
# Set default route, if given
if [ -n "$router" ]; then
- ip route replace default via "$router"
+ # Only replace route if it's the same interface as the current default route, or we don't have any
+ current="$( ip route show | awk '{ if ($1 == "default") {print $5; exit 0}}' )"
+ if [ -z "$current" ] || [ "$interface" = "$current" ]; then
+ ip route replace default via "$router"
+ fi
fi
-
+
# get domain, hostname and thus fqdn from DNS
dns_fqdn=$(busybox timeout -t 3 rdns "$ip")
dns_short="${dns_fqdn%%.*}"
@@ -98,7 +102,7 @@ case "$1" in
:
elif [ -n "$dns_fqdn" ]; then
domain="${dns_fqdn#*.}"
-
+
elif [ -n "$SLX_NET_DOMAIN" ]; then
domain="$SLX_NET_DOMAIN"
fi
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 907ab59d..11a0e31a 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
@@ -130,6 +130,8 @@ if [ -n "$islocal" ]; then
# Local caching mode.
DNBD3_SPARSE="true"
+ DNBD3_PRETEND_CLIENT="true"
+ DNBD3_AUTOFREE=0 # Immediately start freeing images when running out of space in local caching mode
if [ -n "$SLX_DNBD3_MIN_GB_HASH" ] && [ "$SLX_DNBD3_MIN_GB_HASH" -gt 0 ] && [ "$disksize" -ge "$SLX_DNBD3_MIN_GB_HASH" ]; then
DNBD3_BGR="hashblock"
else
@@ -147,8 +149,10 @@ else
# Proxy mode
DNBD3_SPARSE="false"
+ DNBD3_PRETEND_CLIENT="false"
DNBD3_BGR="false"
DNBD3_LOOKUP="false"
+ DNBD3_AUTOFREE="18h"
DNBD3_SERVER_PENALTY=2000 # no BGR = don't like other servers connecting so much
if [ -n "${SLX_DNBD3_BGR}" ]; then
DNBD3_BGR="true"
@@ -235,6 +239,8 @@ sparseFiles=${DNBD3_SPARSE}
removeMissingImages=false
uplinkTimeout=5000
clientTimeout=15000
+pretendClient=${DNBD3_PRETEND_CLIENT}
+autoFreeDiskSpaceDelay=${DNBD3_AUTOFREE}
[limits]
maxReplicationSize=${MAX_REPLICATION_SIZE}G
diff --git a/core/modules/kernel-vanilla/module.conf b/core/modules/kernel-vanilla/module.conf
index b30f0e07..a0d11a4e 100644
--- a/core/modules/kernel-vanilla/module.conf
+++ b/core/modules/kernel-vanilla/module.conf
@@ -2,5 +2,5 @@
REQUIRED_BINARIES=""
REQUIRED_LIBRARIES=""
REQUIRED_DIRECTORIES=""
-REQUIRED_KERNEL="4.19.34"
+REQUIRED_KERNEL="4.19.72"
REQUIRED_GIT="git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git"
diff --git a/core/modules/openbox/data/etc/xdg/openbox/autostart b/core/modules/openbox/data/etc/xdg/openbox/autostart
new file mode 100755
index 00000000..2eb7a5e3
--- /dev/null
+++ b/core/modules/openbox/data/etc/xdg/openbox/autostart
@@ -0,0 +1,21 @@
+#
+# These things are run when an Openbox X Session is started.
+# You may place a similar script in $HOME/.config/openbox/autostart
+# to run user-specific things.
+#
+
+# If you want to use GNOME config tools...
+#
+#if test -x /usr/lib/x86_64-linux-gnu/gnome-settings-daemon >/dev/null; then
+# /usr/lib/x86_64-linux-gnu/gnome-settings-daemon &
+#elif which gnome-settings-daemon >/dev/null 2>&1; then
+# gnome-settings-daemon &
+#fi
+
+# If you want to use XFCE config tools...
+#
+#xfce-mcs-manager &
+## END SAMPLE CONFIG
+
+# bwLehrpool: only start an xterm
+xterm &
diff --git a/core/modules/pam-slx-plug/data/opt/openslx/pam/systemd/create-pam-config b/core/modules/pam-slx-plug/data/opt/openslx/pam/systemd/create-pam-config
index a4daa837..18936603 100755
--- a/core/modules/pam-slx-plug/data/opt/openslx/pam/systemd/create-pam-config
+++ b/core/modules/pam-slx-plug/data/opt/openslx/pam/systemd/create-pam-config
@@ -69,14 +69,14 @@ write_sssd_config() {
return 0 # OK
}
-# Our plugin, but account ONLY since it's fast
-account+=("[success=%NUM% new_authtok_reqd=done default=ignore] pam_exec.so quiet /opt/openslx/pam/exec_account")
-
# unix
auth+=("[success=%NUM% default=ignore] pam_unix.so nodelay")
account+=("[success=%NUM% new_authtok_reqd=done default=ignore] pam_unix.so")
nss+=("files" "cache")
+# Our plugin, but account ONLY since it's fast (it's not if not executed in root context so move after unix)
+account+=("[success=%NUM% new_authtok_reqd=done default=ignore] pam_exec.so quiet /opt/openslx/pam/exec_account")
+
# check for bwIDM
if [ -x "/opt/openslx/scripts/pam_bwidm" ]; then
auth+=("[success=%NUM% default=ignore] pam_exec.so quiet expose_authtok /opt/openslx/scripts/pam_bwidm")
diff --git a/core/modules/pam/module.build b/core/modules/pam/module.build
index 6682e4a2..88624cbe 100644
--- a/core/modules/pam/module.build
+++ b/core/modules/pam/module.build
@@ -2,21 +2,7 @@
fetch_source() {
# get pam-script source
- download_untar "$REQUIRED_PAM_SCRIPT_URL" "src/"
- # Distribution switch: openSuse 13.1 has no package nss-ldap:
- if [ -n "$REQUIRED_NSS_LDAPD_URL" ]; then
- pinfo "Downloading $REQUIRED_NSS_LDAPD_URL ..."
- download_untar "$REQUIRED_NSS_LDAPD_URL" "src/"
- fi
- # Distribution switch: Ubuntu 14.04 dropped packages ncpfs and libncp:
- if [[ "$SYS_DISTRIBUTION" == "ubuntu" && "$SYS_VERSION" == "14.04" ]]; then
- for file in $REQUIRED_DOWNLOAD_URLS; do
- local package="$(basename $file)"
- pinfo "Downloading and installing package $package ..."
- download_if_empty "$file" "src/$package"
- dpkg -i "src/$package" || perror "Could not install package $package."
- done
- fi
+ autoclone
}
build() {
@@ -29,8 +15,15 @@ build() {
# build pam-script separatly since we use a source tarball
- # HACK: find pam_unix.so in MODULE_BUILD_DIR to see where to put pam_script at
- cd "${MODULE_WORK_DIR}/src/pam-script-${REQUIRED_PAM_SCRIPT_VERSION}" || perror "Could not cd to ${MODULE_WORK_DIR}/src/pam-script-${REQUIRED_PAM_SCRIPT_VERSION}."
+ # HACK: find pam_unix.so in MODULE_BUILD_DIR to see where to put pam_script
+ cde "${MODULE_WORK_DIR}/src/pam_script"
+ for i in 1 2 3; do # FUCK THIS BRAIN DAMAGE!
+ libtoolize
+ automake --add-missing
+ autoreconf
+ aclocal
+ autoheader
+ done
./configure --prefix=/ --sysconfdir=/etc/pam-script --libdir="$SYS_PAM_MODULES_PATH" || perror "pam-script: ./configure failed."
make DESTDIR="${MODULE_BUILD_DIR}" install || perror "pam-script: make install to ${MODULE_BUILD_DIR} failed."
}
diff --git a/core/modules/pam/module.conf b/core/modules/pam/module.conf
index 667dadf6..bb63a8c7 100644
--- a/core/modules/pam/module.conf
+++ b/core/modules/pam/module.conf
@@ -27,5 +27,6 @@ REQUIRED_SYSTEM_FILES="
/etc/login.defs
/etc/securetty
"
-REQUIRED_PAM_SCRIPT_VERSION="1.1.6"
-REQUIRED_PAM_SCRIPT_URL="http://downloads.sourceforge.net/project/pam-script/pam-script-${REQUIRED_PAM_SCRIPT_VERSION}.tar.gz"
+REQUIRED_GIT="
+ https://github.com/jeroennijhof/pam_script.git
+"
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/90_runscript.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/90_runscript.inc
index 0cd47427..697e14de 100755
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/90_runscript.inc
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/data/linux/includes/90_runscript.inc
@@ -26,10 +26,10 @@ function runscript_visibility()
get_xauthfile
wait_for_wm
if [ -n "$USERPART" ]; then
- logger "openslx utility: runscript_visibility: Starting script $SCRIPT maximised(${VISIBILITY}), no USERPART."
+ logger "openslx utility: runscript_visibility: Starting script $SCRIPT maximised(${VISIBILITY}) with: $USERPART."
DISPLAY=:0.0 XAUTHORITY="${XAUTHORITY}" $USERPART "xterm $SCRIPT"
else
- logger "openslx utility: runscript_visibility: Starting script $SCRIPT maximised(${VISIBILITY}), $USERPART."
+ logger "openslx utility: runscript_visibility: Starting script $SCRIPT maximised(${VISIBILITY}) without any USERPART."
DISPLAY=:0.0 XAUTHORITY="${XAUTHORITY}" $USERPART xterm "$SCRIPT"
fi
;;
@@ -42,10 +42,10 @@ function runscript_visibility()
# check for DE readiness. Until then, we'll sleep.
# sleep 20
if [ -n "$USERPART" ]; then
- logger "openslx utility: runscript_visibility: Starting script $SCRIPT minimised(${VISIBILITY}), no USERPART."
+ logger "openslx utility: runscript_visibility: Starting script $SCRIPT minimised(${VISIBILITY}) with: $USERPART."
DISPLAY=:0.0 XAUTHORITY="${XAUTHORITY}" $USERPART "xterm -iconic $SCRIPT"
else
- logger "openslx utility: runscript_visibility: Starting script $SCRIPT minimised(${VISIBILITY}), $USERPART."
+ logger "openslx utility: runscript_visibility: Starting script $SCRIPT minimised(${VISIBILITY}) without any USERPART."
DISPLAY=:0.0 XAUTHORITY="${XAUTHORITY}" $USERPART xterm -iconic "$SCRIPT"
fi
;;
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc
index 749991bb..c080be8c 100644
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/start_windowmanager.inc
@@ -23,21 +23,46 @@ start_wm() {
# start RUNVIRT_DM determined above
writelog "Starting ${RUNVIRT_DM}."
- if [ "${RUNVIRT_DM}" = "fvwm2" ]; then
+ declare -a OPTS=()
+ case "$RUNVIRT_DM" in
+ openbox|kwin|xfwm4|metacity)
+ OPTS+=( "--replace" )
+ ;;
+ fvwm2)
# fvwm2 is not even in the minilinux, so this might be obsolete...
- echo "EdgeScroll 0 0" > ${TMPDIR}/fvwm
- fvwm2 -f ${TMPDIR}/fvwm >/dev/null 2>&1 &
- else
- ${RUNVIRT_DM} >/dev/null 2>&1 &
- fi
- local RUNVIRT_DM_PID="$$"
- if ! kill -0 ${RUNVIRT_DM_PID} ; then
- # not fatal, just warn user
- notify_user "$RUNVIRT_VM stoppte unerwartet."
- return 1
- fi
+ echo "EdgeScroll 0 0" > "${TMPDIR}/fvwm"
+ OPTS+=( "-replace" "-f" "${TMPDIR}/fvwm" )
+ ;;
+ esac
+ {
+ dc=0
+ while true; do
+ s="$( date +%s )"
+ "${RUNVIRT_DM}" "${OPTS[@]}" &> /dev/null
+ ret="$?"
+ e="$( date +%s )"
+ duration="$(( e - s ))"
+ case "$ret" in
+ 0|129|130|143) exit 0 ;;
+ esac
+ if [ "$duration" -ge 3 ]; then
+ dc=0
+ elif [ "$(( dc++ ))" -gt 5 ]; then
+ notify_user "$RUNVIRT_DM crasht immer wieder."
+ exit 1
+ fi
+ done
+ } &
+ declare -rg RUNVIRT_DM_PID="$!"
+ add_cleanup stop_wm
return 0
}
+stop_wm() {
+ kill "$RUNVIRT_DM_PID"
+ usleep 500000
+ kill -9 "$RUNVIRT_DM_PID"
+}
+
## MAIN ##
call_post_source start_wm
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc
index 08ab4f72..7a469e42 100644
--- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc
+++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc
@@ -21,8 +21,7 @@ get_vm_id() {
fi
fi
# fallback: take last two digits of current pid...
- VM_ID=$(expr substr $$ $(expr ${#$} - 1) 2)
- [ "${#VM_ID}" -eq 1 ] && VM_ID="0${VM_ID}"
+ VM_ID="${$: -2}"
readonly VM_ID
}
@@ -37,7 +36,7 @@ writelog() {
echo -e "$DATE: $*"
fi
# log into file
- if $DEBUG; then
+ if "$DEBUG"; then
echo -e "$DATE: (${FUNCNAME[1]}) $*" >> "${LOGFILE}"
else
echo -e "$DATE: $*" >> "${LOGFILE}"
@@ -75,7 +74,7 @@ $BODY"
# which cannot be seen without a window manager
zenity --error --title "$TITLE" --text "$BODY"
local RET=$?
- [ $RET -le 1 ] && return
+ [ "$RET" -le 1 ] && return
# no zenity...
# QnD abuse printergui for error message as it's blocking
/opt/openslx/cups/printergui --error "$MSG" && return
@@ -92,7 +91,7 @@ $BODY"
# Only accepts functions that were not previously registered.
# This kinda detects when a cleanup function was overriden,
# or at least that something is fishy.
-declare -ag CLEANUP_TASKS
+declare -ag CLEANUP_TASKS=()
add_cleanup() {
[ $# -lt 1 ] && writelog "'${FUNCNAME[0]}' needs at least one argument! $# given." && return
# check if the given function name is already used
@@ -127,24 +126,30 @@ cleanexit() {
trap "" SIGHUP SIGINT SIGTERM EXIT
writelog "Cleanexit '$1' triggered by '${BASH_SOURCE[1]}:${FUNCNAME[1]}'"
usleep 250000
- while isset CLEANUP_TASKS; do
- local TASK=${CLEANUP_TASKS[-1]}
- unset -v CLEANUP_TASKS[-1]
- if ! is_function $TASK; then
- writelog "Registered cleanup function '$TASK' is not a function. This should not be..."
- continue
- fi
- if ! ${TASK}; then
- writelog "Failed to run cleanup function '$TASK'! Exit code: $RET"
- fi
- done
- usleep 250000
+ local TASK
+ if [ "${#CLEANUP_TASKS[@]}" -gt 0 ]; then
+ declare -a cleanups=()
+ declare -a copy=( "${CLEANUP_TASKS[@]}" )
+ unset CLEANUP_TASKS
+ for TASK in "${copy[@]}"; do
+ if ! is_function "$TASK"; then
+ writelog "Registered cleanup function '$TASK' is not a function. This should not be..."
+ continue
+ fi
+ "${TASK}" &
+ cleanups+=( "$!" )
+ done
+ for i in 1 1 2 2 3 3 4 4; do
+ usleep 500000
+ kill -0 "${cleanups[@]}" &> /dev/null || break
+ done
+ fi
# kill potential remaining background jobs
kill $(jobs -p)
- # If we're not in debug mode, remove all temporary files
- if ! $DEBUG && notempty TMPDIR; then
+ # If we're not in debug mode AND got a clean exit code, remove all temporary files
+ if ! "$DEBUG" && notempty TMPDIR && [ "$1" = "0" ]; then
rm -rf -- "${TMPDIR}"
fi
@@ -230,7 +235,7 @@ translate() {
# returns 100 if no hooks exist
run_hooks() {
local dir file retval r
- declare -a files
+ declare -a files=()
dir="$VMCHOOSER_DIR/hooks/${1}.d"
[ -d "$dir" ] || return 100
shift
@@ -243,7 +248,7 @@ run_hooks() {
export TMPDIR IMGUUID USER
"$file" "$@"
r="$?"
- elif [ "${file##.*}" = "inc" ]; then
+ elif [ "${file##*.}" = "inc" ]; then
. "$file"
r="$?"
fi
@@ -273,15 +278,15 @@ safesource() {
shift
bash -n "${FILE}"
local -i RET=$?
- if [ $RET -ne 0 ]; then
- case $RET in
+ if [ "$RET" -ne 0 ]; then
+ case "$RET" in
1) writelog --quiet "Bad file to source: ${FILE}" ;;
2) writelog --quiet "Bad syntax: ${FILE}" ;;
126) writelog --quiet "Could not access: ${FILE}" ;;
127) writelog --quiet "File not found: ${FILE}" ;;
*) writelog --quiet "Syntax check (bash -n) returned unknown error code '${RET}' for: ${FILE}" ;;
esac
- if [ $EXIT_ON_FAILURE -eq 1 ]; then
+ if [ "$EXIT_ON_FAILURE" -eq 1 ]; then
echo "eval EXIT_REASON=\"Could not safesource '${FILE}'\" cleanexit 1 ;"
else
echo "eval writelog \"Could not safesource '${FILE}'.\" ;"
@@ -319,17 +324,17 @@ run_post_source() {
[ $# -ne 1 ] && writelog "'${FUNCNAME[0]}' expects one argument only! $# given." && return 1
for TASK in ${RUN_POST_SOURCE["${1}"]}; do
# sanity checks
- if ! is_function $TASK; then
+ if ! is_function "$TASK"; then
writelog "\tRegistered function '$TASK' is not a function!"
return 1 # TODO maybe even cleanexit here as this seems very bad...
fi
# remove from stack before running it
RUN_POST_SOURCE["${1}"]="${RUN_POST_SOURCE[${1//${TASK}\ /\ }]}"
- ${TASK}
+ "${TASK}"
local -i RET=$?
- if [ $RET -ne 0 ]; then
+ if [ "$RET" -ne 0 ]; then
writelog "\tFailed to run post source '${TASK}' (Exit code: $RET)"
- return $RET
+ return "$RET"
fi
done
return 0
@@ -350,7 +355,7 @@ reg_feature_handler() {
fi
if ! is_function "$2"; then
writelog "'${BASH_SOURCE[1]}' tried to register a non-function as feat handler!"
- writelog "\t'$2' is a '$(type -t $2 2>&1)'."
+ writelog "\t'$2' is a '$(type -t "$2" 2>&1)'."
return 1
fi
# all good, save it
@@ -395,7 +400,7 @@ notempty() {
# Convenience function
isempty() {
- ! notempty $@
+ ! notempty "$@"
}
# Helper to test if given arguments are declared as functions
@@ -415,7 +420,7 @@ is_function() {
is_array() {
# -ne 1 ] && writelog "is_array: Expects 1 argument! $# given." && return 1
while [ $# -gt 0 ]; do
- local ARRAY_DEF="$(declare -p ${1} 2>/dev/null)"
+ local ARRAY_DEF="$(declare -p "${1}" 2>/dev/null)"
if [[ ! "${ARRAY_DEF}" =~ "declare -a" ]] && [[ ! "${ARRAY_DEF}" =~ "declare -A" ]]; then
return 1
fi
@@ -433,7 +438,7 @@ array_contains() {
return 1
fi
# is $1 even defined?
- local ARRAY_DEF="$(declare -p $1 2>/dev/null)"
+ local ARRAY_DEF="$(declare -p "${1}" 2>/dev/null)"
if isempty ARRAY_DEF; then
#writelog "${FUNCNAME[0]}: '$1' not defined!"
return 1
@@ -493,9 +498,9 @@ check_dep() {
# from the given parameters.
clean_string() {
if [ "$#" -ge 1 ]; then
- echo "$@" | tr '[A-Z]' '[a-z]' | tr -d -c '[a-z0-9\-]'
+ echo "$@" | tr 'A-Z' 'a-z' | tr -d -c 'a-z0-9\-'
else
- tr '[A-Z]' '[a-z]' | tr -d -c '[a-z0-9\-]'
+ tr 'A-Z' 'a-z' | tr -d -c 'a-z0-9\-'
fi
}
diff --git a/core/modules/sudo/data/etc/sudoers b/core/modules/sudo/data/etc/sudoers
new file mode 100644
index 00000000..b2e3e3fc
--- /dev/null
+++ b/core/modules/sudo/data/etc/sudoers
@@ -0,0 +1,2 @@
+root ALL=(ALL:ALL) ALL
+#includedir /etc/sudoers.d
diff --git a/core/modules/sudo/module.build b/core/modules/sudo/module.build
new file mode 100644
index 00000000..5fa3a36f
--- /dev/null
+++ b/core/modules/sudo/module.build
@@ -0,0 +1,14 @@
+#!/bin/bash
+fetch_source() {
+ :
+}
+
+build() {
+ COPYLIST="list_dpkg_output"
+ list_packet_files > "$COPYLIST"
+ tarcopy "$(cat "${COPYLIST}" | sort -u)" "${MODULE_BUILD_DIR}"
+}
+
+post_copy() {
+ :
+}
diff --git a/core/modules/sudo/module.conf b/core/modules/sudo/module.conf
new file mode 100644
index 00000000..c1bec3ba
--- /dev/null
+++ b/core/modules/sudo/module.conf
@@ -0,0 +1,11 @@
+#!/bin/bash
+REQUIRED_BINARIES="
+ sudo
+"
+REQUIRED_LIBRARIES=""
+REQUIRED_FILES="
+ /etc/pam.d/sudo
+"
+REQUIRED_DIRECTORIES="
+ /usr/lib/sudo
+"
diff --git a/core/modules/sudo/module.conf.ubuntu b/core/modules/sudo/module.conf.ubuntu
new file mode 100644
index 00000000..1fda609e
--- /dev/null
+++ b/core/modules/sudo/module.conf.ubuntu
@@ -0,0 +1,4 @@
+#!/bin/bash
+REQUIRED_CONTENT_PACKAGES="
+ sudo
+"
diff --git a/core/modules/vbox-src/module.conf b/core/modules/vbox-src/module.conf
index d7312a20..50eb344a 100644
--- a/core/modules/vbox-src/module.conf
+++ b/core/modules/vbox-src/module.conf
@@ -1,5 +1,5 @@
REQUIRED_MODULES="kernel"
-REQUIRED_VBOX_VERSION="6.0.8"
+REQUIRED_VBOX_VERSION="6.0.12"
REQUIRED_DIRECTORIES="
/lib/modules
/usr/lib/virtualbox
diff --git a/core/modules/vmware12/module.build b/core/modules/vmware12/module.build
index 99f7026b..5f05596b 100644
--- a/core/modules/vmware12/module.build
+++ b/core/modules/vmware12/module.build
@@ -213,7 +213,7 @@ build() {
post_copy() {
# Update Icon cache for vmplayer, older versions had the version in their names, newer do not...
- for guic in gtk-update-icon-cache{,-3.0} fail; do
+ for guid in gtk-update-icon-cache{,-3.0} fail; do
if [ "$guid" = "fail" ]; then
pwarning "Updating icon cache failed."
break
diff --git a/core/modules/vmware15/module.build b/core/modules/vmware15/module.build
index 206dcd8d..0e34181d 100644
--- a/core/modules/vmware15/module.build
+++ b/core/modules/vmware15/module.build
@@ -147,7 +147,7 @@ post_copy() {
tarcopy "$(find /usr/lib/ /usr/lib64 -name gconv -type d)" "$TARGET_BUILD_DIR"
# Update Icon cache for vmplayer, older versions had the version in their names, newer do not...
- for guic in gtk-update-icon-cache{,-3.0} fail; do
+ for guid in gtk-update-icon-cache{,-3.0} fail; do
if [ "$guid" = "fail" ]; then
pwarning "Updating icon cache failed."
break
diff --git a/core/rootfs/rootfs-stage31/data/inc/network.functions b/core/rootfs/rootfs-stage31/data/inc/network.functions
index 9ec3eafb..a9edb5bc 100644
--- a/core/rootfs/rootfs-stage31/data/inc/network.functions
+++ b/core/rootfs/rootfs-stage31/data/inc/network.functions
@@ -1,15 +1,42 @@
+#!/bin/ash
+
wait_for_iface() {
local DEVICE=$1
- local TIMEOUT=20
- echo -n "Waiting for interface $DEVICE: "
+ local TIMEOUT=10
+ local state laststate current relax
+ local want=
+ local ret=1 # error
+ [ -n "$2" ] && TIMEOUT="$2"
+ echo -n "Waiting ${TIMEOUT}s for interface $DEVICE: "
+ TIMEOUT="$(( TIMEOUT * 2 ))"
# Some systems don't have operstate. Seems to be hardware dependent
- [ ! -e "/sys/class/net/${DEVICE}/operstate" ] && usleep 10000
- if [ -e "/sys/class/net/${DEVICE}/operstate" ]; then
+ [ -e "/sys/class/net/${DEVICE}/operstate" ] || sleep 1
+ [ -e "/sys/class/net/${DEVICE}/operstate" ] && want="up"
+ [ -e "/sys/class/net/${DEVICE}/carrier" ] && want="${want}1"
+ if [ -n "$want" ]; then
+ relax=$(( TIMEOUT / 3 ))
+ [ "$relax" -lt 8 ] && relax=8
+ current=0
while true; do
# check linkstate
- [ "x$(cat "/sys/class/net/${DEVICE}/operstate")" == "xup" ] && break
- TIMEOUT=$(( TIMEOUT - 1 )) # don't wait forever, the pcnet iface of vmware will never be "up" although it's working
- [ "$TIMEOUT" -le 0 ] && break
+ state="$( cat "/sys/class/net/${DEVICE}/operstate" 2> /dev/null )"
+ state="${state}$( cat "/sys/class/net/${DEVICE}/carrier" 2> /dev/null )"
+ [ "$state" != "$laststate" ] && echo -n "[$state]"
+ laststate="$state"
+ if [ "$state" = "$want" ]; then
+ ret=0
+ break
+ fi
+ if [ "$current" -gt "$relax" ] && [ "$state" = "unknown1" ]; then
+ echo -n "better than nothing"
+ ret=0
+ break
+ fi
+ current=$(( current + 1 )) # don't wait forever, the pcnet iface of vmware will never be "up" although it's working
+ if [ "$current" -ge "$TIMEOUT" ];then
+ echo -n "TIMEOUT"
+ break
+ fi
# else
echo -n "."
usleep 500000
@@ -17,7 +44,9 @@ wait_for_iface() {
else
# we really don't have a operstate .. then just wait a sec and hope for the best.
sleep 1
+ echo -n "... no operstate or carrier, let's hope for the best..."
fi
- echo ".$(cat "/sys/class/net/${DEVICE}/operstate" 2>/dev/null)"
+ echo
+ return "$ret"
}
true
diff --git a/core/rootfs/rootfs-stage31/data/inc/setup_network b/core/rootfs/rootfs-stage31/data/inc/setup_network
index 3e17cf85..4f4c8a02 100644
--- a/core/rootfs/rootfs-stage31/data/inc/setup_network
+++ b/core/rootfs/rootfs-stage31/data/inc/setup_network
@@ -22,15 +22,14 @@ BRIDGE="br0"
mkdir -p "${FUTURE_ROOT}/etc/udev/rules.d"
-for i in 1 1 1 END; do
- IP_OUT=$(ip a | grep -B 1 "/ether" | sed -r '/^--$/d;$!N;s#^[0-9]+: ([a-z0-9\.:]+): .*?/ether ([0-9a-fA-Z:]+) .*$#\1==\2#')
- [ "x$i" == "xEND" ] && break
- if ! echo "$IP_OUT" | grep -q -- "$MAC"; then
- sleep "$i"
- fi
+for i in 1 1 END; do
+ IP_OUT="$( ip a | grep -B 1 "/ether" | sed -r '/^--$/d;$!N;s#^[0-9]+: ([a-z0-9\.:]+): .*?/ether ([0-9a-fA-Z:]+) .*$#\1==\2#' )"
+ echo "$IP_OUT" | grep -q -F -- "$MAC" && break
+ [ "x$i" = "xEND" ] && break
+ sleep "$i"
done
-if ! echo "$IP_OUT" | grep -q -- "$MAC"; then
+if ! echo "$IP_OUT" | grep -q -F -- "$MAC"; then
drop_shell "---
$(ip a)
---
@@ -44,8 +43,8 @@ fi
ADD_NIC=1
for LINE in $IP_OUT; do
- IFACE=$(echo "$LINE" | awk -F '==' '{printf $1}')
- IFMAC=$(echo "$LINE" | awk -F '==' '{printf $2}' | tr '[A-Z]' '[a-z]') # udev requires mac addesses to be lowercase (a-f), see http://www.debianhelp.co.uk/udev.htm
+ IFACE="${LINE%==*}"
+ IFMAC="$( echo "${LINE#*==}" | tr 'A-Z' 'a-z' )" # udev requires mac addesses to be lowercase (a-f), see http://www.debianhelp.co.uk/udev.htm
echo "${IFACE} = ${IFMAC}"
if [ "x$IFMAC" == "x$MAC" ]; then
@@ -54,7 +53,7 @@ for LINE in $IP_OUT; do
brctl setfd "$BRIDGE" 0.000000000001
ip link set addr "$IFMAC" "$BRIDGE" || drop_shell "Could not set mac of $BRIDGE"
ip link set dev "$IFACE" up
- wait_for_iface "$IFACE"
+ wait_for_iface "$IFACE" 8
brctl addif "$BRIDGE" "$IFACE" || drop_shell "Could not add $IFACE to $BRIDGE"
# save our variables for retry on fail
@@ -69,7 +68,6 @@ for LINE in $IP_OUT; do
[ -n "$GATEWAY" ] && ip route add default via "$GATEWAY" dev "$BRIDGE"
else
ip link set dev "$BRIDGE" up
- NOIPYET="yes"
fi
# Ignore this device later on when systemd handles network interfaces (see hacked 99-systemd.rules in systemd data dir)
echo "SUBSYSTEM==\"net\", ACTION==\"add\", KERNEL==\"eth*\", ATTR{address}==\"$IFMAC\", TAG+=\"openslxignore\"" >> "${FUTURE_ROOT}/etc/udev/rules.d/01-ignore-boot-interface.rules"
@@ -90,7 +88,7 @@ for LINE in $IP_OUT; do
IFACE=""
done
-wait_for_iface "$BRIDGE"
+wait_for_iface "$BRIDGE" 5
# udhcpc
PARAM=
@@ -116,9 +114,10 @@ echo "GATEWAY=$GATEWAY" >> /run/network.conf
echo "BRIDGE=$BRIDGE" >> /run/network.conf
echo "UID=$UID" >> /run/network.conf
-udhcpc $PARAM -O ntpsrv -O domain -O wpad -O search -t 4 -T 3 -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE"
+udhcpc $PARAM -O ntpsrv -O domain -O search -t 5 -T 3 -A 4 -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE"
URET=$?
-# udhcpc return value will be return value of this script
+# if these were empty before, udhcpc might have filled them in
[ -z "$CLIENTIP" ] && CLIENTIP=$(cat /run/firstip)
[ -z "$GATEWAY" ] && GATEWAY=$(cat /run/firstgw)
+# udhcpc return value will be return value of this script
return $URET
diff --git a/core/rootfs/rootfs-stage31/data/inc/setup_network_retry b/core/rootfs/rootfs-stage31/data/inc/setup_network_retry
index 5ac28a57..76923703 100644
--- a/core/rootfs/rootfs-stage31/data/inc/setup_network_retry
+++ b/core/rootfs/rootfs-stage31/data/inc/setup_network_retry
@@ -1,34 +1,51 @@
#!/bin/ash
-source /inc/network.functions
source /run/network.conf
for i in 1 2 3 4 5 6 7 8; do
echo "<$i> Try to fix broken network"
echo -n "Take interface $IFACE down .. "
- ip link set dev $IFACE down
- usleep 10000
+ ip link set dev "$BRIDGE" down
+ ip link set dev "$IFACE" down
+ usleep 100000
echo "and up again.."
- ip link set dev $IFACE up
- ip link set dev $BRIDGE up
+ ip link set dev "$IFACE" up
usleep 100000
- wait_for_iface "$IFACE"
+ wait_for_iface "$IFACE" "$(( 15 + i * 2 ))"
+ retval=$?
+ ip link set dev "$BRIDGE" up
+ if [ "$retval" -eq 0 ] && [ "$i" -ge 4 ] && [ -n "$CLIENTIP" ] && [ -n "$GATEWAY" ]; then
+ echo "....."
+ usleep 100000
+ echo "Checking if static IP config works...."
+ if ping -c1 -w2 "$GATEWAY" &> /dev/null || ping -c1 -w2 "$SERVERIP" &> /dev/null; then
+ echo "apparently so."
+ echo "Trying to boot without DHCP config (DNS, Hostname, ...), YMMV!"
+ sleep 3
+ RET=0
+ break
+ fi
+ echo "...nope..."
+ fi
+ wait_for_iface "$BRIDGE" 10
+ usleep 100000
- udhcpc $PARAM -O domain -O nissrv -O nisdomain -O wpad -O search -t 5 -T 2 -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE"
+ udhcpc $PARAM -O ntpsrv -O domain -O search -t "$(( 2 + i / 2 ))" -T "$(( 4 + i ))" -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE" \
+ || udhcpc $PARAM -O ntpsrv -O domain -O search -t "$(( 2 + i / 2 ))" -T "$(( 4 + i ))" -s "/inc/udhcpc-trigger" -f -n -q -i "$BRIDGE"
+ RET="$?"
- if [ $? -eq 0 ]; then
+ if [ "$RET" -eq 0 ]; then
echo "Finally fixed IP config. Continue boot."
- RET=0
break
- else
- RET=1
fi
done
-[ $RET -gt 0 ] && drop_shell "Something is really broken.. Please check your network cable and reset your computer."
+[ $RET -gt 0 ] && drop_shell "Something is really broken.. Please check your network cable and reset your computer.
+$(ip a)
+$(ip r s)"
# create correct return value
[ $RET -eq 0 ]
diff --git a/core/targets/stage32-bwlp/sudo b/core/targets/stage32-bwlp/sudo
new file mode 120000
index 00000000..5c0a121b
--- /dev/null
+++ b/core/targets/stage32-bwlp/sudo
@@ -0,0 +1 @@
+../../modules/sudo \ No newline at end of file