summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortorben2018-09-24 21:20:08 +0200
committertorben2018-09-24 21:20:08 +0200
commitcc1577261594e12cd2bbf43abbd58dbeaa12f4cf (patch)
tree8ab6264f04a32bc1b9ea50658d1a3beb10cba1d3
parentUpdate bashlink. (diff)
downloadsystemd-init-cc1577261594e12cd2bbf43abbd58dbeaa12f4cf.tar.gz
systemd-init-cc1577261594e12cd2bbf43abbd58dbeaa12f4cf.tar.xz
systemd-init-cc1577261594e12cd2bbf43abbd58dbeaa12f4cf.zip
Code-Refactoring.
-rwxr-xr-xmodules.d/dialog/dialog.sh7
-rwxr-xr-xmodules.d/dialog/module-setup.sh23
-rwxr-xr-xmodules.d/systemd-networkd-ext/hooks/convert-kcl-network-configuration-to-systemd-service-files.sh3
-rwxr-xr-xmodules.d/systemd-networkd-ext/hooks/prepare-network-service-in-newroot.sh2
-rwxr-xr-xmodules.d/systemd-networkd-ext/module-setup.sh31
5 files changed, 10 insertions, 56 deletions
diff --git a/modules.d/dialog/dialog.sh b/modules.d/dialog/dialog.sh
index a3e8acdd..40060692 100755
--- a/modules.d/dialog/dialog.sh
+++ b/modules.d/dialog/dialog.sh
@@ -1,12 +1,9 @@
#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region imports
source /usr/lib/bashlink/module.sh
bl.module.import bashlink.exception
bl.module.import bashlink.ui
type emergency_shell >/dev/null 2>&1 || \
source /lib/dracut-lib.sh
-# endregion
bl.exception.try
# Quiet systemd logs.
kill -55 1
@@ -17,7 +14,3 @@ bl.exception.catch_single {
bl.logging.error "$bl_exception_last_traceback"
emergency_shell "error in ${BASH_SOURCE[0]}"
}
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/modules.d/dialog/module-setup.sh b/modules.d/dialog/module-setup.sh
index 78865552..d7e2ce29 100755
--- a/modules.d/dialog/module-setup.sh
+++ b/modules.d/dialog/module-setup.sh
@@ -1,14 +1,4 @@
#!/usr/bin/env bash
-# -*- coding: utf-8 -*-
-# region header
-# Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
-
-# License
-# -------
-
-# This library written by Torben Sickert stand under a creative commons naming
-# 3.0 unported license. see http://creativecommons.org/licenses/by/3.0/deed.de
-# endregion
# shellcheck disable=SC1004,SC2016,SC2034,SC2155
depends() {
local -r __documentation__='
@@ -33,10 +23,10 @@ install() {
"${systemdsystemunitdir}/network.target.d/dialog-dependency.conf"
# NOTE: Needed because dracut waits for network in this service
# additionally..
- #mkdir --parents "${initdir}/${systemdsystemunitdir}/dracut-pre-mount.service.d"
- #inst_simple \
- # "${moddir}/dracut-pre-mount-dialog-dependency.conf" \
- # "${systemdsystemunitdir}/dracut-pre-mount.service.d/dialog-dependency.conf"
+ mkdir --parents "${initdir}/${systemdsystemunitdir}/dracut-pre-mount.service.d"
+ inst_simple \
+ "${moddir}/dracut-pre-mount-dialog-dependency.conf" \
+ "${systemdsystemunitdir}/dracut-pre-mount.service.d/dialog-dependency.conf"
inst_simple \
"${moddir}/dialog.service" \
"${systemdsystemunitdir}/dialog.service"
@@ -56,7 +46,6 @@ install() {
inst_hook cmdline 00 "$moddir/dialog.sh"
fi
inst_multiple dialog
- # TODO nach bashlink auslagern
local name
for name in ncurses; do
local path
@@ -68,7 +57,3 @@ install() {
done
done
}
-# region vim modline
-# vim: set tabstop=4 shiftwidth=4 expandtab:
-# vim: foldmethod=marker foldmarker=region,endregion:
-# endregion
diff --git a/modules.d/systemd-networkd-ext/hooks/convert-kcl-network-configuration-to-systemd-service-files.sh b/modules.d/systemd-networkd-ext/hooks/convert-kcl-network-configuration-to-systemd-service-files.sh
index aff3628d..e2a2fb90 100755
--- a/modules.d/systemd-networkd-ext/hooks/convert-kcl-network-configuration-to-systemd-service-files.sh
+++ b/modules.d/systemd-networkd-ext/hooks/convert-kcl-network-configuration-to-systemd-service-files.sh
@@ -212,7 +212,7 @@ Description=Critical wireless network device.
Name=$WIRELESS_BOOTIF_NAME
EOF
) > "/etc/systemd/network/$WIRELESS_BOOTIF_NAME.link"
- # TODO
+ # Enable to get a new mac for each boot.
#ln \
# --force \
# --symbolic \
@@ -233,7 +233,6 @@ Id=$VLAN
EOF
fi
if [[ "$VLAN" != '' ]]; then
- # Configure the vlan tagged interface for DHCPv4, TODO IPv6
local VLAN_NETWORK_CONF="/etc/systemd/network/$BOOTIF_NAME.$VLAN.network"
cat << EOF > "$VLAN_NETWORK_CONF"
[Match]
diff --git a/modules.d/systemd-networkd-ext/hooks/prepare-network-service-in-newroot.sh b/modules.d/systemd-networkd-ext/hooks/prepare-network-service-in-newroot.sh
index 0446cb88..1c962f65 100755
--- a/modules.d/systemd-networkd-ext/hooks/prepare-network-service-in-newroot.sh
+++ b/modules.d/systemd-networkd-ext/hooks/prepare-network-service-in-newroot.sh
@@ -61,7 +61,6 @@ if $SLX_ONLINE; then
bl.logging.info \
Link service "$service_file_path" to \
"$NEWROOT_SYSINIT_TARGET_DIR/$service_name".
- # TODO test
if [[ "$service_name" != 'systemd-networkd.service' ]]; then
ln \
--force \
@@ -99,7 +98,6 @@ if $SLX_ONLINE; then
# ../restart-wireless-daemon.service \
# "$NEWROOT/usr/lib/systemd/system/multi-user.target.wants/restart-wireless-daemon.service"
# Login to tty1 version, works:
- # TODO remove "false" if pre-caching is working.
cat << EOF >"$NEWROOT/root/.bash_profile"
if [ ! -f /tmp/wireless-daemon-restarted ]; then
wget --output-document - http://10.21.9.111:8080/BOOTED
diff --git a/modules.d/systemd-networkd-ext/module-setup.sh b/modules.d/systemd-networkd-ext/module-setup.sh
index 418ad10e..5e47382f 100755
--- a/modules.d/systemd-networkd-ext/module-setup.sh
+++ b/modules.d/systemd-networkd-ext/module-setup.sh
@@ -1,6 +1,5 @@
#!/bin/bash
# shellcheck disable=SC1004,SC2016,SC2034,SC2155
-# region imports
# shellcheck source=../bashlink/bashlink/module.sh
source "$(
cd "$(dirname "${BASH_SOURCE[0]}")/.." &>/dev/null && \
@@ -10,7 +9,7 @@ source "$(
bl.module.import bashlink.dependency
bl.module.import bashlink.exception
bl.module.import bashlink.logging
-# endregion
+
check() {
[[ $mount_needs ]] && return 1
@@ -26,7 +25,7 @@ check() {
# called by dracut
depends() {
- # TODO not needed for tests: dialog \
+ # TNNOTE: Add for interactive wlan authorisation: dialog
echo \
bashlink \
custom-logging \
@@ -41,9 +40,6 @@ installkernel() {
# nlmon: Virtual netlink monitoring device.
# usbhid: USB HID transport layer.
# rtl*: USB wlan driver.
-
- #rtl8192cu \
- #rtl18xxxu \
instmods \
ccm \
ctr \
@@ -61,7 +57,6 @@ installkernel() {
install() {
# need initqueue to get a clean network start
dracut_need_initqueue
-
# install required systemd units
# NOTE: "-o" means "optional".
inst_multiple -o \
@@ -135,7 +130,6 @@ install() {
do
systemctl --root "$initdir" enable "$service_name"
done
- # TODO check
sed \
--in-place \
--regexp-extended \
@@ -155,11 +149,6 @@ install() {
"$systemdsystemunitdir/wpa_supplicant@.service" \
"$initdir/$systemdsystemunitdir/network.target.wants/wpa_supplicant@wireless.service"
# Make "wpa_supplicant" systemd "pivot-root" resistent.
- #sed \
- # --in-place \
- # --regexp-extended \
- # 's:^(ExecStart=)(.+)$:\1/usr/bin/strace -e trace=open,close,read,write -f -o /var/log/openslx_wlan.log /usr/bin/nice -n 0 /usr/bin/systemd-preserve-process-marker \2:' \
- # "$initdir/$systemdsystemunitdir/wpa_supplicant@.service"
sed \
--in-place \
--regexp-extended \
@@ -175,7 +164,7 @@ install() {
--regexp-extended \
's:^(\[Service\]):\1\nKillMode=none:' \
"$initdir/$systemdsystemunitdir/wpa_supplicant@.service"
- # iwd version:
+ # alternate iwd version:
#ln \
# --symbolic \
# "$systemdsystemunitdir/iwd.service" \
@@ -196,22 +185,16 @@ install() {
# --regexp-extended \
# 's:^(\[Service\]):\1\nKillMode=none:' \
# "$initdir/$systemdsystemunitdir/iwd.service"
- # NOTE: Possibly additional interesting configurations here:
- #DefaultDependencies=no
- #OnFailure=emergency.target
- #Conflicts=shutdown.target
- #ConditionKernelCommandLine=!
ln \
--force \
--symbolic \
/run/systemd/resolve/resolv.conf \
"$initdir/etc/resolv.conf"
- # create system users needed
+ # add needed system users needed
local user
for user in systemd-network systemd-resolve; do
grep "^${user}:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
grep "^${user}:" /etc/group 2>/dev/null >> "$initdir/etc/group"
- # adduser --system "$user"
done
if ! grep "^systemd-network:" /etc/passwd &>/dev/null; then
echo 'systemd-network:x:982:982:systemd Network Management:/:/sbin/nologin' \
@@ -295,9 +278,6 @@ then
bl.logging.warn File \\"\$path\\" not available for pre-caching.
fi
done
- # NOTE: Needed to perform to inform the authentication server about
- # deauthenticating the passed connection coming from the initramfs.
- #cp --force /usr/lib/libaircrack* "\$NEWROOT/usr/lib"
# NOTE: This would allow to traverse the full root target tree in offline
# mode:
#tree "\$NEWROOT" 1>/dev/null
@@ -306,10 +286,9 @@ fi
EOF
) > "$temporary_hook_file_path"
inst_hook pre-pivot 10 "$temporary_hook_file_path"
- # the hook script that will parse the "ip=" kernel command line
+ # Hook script to parse the "ip=" kernel command line
# parameter and generate the .link and .network files needed
# by systemd-networkd.
inst_hook pre-pivot 20 "$moddir/hooks/prepare-network-service-in-newroot.sh"
inst_hook pre-pivot 30 "$moddir/hooks/configure-dhcp-for-newroot.sh"
}
-