summaryrefslogtreecommitdiffstats
path: root/dev-tools
diff options
context:
space:
mode:
authorjandob2016-03-29 19:06:22 +0200
committerjandob2016-03-29 19:06:22 +0200
commit7a14d8932f1f4bba79ba4e7b8d5fe4129788e4ac (patch)
tree0de5de71c12e08e3783bc885fb7c30c4b0346c2b /dev-tools
parentadd logging to file functionality (diff)
parentFix. (diff)
downloadsystemd-init-7a14d8932f1f4bba79ba4e7b8d5fe4129788e4ac.tar.gz
systemd-init-7a14d8932f1f4bba79ba4e7b8d5fe4129788e4ac.tar.xz
systemd-init-7a14d8932f1f4bba79ba4e7b8d5fe4129788e4ac.zip
Merge branch 'master' of git.openslx.org:openslx-ng/systemd-init
Diffstat (limited to 'dev-tools')
-rwxr-xr-xdev-tools/exampleDracutModule/apply-package.sh38
-rwxr-xr-xdev-tools/exampleDracutModule/module-setup.sh4
-rw-r--r--dev-tools/exampleDracutModule/source/usr/lib/systemd/system/example.service10
-rw-r--r--dev-tools/exampleDracutModule/source/usr/lib/systemd/system/multi-user.target.wants/example.service10
4 files changed, 58 insertions, 4 deletions
diff --git a/dev-tools/exampleDracutModule/apply-package.sh b/dev-tools/exampleDracutModule/apply-package.sh
index 218740ef..07d3c0a5 100755
--- a/dev-tools/exampleDracutModule/apply-package.sh
+++ b/dev-tools/exampleDracutModule/apply-package.sh
@@ -1,8 +1,38 @@
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
-source /etc/openslx
+source '/usr/lib/rebash/core.sh'
+core.import exceptions
+core.import logging
+type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
-echo --------------------------------------------------------------------------
-echo TEST
-echo --------------------------------------------------------------------------
+exceptions.try
+{
+ logging.set_commands_level debug
+ logging.set_level debug
+ # NOTE: "getarg" raises an exception so deactivate exceptions for now.
+ exceptions.deactivate
+ slx_server="$(getarg slxsrv=)"
+ slx_server_base="$(getarg slxbase=)"
+ exceptions.activate
+
+ logging.info 'Getting package.'
+ IFS_backup="$IFS"
+ IFS=','
+ for host in ${slx_server}; do
+ logging.info "Trying host \"$host\"."
+ if wget --timeout 5 \
+ "http://${host}/${slx_server_base}config.tar.gz" \
+ --output-document - | tar --extract --verbose --gzip --directory \
+ "$NEWROOT"
+ then
+ break
+ fi
+ done
+ IFS="$IFS_backup"
+}
+exceptions.catch
+{
+ logging.error "$exceptions_last_traceback"
+ emergency_shell "error in ${BASH_SOURCE[0]}"
+}
diff --git a/dev-tools/exampleDracutModule/module-setup.sh b/dev-tools/exampleDracutModule/module-setup.sh
index bfe216e7..8a7d0e07 100755
--- a/dev-tools/exampleDracutModule/module-setup.sh
+++ b/dev-tools/exampleDracutModule/module-setup.sh
@@ -14,6 +14,9 @@ check() {
`check`
'
+
+ # Here we could build our package file.
+
# Tell dracut that this module should only be included if it is required
# explicitly.
return 255
@@ -38,4 +41,5 @@ install() {
`install`
'
inst_hook pre-pivot 00 "$moddir/apply-package.sh"
+ inst_multiple tar wget
}
diff --git a/dev-tools/exampleDracutModule/source/usr/lib/systemd/system/example.service b/dev-tools/exampleDracutModule/source/usr/lib/systemd/system/example.service
new file mode 100644
index 00000000..83310c1d
--- /dev/null
+++ b/dev-tools/exampleDracutModule/source/usr/lib/systemd/system/example.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Simple example service
+After=dracut-pre-mount.service network.target
+DefaultDependencies=no
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+KillMode=none
+ExecStart=/usr/bin/bash -c '/usr/bin/echo test >/tmp/test-output.txt'
diff --git a/dev-tools/exampleDracutModule/source/usr/lib/systemd/system/multi-user.target.wants/example.service b/dev-tools/exampleDracutModule/source/usr/lib/systemd/system/multi-user.target.wants/example.service
new file mode 100644
index 00000000..83310c1d
--- /dev/null
+++ b/dev-tools/exampleDracutModule/source/usr/lib/systemd/system/multi-user.target.wants/example.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Simple example service
+After=dracut-pre-mount.service network.target
+DefaultDependencies=no
+
+[Service]
+Type=oneshot
+RemainAfterExit=true
+KillMode=none
+ExecStart=/usr/bin/bash -c '/usr/bin/echo test >/tmp/test-output.txt'