diff options
Diffstat (limited to 'remote/modules/systemd')
14 files changed, 666 insertions, 0 deletions
diff --git a/remote/modules/systemd/data/etc/systemd/system/activate-swap b/remote/modules/systemd/data/etc/systemd/system/activate-swap new file mode 100644 index 00000000..10cb42e9 --- /dev/null +++ b/remote/modules/systemd/data/etc/systemd/system/activate-swap @@ -0,0 +1,30 @@ +#!/bin/sh +# Copyright (c) 2013 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org +# +# General information about OpenSLX can be found under http://openslx.org +# +# Initialize swap for OpenSLX linux stateless clients, both for swap on local +# disk partitions as well as compressed ramzswap or similar + +############################################################################# + +# depends on mount-disk.sh +# depends on availability of the appropriate kernel module/functionality + +# try to enable compressed RAM SWAP / ZRAM +if modprobe ${MODPRV} ramzswap 2>/dev/null && [ -f /usr/bin/rzscontrol ] ; then + rzscontrol /dev/ramzswap0 --init + swapon /dev/ramzswap0 2>/dev/null + #hdswap="# disk swap disabled because of enabled compressed ramswap" +elif modprobe ${MODPRV} zram 2>/dev/null ; then + # assign a quarter of total mem to zram + echo $(( $(free -k | awk '/^Mem:/ { print $2 }') * 256 )) > /sys/block/zram0/disksize + mkswap /dev/zram0 2>/dev/null + swapon /dev/zram0 2>/dev/null +fi diff --git a/remote/modules/systemd/data/etc/systemd/system/analyse-disk.sh b/remote/modules/systemd/data/etc/systemd/system/analyse-disk.sh new file mode 100644 index 00000000..0c152dbf --- /dev/null +++ b/remote/modules/systemd/data/etc/systemd/system/analyse-disk.sh @@ -0,0 +1,120 @@ +#!/bin/sh +# Copyright (c) 2013 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org +# +# General information about OpenSLX can be found under http://openslx.org +# +# Local hard disk autoconfiguration script for OpenSLX linux stateless +# clients, detecting swap and special partitions + +############################################################################# + +# Todo: +# * This script should be run just once per boot! +# * The activation of swap could/should be handled in separate script!? +# * The mounting of /tmp could/should be done separately? +# * Same for other partitions, use information of /etc/fstab for that? +# * Should we just install xfs in the source system and boil down everything +# onto that? + +# General formatter for the /tmp partition on a local harddisk +diskfm () { +local target=$1 +local mntpnt=$2 +local fs +local path +for fs in xfs reiserfs ext2 ; do + if strinfile "$fs" /proc/filesystems || modprobe ${MODPRV} $fs ; then + unset $found + for path in /sbin /bin /usr/sbin /usr/bin ; do + if test -x /mnt/$path/mkfs.$fs ; then + found=yes + case mkfs.$fs in + mkfs.xfs) + fopt="-f" + mopt="-o noexec" + ;; + mkfs.ext2) + fopt="-Fq" + mopt="-o nocheck,noexec" + ;; + mkfs.reiserfs) + fopt="-f" + mopt="-o noexec" + ;; + esac + mkfs.$fs $fopt $target >/dev/null 2>&1 #|| error + if [ -z $mntpnt ] ; then + umount /tmp 2>/dev/null + if mount -t $fs -n $mopt $target /tmp 2>/dev/null; then + return 0 + else + mount -n -t tmpfs none /tmp + fi + else + mkdir -p $mntpnt + mount -t $fs -n -o loop $target $mntpnt 2>/dev/null + return 0 + fi + fi + done + [ -z $found ] && continue + else break + fi +done +} + +# Check for local harddisks and appropriate partitions +fdisk -l /dev/$hd|sed -n "/^\/dev\//p" >/etc/disk.partition + +# Check for standard swap partitions and make them available to the system +for hdpartnr in $(cat /etc/disk.partition | \ + sed -n -e "/ 82 /p"|sed -e "s/[[:space:]].*//") ; do + echo -e "$hdpartnr\tswap\t\tswap\t\tdefaults\t 0 0" >>/etc/fstab +done + +# We use special non assigned partition type (id44) for harddisk scratch +# space, thus no normal filesystem will be incidentally deleted or +# corrupted +for hdpartnr in $(cat /etc/disk.partition | \ + sed -n -e "/ 44 /p"|sed -e "s/[[:space:]].*//") ; do + # check for supported filesystem and formatter + ( if diskfm $hdpartnr ; then + echo "$hdpartnr is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready + echo -e "$hdpartnr\t/tmp\t\tauto\t\tdefaults\t 0 0" >>/etc/fstab + else + echo "formatting failed for some reason ($(sysup))" >/tmp/tmpready + fi ) & + break +done + +# Put detected linux partitions (83) into /etc/fstab with "noauto", special +# partition 45 (persistent scratch) to /var/scratch and 46 to /var/openslx +for partid in 83 45 46 ; do + for hdpartnr in $(cat /etc/disk.partition | \ + sed -n -e "/ ${partid} /p"|sed -e "s/[[:space:]].*//") ; do + mkdir -p /media/${hdpartnr#/dev/*} 2>/dev/null + if [ ${partid} -eq 83 ] ; then + echo -e "$hdpartnr\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto,\ +noexec\t 0 0" >>/tmp/fstab + elif [ ${partid} -eq 45 ] ; then + #mount -t auto ${hdpartnr} /media/${hdpartnr#/dev/*} + #ln -sf /media/${hdpartnr#/dev/*} /var/scratch + echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\ +\t\t 0 0" >>/tmp/fstab + elif [ ${partid} -eq 46 ] ; then + # Mount a home directory to (/mnt)/var/home + #mount -t auto ${hdpartnr} /mnt/media/${hdpartnr#/dev/*} \n\ + #test -d /mnt/media/${hdpartnr#/dev/*}/home && \ + # ln -sf /media/${hdpartnr#/dev/*} /var/home + echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\ +\t\t 0 0" >>/tmp/fstab + fi + done +done + diff --git a/remote/modules/systemd/data/etc/systemd/system/debug-shell.service b/remote/modules/systemd/data/etc/systemd/system/debug-shell.service new file mode 100644 index 00000000..063d4995 --- /dev/null +++ b/remote/modules/systemd/data/etc/systemd/system/debug-shell.service @@ -0,0 +1,34 @@ +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. + +[Unit] +Description=Early root shell on tty9 FOR DEBUGGING ONLY +Documentation=man:sushell(8) +DefaultDependencies=no +IgnoreOnIsolate=yes + +[Service] +Environment=TERM=linux +EnvironmentPath=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/openslx/sbin:/openslx/bin:/openslx/usr/sbin:/openslx/usr/bin +ExecStart=/openslx/bin/ash +Restart=always +RestartSec=0 +StandardInput=tty +TTYPath=/dev/tty9 +TTYReset=yes +TTYVHangup=yes +KillMode=process +IgnoreSIGPIPE=no +# bash ignores SIGTERM +KillSignal=SIGHUP + +# Unset locale for the console getty since the console has problems +# displaying some internationalized messages. +Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION= + +[Install] +WantedBy=sysinit.target diff --git a/remote/modules/systemd/data/etc/systemd/system/fetch-config b/remote/modules/systemd/data/etc/systemd/system/fetch-config new file mode 100644 index 00000000..556f0f41 --- /dev/null +++ b/remote/modules/systemd/data/etc/systemd/system/fetch-config @@ -0,0 +1,178 @@ +#!/bin/sh +# Copyright (c) 2013 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org +# +# General information about OpenSLX can be found under http://openslx.org +# +# Fetch configuration from server ... + +############################################################################# + +# Depends on configured networking, provides configuration + + +# Todo: rewrite for next-gen system - principle would be the same ... + +# Function for retrieving configuration file (machine-setup) via tftp from a +# predefined server or given source (file=tftp-server:/path via kernel +# command line) +unpack () { +# $1 is config file name to get, $2 IP of server to get file from +local dst=$1 +if [ -s $dst ] ; then + # fixme: handle different types of packaging (gzip/bzip2)?? + if ! tar -xpzf $dst 2> /tmp/ConfTGZ-tar-error ; then + cat /tmp/ConfTGZ-tar-error + error "$unpack_ConfTGZ" nonfatal + rm /tmp/ConfTGZ-tar-error + fi + [ "$DEBUGLEVEL" -le 2 -o "$DEBUGLEVEL" -eq 8 ] && rm $dst + return 0 +else + return 1 +fi +} + +# tftp wrapper +# usage tftp_get <path> <tftpdserver> [count] +# count is optional - default is 3 - use -1 for indefinit +tftp_get () { + local file="$1" + local file_server="$2" + local download_successful=0 + local countdown="$3" + + if [ -z "$1" -o -z "$2" ]; then + [ $DEBUGLEVEL -ge 1 ] && \ + echo "[tftp_get] Usage: tftp_get <path> <server> [count]" + return 1; + fi + + [ "$countdown" = "" ] && countdown=3 + + until [ $download_successful -eq 1 ] + do + if [ "$countdown" = "0" ]; then + [ $DEBUGLEVEL -ge 1 ] && \ + echo "[tftp_get] download of \"$file\" from \"$file_server\" ... failed" + return 0; + fi + tftp -g -r "/$file" -l /tmp/$(basename $file) $file_server + [ -s /tmp/$(basename $file) ] && download_successful=1 + countdown=$(expr $countdown - 1) + usleep 200000 + done + [ $DEBUGLEVEL -ge 1 ] && \ + echo "[tftp_get] download of \"$file\" from \"$file_server\" ... successful" + return 0; +} + + +# wget wrapper +# usage wget_get <path> <ftp/httpserver> [count] +# count is optional - default is 3 - use -1 for indefinit +wget_get () { + local file="$1" + local file_server="$2" + local download_successful=0 + local countdown="$3" + + if [ -z "$1" -o -z "$2" ]; then + [ $DEBUGLEVEL -ge 1 ] && \ + echo "[wget_get] Usage: wget_get <path> <server> [count]" + return 1; + fi + + [ "$countdown" = "" ] && countdown=3 + + until [ $download_successful -eq 1 ] + do + if [ "$countdown" = "0" ]; then + [ $DEBUGLEVEL -ge 1 ] && \ + echo "[wget_get] download of \"$file\" from \"$file_server\" ... failed" + return 0; + fi + wget -q $file_server$file -O /tmp/$(basename $file) + [ -s /tmp/$(basename $file) ] && download_successful=1 + countdown=$(expr $countdown - 1) + usleep 200000 + done + [ $DEBUGLEVEL -ge 1 ] && \ + echo "[wget_get] download of \"$file\" from \"$file_server\" ... successful" + return 0; +} + + +fileget () { +# normally tftp would be used, alternatively use wget for ftp or http +# if local device file is specified - mount and unmount after copying +local cfgfile +[ "x$fileprot" = "x" ] && fileprot=tftp +if [ "x$filepath" != "x" ] ; then + cfgfile=${filepath} + [ "x$fileserv" = "x" ] && fileserv=$(checkip ${serverip}) + # wait for dns if "fileserv" is a name and not lbd device + [ "$fileprot" != "lbd" ] && \ + echo ${fileserv} | grep -qi [a-z] + [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\ +$filepath, fileserv:$fileserv" >>$LOGFILE + case "$fileprot" in + ftp|http) + wget_get $cfgfile $fileprot://$fileserv \ + && { unpack /tmp/$(basename $cfgfile) && break; } 2>>$LOGFILE + ;; + lbd) + local ldev=$fileserv + echo "Waiting for configuration file ${cfgfile} ...." + [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\ +$filepath, fileserv:$fileserv" >>$LOGFILE + waitfor /mnt/${cfgfile} 10000 + if [ -f /mnt/${cfgfile} ]; then + unpack /mnt/$cfgfile + else + error "$init_errlfg" + fi + ;; + *) + tftp_get $cfgfile $fileserv \ + && unpack /tmp/$(basename $cfgfile) 2>>$LOGFILE + ;; + esac +else + # predefined value for OpenSLX environment; it is expected that this + # directory is just below the tftpboot (path to which the daemon is + # restricted to) + filepath="client-config" + [ "x$fileserv" = "x" ] && fileserv=$(checkip ${serverip}) + [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\ +$filepath, fileserv:$fileserv" >>$LOGFILE + # try to get configuration files successively; start with distro client + # and try last distro default ... + mac=$(echo $macaddr|sed "s/:/-/g") + for cfgfile in ${filepath}/${SYSTEM_NAME}/01-$mac.tgz \ + ${filepath}/${SYSTEM_NAME}/default.tgz ; do + case "$fileprot" in + ftp|http) + wget $fileprot://$fileserv/$cfgfile -O /tmp/$(basename $cfgfile) \ + 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; } + ;; + tftp) + tftp_get $cfgfile $fileserv \ + 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; } + ;; + esac + done + echo -e "\n## Configuration via fileget from ${fileprot}://${fileserv}/\ +${cfgfile}\n# Hierarchy is distro client and as last distro/default" \ + >>/tmp/confviafile +fi +cat /initramfs/machine-setup >>/tmp/confviafile 2>/dev/null || \ + error "$nomachsetup" +echo "fileget via $fileprot from $fileserv/$cfgfile finished" >/tmp/file-done +[ $DEBUGLEVEL -ge 1 ] && echo "fileget from $cfgfile finished" >>$LOGFILE +} diff --git a/remote/modules/systemd/data/etc/systemd/system/getty.target.wants/load-german-keymap.service b/remote/modules/systemd/data/etc/systemd/system/getty.target.wants/load-german-keymap.service new file mode 120000 index 00000000..d329f45a --- /dev/null +++ b/remote/modules/systemd/data/etc/systemd/system/getty.target.wants/load-german-keymap.service @@ -0,0 +1 @@ +../load-german-keymap.service
\ No newline at end of file diff --git a/remote/modules/systemd/data/etc/systemd/system/ip-dns-conf b/remote/modules/systemd/data/etc/systemd/system/ip-dns-conf new file mode 100644 index 00000000..f14ecd88 --- /dev/null +++ b/remote/modules/systemd/data/etc/systemd/system/ip-dns-conf @@ -0,0 +1,86 @@ +#!/bin/sh +# Copyright (c) 2013 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org +# +# General information about OpenSLX can be found under http://openslx.org +# +# Set IP and DNS configuration ... + +############################################################################# + +# Depends on running network interface, provides IP and DNS configuration + +# Dns and ip configuration, hostname of the machine --> to be merged with udhcpc.default.script!! +echo "$host_name" >/proc/sys/kernel/hostname +echo -e "# /etc/hosts - file generated by $0 during OpenSLX stage3\ +\n#\n# IP-Address Full-Qualified-Hostname Short-Hostname\n#\n\ +127.0.0.1\tlocalhost\n::1\t\tlocalhost ipv6-localhost ipv6-loopback\n\ +fe00::0\t\tipv6-localnet\nff00::0\t\tipv6-mcastprefix\nff02::1\ +\t\tipv6-allnodes\nff02::2\t\tipv6-allrouters\nff02::3\t\t\ +ipv6-allhosts\n" >/etc/hosts +if [ -n "${domain_name}" ]; then + echo -en "${clientip}\t" >>/etc/hosts + for name in ${domain_name}; do + echo -en "${host_name}.${name} " >>/etc/hosts + done + echo -e "${host_name}" >>/etc/hosts +else + echo -e "${clientip}\t${host_name}" >>/etc/hosts +fi +# set up domainname and resolving +#rm -rf /etc/resolv.conf + +out=/etc/resolv.conf +echo -e "# /etc/resolv.conf - file generated by\n#\t$0:\n\ +#\t${date}\n#options timeout:1 attempts:1 rotate" > $out + +[ "x${domain_name}" != "x" ] && echo -e "domain ${domain_name}" >> $out +[ "x${domain_search}" != "x" ] && echo -e "search ${domain_search}" >> $out +# fallback +[ "x${domain_search}" == "x" ] && [ "x${domain_name}" != "x" ] && \ + echo -e "search ${domain_name}" >> $out + +[ -n "${domain_name_servers}" ] && { + for name in ${domain_name_servers}; do + echo nameserver ${name} >> $out; + done; } + +# Create hostname file +[ -n ${host_name} ] && [ -n ${domain_name} ] && \ + echo "${host_name}.${domain_name}" > /etc/hostname + + +# Set greeting and add information on booted system +len=$(expr length ${SLXVERSION}${SYSTEM_NAME}) +if [ $len -le 28 ] ; then + vdstr="Stateless Workstation (V${SLXVERSION}/${SYSTEM_NAME})" + smax=28 +else + vdstr="V${SLXVERSION}/${SYSTEM_NAME}" + smax=52 +fi +while [ $len -le $smax ] ; do + vdstr="$vdstr " + len=$(($len + 1)) +done +len=$(expr length ${host_name}) +while [ $len -le 30 ] ; do + space="$space " + len=$(($len + 1)) +done +echo " + WELCOME TO $space \n (\l) + _____ ______ ______ __ __ _______ __ __ __ + / _ | _ | ___| | | | | ____| | | | | | + | | | | |_| | |_ | | | | |___ | | / / + | | | | ___/| _| | | ____ | | | | + | |_| | | | |___| | | | ____| | |___ / / + _____/|__| |______|__| |__| |_______|______|__| |__| + + $vdstr (c) <OpenSLX.ORG> +" >/etc/issue diff --git a/remote/modules/systemd/data/etc/systemd/system/load-german-keymap.service b/remote/modules/systemd/data/etc/systemd/system/load-german-keymap.service new file mode 100644 index 00000000..74753259 --- /dev/null +++ b/remote/modules/systemd/data/etc/systemd/system/load-german-keymap.service @@ -0,0 +1,5 @@ +[Unit] +Description=Setup german keyboard layout + +[Service] +ExecStart=/bin/bash -c 'exec /openslx/sbin/loadkmap < /etc/keymaps/de_DE' diff --git a/remote/modules/systemd/data/etc/systemd/system/network-interface@.service b/remote/modules/systemd/data/etc/systemd/system/network-interface@.service new file mode 100644 index 00000000..137b3af6 --- /dev/null +++ b/remote/modules/systemd/data/etc/systemd/system/network-interface@.service @@ -0,0 +1,8 @@ +[Unit] +Description=Brings interface %i up +Wants=udhcpc@%i.service sshd.service +Before=udhcpc@%i.service + +[Service] +Type=simple +ExecStart=/openslx/bin/ip link set dev %I up diff --git a/remote/modules/systemd/data/etc/systemd/system/nfs-mount.service b/remote/modules/systemd/data/etc/systemd/system/nfs-mount.service new file mode 100644 index 00000000..727ff2ed --- /dev/null +++ b/remote/modules/systemd/data/etc/systemd/system/nfs-mount.service @@ -0,0 +1,7 @@ +[Unit] +Description=Mount NFS Share [TEST] + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/bin/mount -t nfs -o ro,async,nolock 132.230.4.6:/srv/openslx/export/nfs/ubuntu-12.04-test /openslx/mnt diff --git a/remote/modules/systemd/data/etc/systemd/system/sysinit.target.wants/debug-shell.service b/remote/modules/systemd/data/etc/systemd/system/sysinit.target.wants/debug-shell.service new file mode 120000 index 00000000..699b56ac --- /dev/null +++ b/remote/modules/systemd/data/etc/systemd/system/sysinit.target.wants/debug-shell.service @@ -0,0 +1 @@ +../debug-shell.service
\ No newline at end of file diff --git a/remote/modules/systemd/data/etc/systemd/system/udhcpc@.service b/remote/modules/systemd/data/etc/systemd/system/udhcpc@.service new file mode 100644 index 00000000..e7d4d170 --- /dev/null +++ b/remote/modules/systemd/data/etc/systemd/system/udhcpc@.service @@ -0,0 +1,9 @@ +[Unit] +Description=DHCP Client + +[Service] +Type=simple +ExecStart=/openslx/sbin/udhcpc -O domain -O nissrv -O nisdomain -t 8 -s /etc/udhcpc.openslx.script -i %I + +[Install] +WantedBy=multi-user.target diff --git a/remote/modules/systemd/data/usr/lib/udev/rules.d/99-systemd.rules b/remote/modules/systemd/data/usr/lib/udev/rules.d/99-systemd.rules new file mode 100644 index 00000000..387a5754 --- /dev/null +++ b/remote/modules/systemd/data/usr/lib/udev/rules.d/99-systemd.rules @@ -0,0 +1,55 @@ +# This file is part of systemd. +# +# systemd 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. + +ACTION=="remove", GOTO="systemd_end" + +SUBSYSTEM=="tty", KERNEL=="tty[0-9]|tty1[0-2]", TAG+="systemd" +SUBSYSTEM=="tty", KERNEL=="tty[a-zA-Z]*|hvc*|xvc*|hvsi*", TAG+="systemd" + +KERNEL=="vport*", TAG+="systemd" + +SUBSYSTEM=="block", KERNEL!="ram*|loop*", TAG+="systemd" +SUBSYSTEM=="block", KERNEL!="ram*|loop*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0" + +# Ignore encrypted devices with no identified superblock on it, since +# we are probably still calling mke2fs or mkswap on it. + +SUBSYSTEM=="block", KERNEL!="ram*|loop*", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_TABLE_TYPE}=="", ENV{ID_FS_USAGE}=="", ENV{SYSTEMD_READY}="0" + +# We need a hardware independent way to identify network devices. We +# use the /sys/subsystem path for this. Current vanilla kernels don't +# actually support that hierarchy right now, however upcoming kernels +# will. HAL and udev internally support /sys/subsystem already, hence +# it should be safe to use this here, too. This is mostly just an +# identification string for systemd, so whether the path actually is +# accessible or not does not matter as long as it is unique and in the +# filesystem namespace. +# +# http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=libudev/libudev-enumerate.c;h=da831449dcaf5e936a14409e8e68ab12d30a98e2;hb=HEAD#l742 + +SUBSYSTEM=="net", KERNEL!="lo", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/net/devices/$name", ENV{SYSTEMD_WANTS}="network-interface@$name.service" +SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/bluetooth/devices/%k" + +SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_WANTS}="bluetooth.target" +ENV{ID_SMARTCARD_READER}=="*?", TAG+="systemd", ENV{SYSTEMD_WANTS}="smartcard.target" +SUBSYSTEM=="sound", KERNEL=="card*", TAG+="systemd", ENV{SYSTEMD_WANTS}="sound.target" + +SUBSYSTEM=="printer", TAG+="systemd", ENV{SYSTEMD_WANTS}="printer.target" +SUBSYSTEM=="usb", KERNEL=="lp*", TAG+="systemd", ENV{SYSTEMD_WANTS}="printer.target" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", TAG+="systemd", ENV{SYSTEMD_WANTS}="printer.target" + +# Apply sysctl variables to network devices (and only to those) as they appear. + +SUBSYSTEM=="net", KERNEL!="lo", RUN+="/usr/lib/systemd/systemd-sysctl --prefix=/proc/sys/net/ipv4/conf/$name --prefix=/proc/sys/net/ipv4/neigh/$name --prefix=/proc/sys/net/ipv6/conf/$name --prefix=/proc/sys/net/ipv6/neigh/$name" + +# Asynchronously mount file systems implemented by these modules as +# soon as they are loaded. + +SUBSYSTEM=="module", KERNEL=="fuse", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="sys-fs-fuse-connections.mount" +SUBSYSTEM=="module", KERNEL=="configfs", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}="sys-kernel-config.mount" + +LABEL="systemd_end" diff --git a/remote/modules/systemd/systemd.build b/remote/modules/systemd/systemd.build new file mode 100644 index 00000000..450e743b --- /dev/null +++ b/remote/modules/systemd/systemd.build @@ -0,0 +1,50 @@ +#tool/distro specific functions for fetching, building and installing dependencies + +fetch_source () { + if [ ! -e .fetched_source ]; then + download_untar "$URL" "src/" + local LIBKMOD_VERSION="kmod-12" + download_untar "http://www.kernel.org/pub/linux/utils/kernel/kmod/${LIBKMOD_VERSION}.tar.gz" "src/" + touch .fetched_source + fi +} + +build () { + if [ ! -e .built ]; then + #build libkmod + cd "src/$LIBKMOD_VERSION/" + ./configure + make -j5 + make install + cd - + + #build systemd + cd "src/$VERSION/" + pinfo "calling configure" + ./configure --disable-manpages --enable-split-usr --sysconfdir="/etc" --enable-gtk-doc-html=no || perror "configure failed." + pinfo "calling make" + make -j5 || perror "make failed." + pinfo "calling make install" + DESTDIR="${MODULE_BUILD_DIR}" make install || perror "make install failed." + cd - + touch .built + fi +} + +post_copy() { + # copy static data files + cp -r "${MODULE_DIR}"/data/* "${TARGET_BUILD_DIR}" || perror "copying data files failed." + + # dont clear systemd log at startup + sed -i.bak "s/TTYVTDisallocate=yes/TTYVTDisallocate=no/g" "${TARGET_BUILD_DIR}/usr/lib/systemd/system/getty@.service" + + #old agetty version doesn't support --noclear option in getty service + if [ "x$(dpkg -s util-linux | grep Version: | cut -d' ' -f2)" == "x2.19.1-2ubuntu3" ]; + then + sed -i.bak "s/ExecStart=-\/sbin\/agetty --noclear %I 38400 linux/ExecStart=-\/sbin\/agetty %I 38400 linux/g" "${TARGET_BUILD_DIR}/usr/lib/systemd/system/getty@.service" + fi + + # add nfs to modules-load list + echo "nfs" > "${TARGET_BUILD_DIR}/etc/modules-load.d/nfs.conf" +} + diff --git a/remote/modules/systemd/systemd.conf b/remote/modules/systemd/systemd.conf new file mode 100644 index 00000000..c5e72aeb --- /dev/null +++ b/remote/modules/systemd/systemd.conf @@ -0,0 +1,82 @@ +VERSION=systemd-197 +URL=http://www.freedesktop.org/software/systemd/${VERSION}.tar.xz +REQUIRED_DEPENDENCIES=" intltool + gperf + dbus + pkg-config + libcap-dev + libudev-dev + libdbus-1-dev" +REQUIRED_BINARIES=" hostnamectl + journalctl + localectl + loginctl + systemctl + systemd-analyze + systemd-ask-password + systemd-cat + systemd-cgls + systemd-cgtop + systemd-coredumpctl + systemd-delta + systemd-detect-virt + systemd-inhibit + systemd-machine-id-setup + systemd-notify + systemd-nspawn + systemd-stdio-bridge + systemd-tmpfiles + systemd-tty-ask-password-agent + timedatectl + udevadm + systemd + systemd-ac-power + systemd-binfmt + systemd-bootchart + systemd-cgroups-agent + systemd-coredump + systemd-fsck + systemd-hostnamed + systemd-initctl + systemd-journald + systemd-localed + systemd-logind + systemd-modules-load + systemd-multi-seat-x + systemd-quotacheck + systemd-random-seed + systemd-readahead + systemd-remount-fs + systemd-reply-password + systemd-shutdown + systemd-shutdownd + systemd-sleep + systemd-sysctl + systemd-timedated + systemd-timestamp + systemd-udevd + systemd-update-utmp + systemd-user-sessions + systemd-vconsole-setup + systemd-fstab-generator + systemd-getty-generator + systemd-rc-local-generator + systemd-system-update-generator + accelerometer + ata_id + cdrom_id + collect + keymap + mtd_probe + scsi_id + v4l_id" +REQUIRED_DIRECTORIES=" /etc + /usr/lib + /usr/include + /usr/share/dbus-1 + /usr/share/polkit-1 + /usr/lib/udev/rules.d" +REQUIRED_FILES=" /usr/bin/systemd-analyze + /usr/share/systemd/kbd-model-map + /usr/lib/udev/findkeyboards + /usr/lib/udev/keyboard-force-release.sh" |
