diff options
| author | Simon Rettberg | 2014-01-13 14:11:28 +0100 |
|---|---|---|
| committer | Simon Rettberg | 2014-01-13 14:11:28 +0100 |
| commit | f853dc0f548ba86181e2c2682629b4d51d302efd (patch) | |
| tree | acf120952c8a3cdd28f07080e4da18657ead62a5 | |
| parent | [vmchooser] Refining iptables MASQUERADE rule to work around an issue where i... (diff) | |
| parent | update cups to work with ubuntu 13.10 (diff) | |
| download | tm-scripts-f853dc0f548ba86181e2c2682629b4d51d302efd.tar.gz tm-scripts-f853dc0f548ba86181e2c2682629b4d51d302efd.tar.xz tm-scripts-f853dc0f548ba86181e2c2682629b4d51d302efd.zip | |
Merge branch 'master' of dnbd3:openslx-ng/tm-scripts
| -rw-r--r-- | remote/modules/cups/cups.conf.ubuntu.13.10 | 10 | ||||
| -rwxr-xr-x | remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl | 16 | ||||
| -rwxr-xr-x | remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog | 21 | ||||
| -rwxr-xr-x | remote/setup_target | 6 | ||||
| -rwxr-xr-x | server/modules/pam-freiburg/etc/profile.d/00-autostart.sh | 5 |
5 files changed, 46 insertions, 12 deletions
diff --git a/remote/modules/cups/cups.conf.ubuntu.13.10 b/remote/modules/cups/cups.conf.ubuntu.13.10 new file mode 100644 index 00000000..eaf19ce8 --- /dev/null +++ b/remote/modules/cups/cups.conf.ubuntu.13.10 @@ -0,0 +1,10 @@ +REQUIRED_INSTALLED_PACKAGES=" + cups + cups-daemon + cups-filters +" +REQUIRED_CONTENT_PACKAGES=" + cups + cups-daemon + cups-filters +" diff --git a/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl b/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl index 6025c962..6a798563 100755 --- a/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl +++ b/remote/modules/smartctl/data/opt/openslx/scripts/systemd-smartctl @@ -2,18 +2,30 @@ # Check Reallocated_Sector_Ct and Spin_Retry_Count of local disk(s) +. /opt/openslx/config + +[ -z "$SLX_SMARTCTL_MIN_REALLOC" ] && SLX_SMARTCTL_MIN_REALLOC=0 + FILE=$(mktemp) for dev in /dev/sd?; do - smartctl -A "$dev" -f "brief" > "$FILE" || continue # should we report devices where smartctl doesn't work? + smartctl -H -A -f "brief" "$dev" > "$FILE" || continue # should we report devices where smartctl doesn't work? + # parse + OVERALL=$(grep -o "test result: .*$" "$FILE" | cut -c 14-) + [ "x$OVERALL" = "xPASSED" ] && OVERALL="" REALLOC=$(grep "^ *5 " "$FILE" | awk '{print $8}') SPINRETRY_VAL=$(grep "^ *10 " "$FILE" | awk '{print $4}') SPINRETRY_THR=$(grep "^ *10 " "$FILE" | awk '{print $6}') - if [ -n "$REALLOC" ] && [ "$REALLOC" != "0" ]; then + # report if applicable + if [ -n "$OVERALL" ]; then + slxlog "smartctl-fail" "Failed HDD: $dev reports health as $OVERALL" "$FILE" + fi + if [ -n "$REALLOC" ] && [ "$REALLOC" -gt "$SLX_SMARTCTL_MIN_REALLOC" ]; then slxlog "smartctl-realloc" "Failing HDD: $dev has $REALLOC reallocated sectors!" "$FILE" fi if [ -n "$SPINRETRY_VAL" ] && [ "$SPINRETRY_VAL" -le "$SPINRETRY_THR" ]; then slxlog "smartctl-spinretry" "Failing HDD: $dev has bad spin retry count! ($SPINRETRY_VAL/$SPINRETRY_THR)" "$FILE" fi done +sleep 2 # give slxlog a little time, as it's running async rm -f -- "$FILE" diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog index afe72a2d..b80d55cf 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog @@ -47,18 +47,27 @@ if [ $# -lt 2 ]; then else MSG="$2" fi -MSG="[$(whoami)] $MSG" +USER=$(whoami) +MSG="[$USER] $MSG" if [ $# -gt 2 ]; then EXTRA="$3" fi -if [ -n "$EXTRA" ] && [ -r "$EXTRA" -a -s "$EXTRA" ] && [ "$(stat -c %s "$EXTRA")" -lt "10000" ]; then - curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc@$EXTRA" "$SLX_REMOTE_LOG" > /dev/null 2>&1 & -elif [ -n "$EXTRA" ]; then - curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc=Missing/too large: $EXTRA" "$SLX_REMOTE_LOG" > /dev/null 2>&1 & +if [ -n "$SLX_DEBUG" ]; then + CURLLOG="/tmp/slxlog.$USER" else - curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" "$SLX_REMOTE_LOG" > /dev/null 2>&1 & + CURLLOG="/dev/null" +fi + +if [ -n "$EXTRA" ] && [ -r "$EXTRA" -a -s "$EXTRA" ] && [ "$(stat -c %s "$EXTRA")" -lt "10000" ]; then # valid file attachment + curl --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 "type=$TYPE" --data-urlencode "description=$MSG" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 & +elif [ -s "$EXTRA" ]; then # empty attachment file (or missing) + curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc=Attachment too large: $EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 & +else # attachment file to big (more than 10k) + curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc=Attachment missing/empty: $EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 & fi exit 0 diff --git a/remote/setup_target b/remote/setup_target index 1fd059fc..5fc68a4f 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -134,8 +134,8 @@ copy_files_with_deps () { [ ! -d "$MODULE_BUILD_DIR" ] && pinfo "No build directory found, skipping dependency copying" && return 0 cd "$MODULE_BUILD_DIR" - local COPYFILES_LIST="$MODULE_BUILD_DIR/copy_files_with_deps.filelist" - [ -e "${COPYFILES_LIST}" ] && rm "${COPYFILES_LIST}" + local COPYFILES_LIST="${TARGET_BUILD_DIR}/opt/openslx/.mltk/${MODULE}.copy_files_with_deps" + rm -f -- "${COPYFILES_LIST}" # from REQUIRED_BINARIES - follow symlinks and ldd the file [ ! -z "${REQUIRED_BINARIES}" ] && pinfo "Gathering required binaries from config file..." @@ -503,7 +503,7 @@ clean_module() { rm -rf -- "${MODULE_DIR}/src" || perror "Could not delete src path" rm -f -- "${MODULE_DIR}/list_dpkg_output" || perror "Could not delete list_dpkg_output" rm -f -- "${MODULE_DIR}/list_binaries_and_files" || perror "Could not delete list_binaries_and_files" - rm -f -- "${TARGET_BUILD_DIR}/opt/openslx/.mltk/${MODULE}.md5" + rm -f -- "${TARGET_BUILD_DIR}/opt/openslx/.mltk/${MODULE}."* # no space here! # These are not in use anymore, but leave the cleanup here for upgraders rm -f -- "${MODULE_DIR}/.built" rm -f -- "${MODULE_DIR}/.fetched_source" diff --git a/server/modules/pam-freiburg/etc/profile.d/00-autostart.sh b/server/modules/pam-freiburg/etc/profile.d/00-autostart.sh index a6c4744f..18835457 100755 --- a/server/modules/pam-freiburg/etc/profile.d/00-autostart.sh +++ b/server/modules/pam-freiburg/etc/profile.d/00-autostart.sh @@ -30,7 +30,10 @@ if [ -d "$PERSISTENT_HOME_DIR" ]; then done # Check if user has autostart script and run it (so they can create more symlinks etc.) if [ -x "$PERSISTENT_HOME_DIR/AUTOSTART" ]; then - "$PERSISTENT_HOME_DIR/AUTOSTART" + if cd "$TEMP_HOME_DIR"; then + "$PERSISTENT_HOME_DIR/AUTOSTART" + cd - >/dev/null 2>&1 + fi fi fi |
