aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-04-03 13:03:13 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-04-03 13:03:13 +0200
commiteb1c6cff914b01732103065781e0ea0cfa225c4e (patch)
treedfd2cecfcb7a96ce7c72f1df2e0eeac1be121a26
parent36c1d28e6fc34a39360f063cf2a375fe4df1363a (diff)
downloaddesktop-autoloader-eb1c6cff914b01732103065781e0ea0cfa225c4e.tar.gz
desktop-autoloader-eb1c6cff914b01732103065781e0ea0cfa225c4e.tar.bz2
desktop-autoloader-eb1c6cff914b01732103065781e0ea0cfa225c4e.zip
Finalize first draft of desktop-autoloader.
-rw-r--r--README.md2
-rw-r--r--VERSION1
-rwxr-xr-xbin/desktop-autoloader45
-rw-r--r--contrib/desktop-autoloader.cron6
-rw-r--r--contrib/desktop-autoloader.default11
-rw-r--r--data/desktop-autoloader.129
-rw-r--r--data/sleep-and-kill.desktop (renamed from data/d-e-a-sleepandkill.desktop)2
-rw-r--r--debian/changelog2
-rw-r--r--debian/compat2
-rw-r--r--debian/control14
-rw-r--r--debian/copyright8
l---------debian/desktop-autoloader.cron1
l---------debian/desktop-autoloader.default1
-rw-r--r--debian/desktop-autoloader.dirs1
-rw-r--r--debian/desktop-autoloader.docs (renamed from debian/docs)0
-rw-r--r--debian/desktop-autoloader.install2
-rw-r--r--debian/desktop-autoloader.manpages1
-rwxr-xr-xdebian/desktop-autoloader.postinst73
-rwxr-xr-xdebian/desktop-autoloader.postrm41
-rw-r--r--debian/install1
-rw-r--r--debian/manpages1
-rw-r--r--debian/source/format2
-rw-r--r--debian/watch3
23 files changed, 227 insertions, 22 deletions
diff --git a/README.md b/README.md
index 1c931d4..0e6ce87 100644
--- a/README.md
+++ b/README.md
@@ -77,5 +77,3 @@ The currently supported (i.e., tested) desktop environments are:
* MATE
* XFCE
-
-
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..8a9ecc2
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.0.1 \ No newline at end of file
diff --git a/bin/desktop-autoloader b/bin/desktop-autoloader
new file mode 100755
index 0000000..0bd5713
--- /dev/null
+++ b/bin/desktop-autoloader
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# Copyright (C) 2011-2017 Klaus Ade Johnstad <klaus@linuxavdelingen.no>
+# Copyright (C) 2017 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+
+# This program is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more
+# details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this package; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA
+
+AUTOLOAD_DISPLAY=":20"
+DESKTOP_SESSION_MANAGER="x-session-manager"
+
+test -f /etc/default/desktop-autoloader && . /etc/default/desktop-autoloader
+
+###
+### input sanitizing...
+###
+if ! echo "${AUTOLOAD_DISPLAY}" | grep -qE "^.*:[0-9]+(|\.[0-9]+)"; then
+ echo "Inappropriate setting for \$AUTOLOAD_DISPLAY variable: ${AUTOLOAD_DISPLAY}"
+ exit 1
+fi
+if ! type -p "${DESKTOP_SESSION_MANAGER}" 1>/dev/null; then
+ echo "Cannot find session manager \$DESKTOP_SESSION_MANAGER: ${DESKTOP_SESSION_MANAGER}"
+ exit 1
+fi
+
+# launch an invisible X-Server
+echo Xvfb "${AUTOLOAD_DISPLAY}" &
+
+# launch a session inside this Xserver
+echo DISPLAY=${AUTOLOAD_DISPLAY}
+echo dbus-run-session --exit-with-session "${DESKTOP_SESSION_MANAGER}" &
diff --git a/contrib/desktop-autoloader.cron b/contrib/desktop-autoloader.cron
new file mode 100644
index 0000000..87b8a22
--- /dev/null
+++ b/contrib/desktop-autoloader.cron
@@ -0,0 +1,6 @@
+# After a system has booted, check what time it is and pre-load the
+# filesystem cache with a standardized desktop session
+
+SHELL=/bin/bash
+
+@reboot desktop-autoload [ $(date +%s) -lt $(date -d 07:30 +%s) ] && sleep 60 && desktop-autoload
diff --git a/contrib/desktop-autoloader.default b/contrib/desktop-autoloader.default
new file mode 100644
index 0000000..b31b421
--- /dev/null
+++ b/contrib/desktop-autoloader.default
@@ -0,0 +1,11 @@
+### Desktop Autoloader Defaults
+#
+# This file allows you to tweak the behaviour of the Desktop Autoloader
+# tool.
+
+# The virtual display to be used for the autoloader session.
+AUTOLOAD_DISPLAY=:20
+
+# desktop environment to load (must be an available .desktop file under
+# /usr/share/xsessions or (under Debian) x-session-manager.
+DESKTOP_SESSION_MANAGER=x-session-manager
diff --git a/data/desktop-autoloader.1 b/data/desktop-autoloader.1
new file mode 100644
index 0000000..372fa99
--- /dev/null
+++ b/data/desktop-autoloader.1
@@ -0,0 +1,29 @@
+.TH desktop-autoloader 1
+.SH NAME
+desktop-autoloader \- Desktop Session Autoloader Launch Script
+.SH SYNOPSIS
+.B desktop-autoloader
+
+.SH DESCRIPTION
+\fBdesktop-autoloader\fR is a tiny script that loads a virtual desktop session in Xvfb.
+Its purpose is to fill the kernel's file system RAM cache with all necessary files
+needed for running a real desktop session (of the same type).
+.PP
+The Desktop Session Autoloader is a nice-to-have tool on diskless clients
+(aka LTSP Fat Clients). It accelerates the login of the
+first-user-of-the-day tremendously. To take advantage of the pre-loaded
+desktop session, make sure the diskless systems get launched via Wake-on-LAN
+before 7:30am.
+.PP
+\fBdesktop-autoloader\fR should not be executed directly, it is executed via CRON.
+It gets only executed when the system is booted before a certain time of day (so
+it does not inflict performance breakdown on already running sessions.
+
+.SH OPTIONS
+There are no options.
+
+.SH SEE ALSO
+/etc/cron.d/desktop-autoloader
+
+.SH AUTHOR
+This manual page was written by Mike Gabriel <mike.gabriel@das-netzwerkteam.de> for the Debian Project.
diff --git a/data/d-e-a-sleepandkill.desktop b/data/sleep-and-kill.desktop
index c366bd4..ab7e9ab 100644
--- a/data/d-e-a-sleepandkill.desktop
+++ b/data/sleep-and-kill.desktop
@@ -1,7 +1,7 @@
[Desktop Entry]
Encoding=UTF-8
Name=sleep-and-kill
-Exec=/bin/sh -c "sleep 90; pkill -u desktop-session-autoloader"
+Exec=/bin/sh -c "sleep 300; pkill -u desktop-autoloader"
Terminal=false
Type=Application
StartupNotify=false
diff --git a/debian/changelog b/debian/changelog
index 220959b..64bf16a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-desktop-session-autoloader (0.0.1-1) UNRELEASED; urgency=medium
+desktop-autoloader (0.0.1) UNRELEASED; urgency=medium
* Initial release. (Closes: #XXXXXX).
diff --git a/debian/compat b/debian/compat
index 9d60796..f599e28 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-11 \ No newline at end of file
+10
diff --git a/debian/control b/debian/control
index 6a9282b..3276142 100644
--- a/debian/control
+++ b/debian/control
@@ -1,4 +1,4 @@
-Source: desktop-session-autoloader
+Source: desktop-autoloader
Section: misc
Priority: optional
Maintainer: Debian Edu Packaging Team <debian-edu-pkg-team@lists.alioth.debian.org>
@@ -6,17 +6,17 @@ Uploaders:
Mike Gabriel <sunweaver@debian.org>,
Standards-Version: 4.1.3
Build-Depends:
- debhelper (>= 11),
+ debhelper (>= 10),
cdbs,
-Vcs-Git: https://anonscm.debian.org/git/debian-edu/pkg-team/desktop-session-autoloader.git
-Vcs-Browser: https://anonscm.debian.org/git/debian-edu/pkg-team/desktop-session-autoloader.git
-Homepage: https://anonscm.debian.org/git/debian-edu/pkg-team/desktop-session-autoloader/README.md
+Vcs-Git: https://anonscm.debian.org/git/debian-edu/pkg-team/desktop-autoloader.git
+Vcs-Browser: https://anonscm.debian.org/git/debian-edu/pkg-team/desktop-autoloader.git
+Homepage: https://anonscm.debian.org/git/debian-edu/pkg-team/desktop-autoloader/README.md
-Package: desktop-session-autoloader
+Package: desktop-autoloader
Architecture: all
Depends:
${misc:Depends},
-Suggests:
+ adduser,
Description: Accelerate Diskless Workstation systems by pre-loading a dummy Desktop Session
This package is for diskless Linux clients as you often find them in
school class rooms running an LTSP based fat client environment.
diff --git a/debian/copyright b/debian/copyright
index 536862f..e8f199c 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,12 +1,12 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: desktop-session-autoloader
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: desktop-autoloader
Upstream-Contact: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Source: https://code.it-zukunft-schule.de
Files: *
Copyright:
- 2011-2017, Klaus Ade Johnstad <klaus@linuxavdelingen.no>
- 2017, Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+ 2011-2018, Klaus Ade Johnstad <klaus@linuxavdelingen.no>
+ 2018, Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
License: GPL-2+
License: GPL-2+
diff --git a/debian/desktop-autoloader.cron b/debian/desktop-autoloader.cron
new file mode 120000
index 0000000..15916e7
--- /dev/null
+++ b/debian/desktop-autoloader.cron
@@ -0,0 +1 @@
+../contrib/desktop-autoloader.cron \ No newline at end of file
diff --git a/debian/desktop-autoloader.default b/debian/desktop-autoloader.default
new file mode 120000
index 0000000..c74bc31
--- /dev/null
+++ b/debian/desktop-autoloader.default
@@ -0,0 +1 @@
+../contrib/desktop-autoloader.default \ No newline at end of file
diff --git a/debian/desktop-autoloader.dirs b/debian/desktop-autoloader.dirs
new file mode 100644
index 0000000..aa26357
--- /dev/null
+++ b/debian/desktop-autoloader.dirs
@@ -0,0 +1 @@
+var/lib/desktop-autoloader/
diff --git a/debian/docs b/debian/desktop-autoloader.docs
index b43bf86..b43bf86 100644
--- a/debian/docs
+++ b/debian/desktop-autoloader.docs
diff --git a/debian/desktop-autoloader.install b/debian/desktop-autoloader.install
new file mode 100644
index 0000000..01b2b2e
--- /dev/null
+++ b/debian/desktop-autoloader.install
@@ -0,0 +1,2 @@
+bin/* usr/bin/
+data/sleep-and-kill.desktop etc/desktop-autoloader/.config/autostart/
diff --git a/debian/desktop-autoloader.manpages b/debian/desktop-autoloader.manpages
new file mode 100644
index 0000000..382586c
--- /dev/null
+++ b/debian/desktop-autoloader.manpages
@@ -0,0 +1 @@
+data/desktop-autoloader.1
diff --git a/debian/desktop-autoloader.postinst b/debian/desktop-autoloader.postinst
new file mode 100755
index 0000000..6ec5a61
--- /dev/null
+++ b/debian/desktop-autoloader.postinst
@@ -0,0 +1,73 @@
+#!/bin/sh
+# postinst script for desktop-autoloader
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+case "$1" in
+ configure)
+
+ # setup desktop-autoloader user and group
+ if ! getent group desktop-autoloader >/dev/null; then
+ echo "Creating desktop-autoloader group." >&2
+ addgroup --system desktop-autoloader
+ else
+ echo "Group desktop-autoloader already exists." >&2
+ fi
+ if ! getent passwd desktop-autoloader >/dev/null; then
+ echo "Creating desktop-autoloader user." >&2
+ adduser --system --no-create-home \
+ --disabled-password --disabled-login \
+ --shell /bin/true --group --home /var/lib/desktop-autoloader desktop-autoloader
+ else
+ echo "User desktop-autoloader already exists." >&2
+ # make sure all settings are appropriate
+ if [ "`id -gn desktop-autoloader`" != "desktop-autoloader" ]; then
+ usermod --gid desktop-autoloader desktop-autoloader
+ test -d /var/lib/desktop-autoloader && \
+ usermod --home /var/lib/desktop-autoloader desktop-autoloader || \
+ usermod --move-home --home /var/lib/desktop-autoloader desktop-autoloader
+ fi
+ if [ "`ls -1d ~desktop-autoloader`" != "/var/lib/desktop-autoloader" ]; then
+ usermod --move-home --home /var/lib/desktop-autoloader desktop-autoloader
+ fi
+ # we leave user shell alone. we have never set this wrongly
+ # and we need to respect the administrator's choices
+ fi
+
+ mkdir -p ~desktop-autoloader/.config/
+ chown desktop-autoloader:desktop-autoloader ~desktop-autoloader/ -Rf
+ if [ ! -h ~desktop-autoloader/.config/autostart ]; then
+ rm -Rf ~desktop-autoloader/.config/autostart
+ fi
+ ln -s /etc/desktop-loader/.config/autostart ~desktop-autoloader/.config/autostart
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/desktop-autoloader.postrm b/debian/desktop-autoloader.postrm
new file mode 100755
index 0000000..3ad8a23
--- /dev/null
+++ b/debian/desktop-autoloader.postrm
@@ -0,0 +1,41 @@
+#! /bin/sh
+# postrm script for desktop-autoloader
+#
+# see: dh_installdeb(1)
+# summary of how this script can be called:
+# * <postrm> `remove'
+# * <postrm> `purge'
+# * <old-postrm> `upgrade' <new-version>
+# * <new-postrm> `failed-upgrade' <old-version>
+# * <new-postrm> `abort-install'
+# * <new-postrm> `abort-install' <old-version>
+# * <new-postrm> `abort-upgrade' <old-version>
+# * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
+# for details, see /usr/share/doc/packaging-manual/
+
+set -e
+
+case "$1" in
+ purge)
+ getent passwd desktop-autoloader >/dev/null && deluser desktop-autoloader
+ getent group desktop-autoloader >/dev/null && delgroup desktop-autoloader
+
+ rm -Rf /var/lib/desktop-autoloader
+
+ ;;
+
+ remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 0
+ ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/install b/debian/install
deleted file mode 100644
index 503fa1d..0000000
--- a/debian/install
+++ /dev/null
@@ -1 +0,0 @@
-#TODO \ No newline at end of file
diff --git a/debian/manpages b/debian/manpages
deleted file mode 100644
index 503fa1d..0000000
--- a/debian/manpages
+++ /dev/null
@@ -1 +0,0 @@
-#TODO \ No newline at end of file
diff --git a/debian/source/format b/debian/source/format
index 46ebe02..89ae9db 100644
--- a/debian/source/format
+++ b/debian/source/format
@@ -1 +1 @@
-3.0 (quilt) \ No newline at end of file
+3.0 (native)
diff --git a/debian/watch b/debian/watch
deleted file mode 100644
index 2d34965..0000000
--- a/debian/watch
+++ /dev/null
@@ -1,3 +0,0 @@
-version=3
-http://code.it-zukunft-schule.de/cgit/desktop-session-autoloader/ \
- snapshot/desktop-session-autoloader-(\d\.\d\.\d)\.tar\.gz$