diff options
author | Christian Rößler | 2015-09-14 13:21:55 +0200 |
---|---|---|
committer | Christian Rößler | 2015-09-14 13:21:55 +0200 |
commit | 92c04f646e86f01425e1e1ac3382498f0c189302 (patch) | |
tree | e8954c04587ee70230cd7f5c3ecf62c9b5f4f813 /remote | |
parent | [runvirt] [vmware] Minor cosmetics, logging (diff) | |
parent | [binutil] Fix accidental exclusion of libs by using full path for automatic b... (diff) | |
download | tm-scripts-92c04f646e86f01425e1e1ac3382498f0c189302.tar.gz tm-scripts-92c04f646e86f01425e1e1ac3382498f0c189302.tar.xz tm-scripts-92c04f646e86f01425e1e1ac3382498f0c189302.zip |
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote')
6 files changed, 28 insertions, 28 deletions
diff --git a/remote/includes/binutil.inc b/remote/includes/binutil.inc index ae173deb..92ab8d87 100644 --- a/remote/includes/binutil.inc +++ b/remote/includes/binutil.inc @@ -73,7 +73,7 @@ get_dynamic_dependencies() { rm -f "$LDD_OUT" continue fi - rm -f "$LDD_OUT" + rm -f -- "$LDD_OUT" done } @@ -103,7 +103,7 @@ lib_search() { for LOCALLIB in ${LOCAL_MATCHES}; do get_link_chain "${LOCALSEARCHDIR}/${LOCALLIB}" "${LOCALSEARCHDIR}" get_dynamic_dependencies -l "${LOCALSEARCHDIR}" "${LOCALLIB}" - CURRENT_BLACKLIST+="\|${LIBLINK[0]}" + CURRENT_BLACKLIST+="\|${LOCALLIB:1}" done # found the libs, we are done return diff --git a/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script b/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script index 17633caa..9a9bdf1c 100755 --- a/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script +++ b/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script @@ -28,13 +28,19 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then # X11 if [ -n "$DISPLAY" ]; then # Seems to be x11 - USRHOME=$(/usr/bin/getent passwd "$NAME" | awk -F ':' '{print $6}') - export XAUTHORITY="$USRHOME/.Xauthority" + IDLE= + export XAUTHORITY=$(ps a | grep -v grep | grep -o -- '-auth.*$' | awk '{print $2}') + [ -n "$XAUTHORITY" ] && [ -f "$XAUTHORITY" ] && IDLE=$(xprintidle) # Now that we have DISPLAY and XAUTHORITY set, xprintidle should work - IDLE=$(xprintidle) + if [ -z "$IDLE" ]; then + # Try user's xauth + USRHOME=$(/usr/bin/getent passwd "$NAME" | awk -F ':' '{print $6}') + export XAUTHORITY="$USRHOME/.Xauthority" + [ -f "$XAUTHORITY" ] && IDLE=$(xprintidle) + fi if [ -n "$IDLE" ]; then IDLE=$(( $IDLE / 1000 )) - if [ "$IDLE" -lt "$SLX_LOGOUT_TIMEOUT" ]; then + if [ -z "$IDLE" ] || [ "$IDLE" -lt "$SLX_LOGOUT_TIMEOUT" ]; then IS_IDLE=no else loginctl terminate-session "$ses" @@ -63,11 +69,11 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then # end other sessions done rm -f -- "$TMP" - if [ "$IS_IDLE" = "yes" ]; then - [ ! -e "$IDLEHINT" ] && echo "$NOW" > "$IDLEHINT" - else - rm -f -- "$IDLEHINT" - fi + fi + if [ "$IS_IDLE" = "yes" ]; then + [ ! -e "$IDLEHINT" ] && echo "$NOW" > "$IDLEHINT" + else + rm -f -- "$IDLEHINT" fi else # No logout timeout is set, take shortcut for shutdown timeout (if set) diff --git a/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth b/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth index 65eefcdc..b8ed4166 100755 --- a/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth +++ b/remote/modules/pam/data/opt/openslx/scripts/pam_script_auth @@ -3,21 +3,17 @@ # Needed as pam_script clears PATH export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin" -touch "/tmp/ldapsearch.${PAM_USER}" -chmod 0600 "/tmp/ldapsearch.${PAM_USER}" -if ldapsearch -l 3 -o nettimeout=3 -x -LLL uid="${PAM_USER}" uid homeMount realAccount > "/tmp/ldapsearch.${PAM_USER}" 2>/dev/null; then - VOLUME=$(cat "/tmp/ldapsearch.${PAM_USER}" | grep "^homeMount:" | head -n 1 | cut -d" " -f2) - REAL_ACCOUNT=$(cat "/tmp/ldapsearch.${PAM_USER}" | grep "^realAccount:" | head -n 1 | cut -d" " -f2) - PCASE=$(cat "/tmp/ldapsearch.${PAM_USER}" | grep "^uid:" | head -n 1 | cut -d" " -f2) - [ -n "$PCASE" ] && PAM_USER=$PCASE -fi +# check if the script runs as root +[ "x$(whoami)" != "xroot" ] && exit 0 -PASSWD=$(/usr/bin/getent passwd "$PAM_USER") +PASSWD=$(getent passwd "$PAM_USER") +USER_NAME=$(echo "$PASSWD" | awk -F ':' '{print $1}') USER_UID=$(echo "$PASSWD" | awk -F ':' '{print $3}') USER_GID=$(echo "$PASSWD" | awk -F ':' '{print $4}') USER_HOME=$(echo "$PASSWD" | awk -F ':' '{print $6}') -[ -z "$USER_UID" ] && USER_UID=$(/usr/bin/id -u "$PAM_USER") -[ -z "$USER_GID" ] && USER_GID=$(/usr/bin/id -g "$PAM_USER") +[ -n "$USER_NAME" ] && PAM_USER="$USER_NAME" +[ -z "$USER_UID" ] && USER_UID=$(id -u "$PAM_USER") +[ -z "$USER_GID" ] && USER_GID=$(id -g "$PAM_USER") [ -z "$USER_HOME" ] && USER_HOME="/home/$PAM_USER" if [ -z "$USER_UID" -o -z "$USER_GID" ]; then slxlog "pam-get-ids" "Could not determine UID or GID for user '$PAM_USER'." @@ -27,9 +23,6 @@ fi # The user's non-persistent home directory mount point, which should be their linux home TEMP_HOME_DIR="$USER_HOME" -# check if the script runs as root -[ "x$(/usr/bin/whoami)" != "xroot" ] && exit 0 - # check if PAM_USER is root and skip if it is the case [ "x${PAM_USER}" == "xroot" ] && exit 0 diff --git a/remote/modules/sshd/data/etc/systemd/system/network.target.wants/sshd.service b/remote/modules/sshd/data/etc/systemd/system/network.target.wants/sshd.service deleted file mode 120000 index d41264ec..00000000 --- a/remote/modules/sshd/data/etc/systemd/system/network.target.wants/sshd.service +++ /dev/null @@ -1 +0,0 @@ -../sshd.service
\ No newline at end of file diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog index 08852352..52320c1a 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog @@ -8,6 +8,8 @@ # -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 @@ -47,7 +49,7 @@ if [ $# -lt 2 ]; then else MSG="$2" fi -USER=$(/usr/bin/whoami) +USER=$(whoami) MSG="[$USER] $MSG" if [ $# -gt 2 ]; then diff --git a/remote/setup_target b/remote/setup_target index 6b9a7a6c..91e657e0 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -228,7 +228,7 @@ copy_files_with_deps () { done #copy to initramfsdir - pdebug "File list generated at ${MODULE_BUILD_DIR}/${COPYFILES_LIST}." + pdebug "File list generated at ${COPYFILES_LIST}." # empty? if [ ! -s "$COPYFILES_LIST" ]; then return |