diff options
author | Simon Rettberg | 2019-05-28 18:05:19 +0200 |
---|---|---|
committer | root | 2019-05-28 18:05:19 +0200 |
commit | 8b04ae13e7675528968080873873ae224b3eb7f0 (patch) | |
tree | 51cf1692c11c8811b2458c69983de06a7b3e0839 | |
parent | [nvidia-common] Fix drm.cfg filenames (diff) | |
download | mltk-8b04ae13e7675528968080873873ae224b3eb7f0.tar.gz mltk-8b04ae13e7675528968080873873ae224b3eb7f0.tar.xz mltk-8b04ae13e7675528968080873873ae224b3eb7f0.zip |
[lightdm-greeter-bwlp] Download login-news on startup
-rw-r--r-- | core/modules/lightdm-greeter-bwlp/data/etc/systemd/system/lightdm.service.d/download-news.conf | 2 | ||||
-rwxr-xr-x | core/modules/lightdm-greeter-bwlp/data/opt/openslx/scripts/lightdm-download_news | 36 |
2 files changed, 38 insertions, 0 deletions
diff --git a/core/modules/lightdm-greeter-bwlp/data/etc/systemd/system/lightdm.service.d/download-news.conf b/core/modules/lightdm-greeter-bwlp/data/etc/systemd/system/lightdm.service.d/download-news.conf new file mode 100644 index 00000000..c0ab14cb --- /dev/null +++ b/core/modules/lightdm-greeter-bwlp/data/etc/systemd/system/lightdm.service.d/download-news.conf @@ -0,0 +1,2 @@ +[Service] +ExecStartPre=-/opt/openslx/scripts/lightdm-download_news diff --git a/core/modules/lightdm-greeter-bwlp/data/opt/openslx/scripts/lightdm-download_news b/core/modules/lightdm-greeter-bwlp/data/opt/openslx/scripts/lightdm-download_news new file mode 100755 index 00000000..c1d7c97a --- /dev/null +++ b/core/modules/lightdm-greeter-bwlp/data/opt/openslx/scripts/lightdm-download_news @@ -0,0 +1,36 @@ +#!/bin/ash + +. /opt/openslx/config + +. /opt/openslx/bin/slx-tools + +dlfile="/tmp/news-raw.$$$RANDOM" +newsfile="/opt/openslx/lightdm/news.html" + +if [ -n "$SLX_VMCHOOSER_BASE_URL" ]; then + URL="$SLX_VMCHOOSER_BASE_URL" +elif [ -n "$SLX_PXE_SERVER_IP" ]; then + URL="http://$SLX_PXE_SERVER_IP/vmchooser/" +else + exit 0 +fi + +download_retry -o "$dlfile" "$URL/login-news" + +if [ -s "$dlfile" ]; then + hl="$( xml_get "//news/headline" "$dlfile" | str_trim )" + body="$( xml_get "//news/info" "$dlfile" | str_trim )" + if [ "${#hl}${#body}" != "00" ]; then + printf "%s" "<h1>$hl</h1>$body" > "$newsfile" + mkdir -p "/etc/lightdm/qt-lightdm-greeter.conf.d" + cat > "/etc/lightdm/qt-lightdm-greeter.conf.d/10-bwlp-news.conf" <<EOF +[General] +news-html-file = $newsfile +EOF + fi +fi + +rm -f -- "$dlfile" + +exit 0 + |