diff options
author | William Harrington <kb0iic@cross-lfs.org> | 2014-04-26 20:51:13 -0500 |
---|---|---|
committer | William Harrington <kb0iic@cross-lfs.org> | 2014-04-26 20:51:13 -0500 |
commit | d428b64adcd7aa90681669315f7ff847bb2af3ea (patch) | |
tree | b80fe7868fac840476e45960edfe3a990dc23e79 |
Initial commit.
54 files changed, 1111 insertions, 0 deletions
@@ -0,0 +1,29 @@ +Copyright (c) 1999-2002, Gerard Beekmans + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions in any form must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Neither the name of "Linux From Scratch" nor the names of its + contributors may be used to endorse or promote products derived from + this material without specific prior written permission. + + * Any material derived from Linux From Scratch must contain a + reference to the "Linux From Scratch" project. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS +IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 0000000..7ce0684 --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1,2 @@ +This package is maintained by the BLFS Systemd BOOK Editors. +See <http://www.linuxfromscratch.org/blfs/>. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3c63df2 --- /dev/null +++ b/Makefile @@ -0,0 +1,290 @@ +SHELL=/bin/bash + +EXTDIR=${DESTDIR}/etc +DEFAULTSDIR=${DESTDIR}/etc/sysconfig +SERVICEDIR=${DESTDIR}/lib/services +TMPFILESDIR=${DESTDIR}/usr/lib/tmpfiles.d +UNITSDIR=${DESTDIR}/lib/systemd/system +MODE=755 +DIRMODE=755 +CONFMODE=644 + +all: + @grep "^install" Makefile.systemd | cut -d ":" -f 1 + @echo "Select an appropriate install target from the above list" + +create-dirs: + install -d -m ${DIRMODE} ${DEFAULTSDIR} + install -d -m ${DIRMODE} ${TMPFILESDIR} + install -d -m ${DIRMODE} ${UNITSDIR} + +create-service-dir: + install -d -m ${DIRMODE} ${EXTDIR}/sysconfig/network-devices/services + install -d -m ${DIRMODE} ${SERVICEDIR} + +install-service-dhclient: create-service-dir + install -m ${MODE} clfs/services/dhclient ${SERVICEDIR} + +install-service-dhcpcd: create-service-dir + install -m ${MODE} clfs/services/dhcpcd ${SERVICEDIR} + +install-service-bridge: create-service-dir + install -m ${MODE} clfs/services/bridge ${SERVICEDIR} + +install-service-wpa: create-service-dir + install -m ${MODE} clfs/services/wpa ${SERVICEDIR} + +install-acpid: create-dirs + install -m ${CONFMODE} clfs/units/acpid.service ${UNITSDIR}/ + install -m ${CONFMODE} clfs/units/acpid.socket ${UNITSDIR}/ + systemctl enable acpid.socket + +install-dhcpd: create-dirs + install -m ${CONFMODE} clfs/default/dhcpd ${DEFAULTSDIR}/ + install -m ${CONFMODE} clfs/units/dhcpd.service ${UNITSDIR}/ + systemctl enable dhcpd.service + +install-fcron: create-dirs + install -m ${CONFMODE} clfs/units/fcron.service ${UNITSDIR}/ + systemctl enable fcron.service + +install-httpd: create-dirs + install -m ${CONFMODE} clfs/tmpfiles/httpd.conf ${TMPFILESDIR}/ + install -m ${CONFMODE} clfs/units/httpd.service ${UNITSDIR}/ + systemd-tmpfiles --create httpd.conf + systemctl enable httpd.service + +install-kdm: create-dirs + install -m ${CONFMODE} clfs/units/kdm.service ${UNITSDIR}/ + systemctl enable kdm.service + +install-krb5: create-dirs + install -m ${CONFMODE} clfs/units/krb5-kdc.service ${UNITSDIR}/ + install -m ${CONFMODE} clfs/units/krb5-kpropd.service ${UNITSDIR}/ + install -m ${CONFMODE} clfs/units/krb5-kadmind.service ${UNITSDIR}/ + systemctl enable krb5-kdc.service + systemctl enable krb5-kpropd.service + systemctl enable krb5-kadmind.service + +install-mysqld: create-dirs + install -m ${CONFMODE} clfs/tmpfiles/mysqld.conf ${TMPFILESDIR}/ + install -m ${CONFMODE} clfs/units/mysqld.service ${UNITSDIR}/ + systemd-tmpfiles --create mysqld.conf + systemctl enable mysqld.service + +install-named: create-dirs + install -m ${CONFMODE} clfs/tmpfiles/named.conf ${TMPFILESDIR}/ + install -m ${CONFMODE} clfs/units/named.service ${UNITSDIR}/ + systemd-tmpfiles --create named.conf + systemctl enable named.service + +install-nscd: create-dirs + install -m ${CONFMODE} clfs/tmpfiles/nscd.conf ${TMPFILESDIR}/ + install -m ${CONFMODE} clfs/units/nscd.service ${UNITSDIR}/ + systemd-tmpfiles --create nscd.conf + systemctl enable nscd.service + +install-ntpd: create-dirs + install -m ${CONFMODE} clfs/units/ntpd.service ${UNITSDIR}/ + systemctl enable ntpd.service + +install-postfix: create-dirs + install -m ${CONFMODE} clfs/units/postfix.service ${UNITSDIR}/ + systemctl enable postfix.service + +install-postgresql: create-dirs + install -m ${CONFMODE} clfs/tmpfiles/postgresql.conf ${TMPFILESDIR}/ + install -m ${CONFMODE} clfs/units/postgresql.service ${UNITSDIR}/ + systemd-tmpfiles --create postgresql.conf + systemctl enable postgresql.service + +install-samba: create-dirs + install -m ${CONFMODE} clfs/default/samba ${DEFAULTSDIR}/ + install -m ${CONFMODE} clfs/tmpfiles/samba.conf ${TMPFILESDIR}/ + install -m ${CONFMODE} clfs/units/nmbd.service ${UNITSDIR}/ + install -m ${CONFMODE} clfs/units/smbd.service ${UNITSDIR}/ + install -m ${CONFMODE} clfs/units/smbdat.service ${UNITSDIR}/smbd@.service + install -m ${CONFMODE} clfs/units/smbd.socket ${UNITSDIR}/ + systemd-tmpfiles --create samba.conf + systemctl enable nmbd.service + systemctl enable smbd.service + +install-saslauthd: create-dirs + install -m ${CONFMODE} clfs/default/saslauthd ${DEFAULTSDIR}/ + install -m ${CONFMODE} clfs/tmpfiles/saslauthd.conf ${TMPFILESDIR}/ + install -m ${CONFMODE} clfs/units/saslauthd.service ${UNITSDIR}/ + systemd-tmpfiles --create saslauthd.conf + systemctl enable saslauthd.service + +install-slapd: create-dirs + install -m ${CONFMODE} clfs/default/slapd ${DEFAULTSDIR}/ + install -m ${CONFMODE} clfs/tmpfiles/slapd.conf ${TMPFILESDIR}/ + install -m ${CONFMODE} clfs/units/slapd.service ${UNITSDIR}/ + systemd-tmpfiles --create slapd.conf + systemctl enable slapd.service + +install-sshd: create-dirs + install -m ${CONFMODE} clfs/tmpfiles/sshd.conf ${TMPFILESDIR}/ + install -m ${CONFMODE} clfs/units/sshd.service ${UNITSDIR}/ + install -m ${CONFMODE} clfs/units/sshdat.service ${UNITSDIR}/sshd@.service + install -m ${CONFMODE} clfs/units/sshd.socket ${UNITSDIR}/ + systemd-tmpfiles --create sshd.conf + systemctl enable sshd.service + +install-svnserve: create-dirs + install -m ${CONFMODE} clfs/default/svnserve ${DEFAULTSDIR}/ + install -m ${CONFMODE} clfs/tmpfiles/svnserve.conf ${TMPFILESDIR}/ + install -m ${CONFMODE} clfs/units/svnserve.service ${UNITSDIR}/ + systemd-tmpfiles --create svnserve.conf + systemctl enable svnserve.service + +install-swat: create-dirs + install -m ${CONFMODE} clfs/units/swatat.service ${UNITSDIR}/swat@.service + install -m ${CONFMODE} clfs/units/swat.socket ${UNITSDIR}/ + systemctl enable swat.socket + +install-winbindd: create-dirs + install -m ${CONFMODE} clfs/default/winbindd ${DEFAULTSDIR}/ + install -m ${CONFMODE} clfs/units/winbindd.service ${UNITSDIR}/ + systemctl enable winbindd.service + +uninstall-acpid: + systemctl stop acpid.service + systemctl disable acpid.socket + rm -f ${UNITSDIR}/acpid.service ${UNITSDIR}/acpid.socket + +uninstall-dhcpd: + systemctl stop dhcpd.service + systemctl disable dhcpd.service + rm -f ${DEFAULTSDIR}/dhcpd ${UNITSDIR}/dhcpd.service + +uninstall-httpd: + systemctl stop httpd.service + systemctl disable httpd.service + rm -f ${TMPFILESDIR}/httpd.conf ${UNITSDIR}/httpd.service + +uninstall-kdm: + systemctl stop kdm.service + systemctl disable kdm.service + rm -f ${UNITSDIR}/kdm.service + +uninstall-krb5: + systemctl stop krb5-kadmind.service + systemctl stop krb5-kpropd.service + systemctl stop krb5-kdc.service + systemctl disable krb5-kadmind.service + systemctl disable krb5-kpropd.service + systemctl disable krb5-kdc.service + rm -f ${UNITSDIR}/krb5-kadmind.service ${UNITSDIR}/krb5-kpropd.service ${UNITSDIR}/krb5-kdc.service + +uninstall-mysqld: + systemctl stop mysqld.service + systemctl disable mysqld.service + rm -f ${TMPFILESDIR}/mysqld.conf ${UNITSDIR}/mysqld.service + +uninstall-named: + systemctl stop named.service + systemctl disable named.service + rm -f ${TMPFILESDIR}/named.conf ${UNITSDIR}/named.service + +uninstall-nscd: + systemctl stop nscd.service + systemctl disable nscd.service + rm -f ${TMPFILESDIR}/nscd.conf ${UNITSDIR}/nscd.service + +uninstall-ntpd: + systemctl stop ntpd.service + systemctl disable ntpd.service + rm -f ${UNITSDIR}/ntpd.service + +uninstall-postfix: + systemctl stop postfix.service + systemctl disable postfix.service + rm -f ${UNITSDIR}/postfix.service + +uninstall-postgresql: + systemctl stop postgresql.service + systemctl disable postgresql.service + rm -f ${TMPFILESDIR}/postgresql.conf ${UNITSDIR}/postgresql.service + +uninstall-samba: + systemctl stop smbd.service + systemctl stop nmbd.service + systemctl disable smbd.service + systemctl disable nmbd.service + rm -f ${DEFAULTSDIR}/samba ${TMPFILESDIR}/samba.conf ${UNITSDIR}/nmbd.service + rm -f ${UNITSDIR}/smbd.service ${UNITSDIR}/smbd@.service t ${UNITSDIR}/smbd.socket + +uninstall-saslauthd: + systemctl stop saslauthd.service + systemctl disable saslauthd.service + rm -f ${DEFAULTSDIR}/saslauthd ${TMPFILESDIR}/saslauthd.conf ${UNITSDIR}/saslauthd.service + +uninstall-slapd: + systemctl stop slapd.service + systemctl disable slapd.service + rm -f ${DEFAULTSDIR}/slapd ${TMPFILESDIR}/slapd.conf ${UNITSDIR}/slapd.service + +uninstall-sshd: + systemctl stop sshd.service + systemctl disable sshd.service + rm -f ${TMPFILESDIR}/sshd.conf ${UNITSDIR}/sshd.service + rm -f ${UNITSDIR}/sshd@.service ${UNITSDIR}/sshd.socket + +uninstall-svnserve: + systemctl stop svnserve.service + systemctl disable svnserve.service + rm -f ${DEFAULTSDIR}/svnserve ${TMPFILESDIR}/svnserve.conf ${UNITSDIR}/svnserve.service + +uninstall-swat: + systemctl stop swat.socket + systemctl disable swat.socket + rm -f ${UNITSDIR}/swat@.service ${UNITSDIR}/swat.socket + +uninstall-winbindd: + systemctl stop winbindd.service + systemctl disable winbindd.service + rm -f ${DEFAULTSDIR}/winbindd ${UNITSDIR}/winbindd.service + +.PHONY: all create-dirs create-service-dir \ + install-service-dhclient \ + install-service-dhcpcd \ + install-service-bridge \ + install-service-ipx \ + install-service-pppoe \ + install-service-wpa \ + install-acpid \ + install-dhcpd \ + install-httpd \ + install-kdm \ + install-krb5 \ + install-mysqld \ + install-named \ + install-nscd \ + install-ntpd \ + install-postfix \ + install-postgresql \ + install-samba \ + install-saslauthd \ + install-slapd \ + install-sshd \ + install-svnserve \ + install-swat \ + install-winbindd \ + uninstall-acpid \ + uninstall-dhcpd \ + uninstall-httpd \ + uninstall-kdm \ + uninstall-krb5 \ + uninstall-mysqld \ + uninstall-named \ + uninstall-nscd \ + uninstall-ntpd \ + uninstall-postfix \ + uninstall-postgresql \ + uninstall-samba \ + uninstall-saslauthd \ + uninstall-slapd \ + uninstall-sshd \ + uninstall-svnserve \ + uninstall-swat @@ -0,0 +1,12 @@ +blfs-units: + +This package contains the Systemd units that are mentioned +in the BLFS Systemd BOOK. + +The various install targets are mentioned in the BLFS +Systemd book. There are variables defined for script +permissions {MODE}, configuration and units file +permissions {CONFMODE}, directory permissions {DIRMODE} +and destination directory {DESTDIR}. For more information +refer to the BLFS Systemd BOOK at +http://www.linuxfromscratch.org/blfs/ . diff --git a/clfs/default/dhcpd b/clfs/default/dhcpd new file mode 100644 index 0000000..af6bf30 --- /dev/null +++ b/clfs/default/dhcpd @@ -0,0 +1,12 @@ +# Begin /etc/default/dhcpd + +# On which interfaces should the DHCP Server (dhcpd) serve DHCP requests +# Separate multiple interfaces with spaces, e.g. "eth0 eth1". +# By default, dhcpd will listen on all available interfaces. In that +# case, use -4 or -6 in the DHCPD_OPTS below to listen on IPv4 or IPv6 +DHCPD_INTERFACES="" + +# Additional options that you want to pass to the DHCP Server Daemon +DHCPD_OPTS="" + +# End /etc/default/dhcpd diff --git a/clfs/default/fcron b/clfs/default/fcron new file mode 100644 index 0000000..c54142c --- /dev/null +++ b/clfs/default/fcron @@ -0,0 +1,2 @@ +# Additional options to pass to fcron command line +FCRON_OPTS= diff --git a/clfs/default/samba b/clfs/default/samba new file mode 100644 index 0000000..cfd9119 --- /dev/null +++ b/clfs/default/samba @@ -0,0 +1,5 @@ +# Additional options to pass to nmbd command line +NMBD_OPTS= + +# Additional options to pass to smbd command line +SMBD_OPTS= diff --git a/clfs/default/saslauthd b/clfs/default/saslauthd new file mode 100644 index 0000000..4bb2930 --- /dev/null +++ b/clfs/default/saslauthd @@ -0,0 +1,36 @@ +# Begin /etc/default/saslauthd + +# Which authentication mechanisms should saslauthd use? (default: pam) +# +# Available options in this package: +# getpwent -- use the getpwent() library function +# kerberos5 -- use Kerberos 5 +# pam -- use PAM +# rimap -- use a remote IMAP server +# shadow -- use the local shadow password file +# sasldb -- use the local sasldb database file +# ldap -- use LDAP (configuration is in /etc/saslauthd.conf) +# +# Only one option may be used at a time. See the saslauthd man page +# for more information. +# +# Example: MECHANISMS="shadow" +MECHANISMS="shadow" + +# Additional options for this mechanism. (default: none) +# See the saslauthd man page for information about mech-specific options. +# Note: Specify "-O options" in the following variable or saslauthd will fail. +MECH_OPTIONS="" + +# How many saslauthd processes should we run? (default: 5) +# A value of 0 will fork a new process for each connection. +THREADS=5 + +# Other options (default: -c -m /var/run/saslauthd) +# Note: You MUST specify the -m option or saslauthd won't run! +# +# See the saslauthd man page and the output of 'saslauthd -h' for general +# information about these options. +SASLAUTHD_OPTS="-c -m /var/run/saslauthd" + +# End /etc/default/saslauthd diff --git a/clfs/default/slapd b/clfs/default/slapd new file mode 100644 index 0000000..7f746d6 --- /dev/null +++ b/clfs/default/slapd @@ -0,0 +1,17 @@ +# Begin /etc/default/slapd + +# slapd normally serves ldap only on all TCP-ports 389. slapd can also +# service requests on TCP-port 636 (ldaps) and requests via unix +# sockets. +# Example usage: +#SLAPD_SERVICES="ldap://127.0.0.1:389/ ldaps:/// ldapi:///" + +# Add any aditional options you want to pass to slapd command line. +# +# Use "-h $SLAPD_SERVICES" in the SLAPD_OPTS below if you have +# uncommented and modified SLAPD_SERVICES line above. +# +# See man 8 slapd for more information. +SLAPD_OPTS="" + +# End /etc/default/slapd diff --git a/clfs/default/svnserve b/clfs/default/svnserve new file mode 100644 index 0000000..d0843ff --- /dev/null +++ b/clfs/default/svnserve @@ -0,0 +1,8 @@ +# Begin /etc/default/svnserve + +# Additional options to pass to svnserve command line +# +# Example: -r /srv/svn/repositories +SVNSERVE_OPTS="" + +# End /etc/default/svnserve diff --git a/clfs/default/winbindd b/clfs/default/winbindd new file mode 100644 index 0000000..07b79c1 --- /dev/null +++ b/clfs/default/winbindd @@ -0,0 +1,2 @@ +# Additional options to pass to winbindd command line +WINBINDD_OPTS= diff --git a/clfs/services/bridge b/clfs/services/bridge new file mode 100644 index 0000000..1750fca --- /dev/null +++ b/clfs/services/bridge @@ -0,0 +1,76 @@ +#!/bin/sh +######################################################################## +# Begin /lib/services/bridge +# +# Description : Bridge Boot Script +# +# Authors : Nathan Coulson - nathan@linuxfromscratch.org +# Bruce Dubbs - bdubbs@linuxfromscratch.org +# +# Version : LFS-7.2 +# +######################################################################## + +. /lib/lsb/init-functions +. ${IFCONFIG} + +# Make compatible with older versions of init-functions +unset is_true + +is_true() +{ + [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] || + [ "$1" = "y" ] || [ "$1" = "t" ] +} + +if [ -z "${INTERFACE_COMPONENTS}" ]; then + log_failure_msg "INTERFACE_COMPONENTS variable missing from ${IFCONFIG}" + exit 1 +fi + +case "${2}" in + up) + log_info_msg2 "\n" + log_info_msg "Creating the ${1} interface..." + brctl addbr ${1} + evaluate_retval + + for I in ${INTERFACE_COMPONENTS}; do + log_info_msg "Adding ${I} to ${1}..." + brctl addif ${1} ${I} + evaluate_retval + done + + if is_true ${STP}; then + brctl stp ${1} on + log_success_msg "Setting spanning tree protocol" + fi + + if is_true ${IP_FORWARD}; then + sysctl -w net.ipv4.ip_forward=1 > /dev/null + log_success_msg "Setting net.ipv4.ip_forward = 1" + fi + ;; + + down) + for I in ${INTERFACE_COMPONENTS}; do + log_info_msg "Removing ${I} from ${1}..." + ip link set ${I} down && + brctl delif ${1} ${I} + evaluate_retval + done + + log_info_msg "Bringing down the ${1} interface..." + ip link set ${1} down + brctl delbr ${1} + evaluate_retval + ;; + + *) + echo "Usage: ${0} [interface] {up|down}" + exit 1 + ;; +esac + +# End /lib/services/bridge + diff --git a/clfs/services/dhclient b/clfs/services/dhclient new file mode 100644 index 0000000..2469901 --- /dev/null +++ b/clfs/services/dhclient @@ -0,0 +1,117 @@ +#!/bin/sh +# Begin services/dhclient + +# Origianlly based upon lfs-bootscripts-1.12 $NETWORK_DEVICES/if{down,up} +# Rewritten by Nathan Coulson <nathan@linuxfromscratch.org> +# Adapted for dhclient by DJ Lucas <dj@linuxfromscratch.org> +# Update for LFS 7.0 by Ken Moffat <ken@linuxfromscratch.org> + +# Call with: IFCONFIG=<filename> /lib/services/dhclient <IFACE> <up | down> + +#$LastChangedBy: krejzi $ +#$Date: 2013-02-11 17:22:35 +0100 (Mon, 11 Feb 2013) $ + +. /lib/lsb/init-functions +. $IFCONFIG + +PIDFILE=/run/dhclient-$1.pid +LFILE=/var/lib/dhclient/dhclient-$1.leases + +getipstats() +{ + # Print the last 16 lines of dhclient.leases + sed -e :a -e '$q;N;17,$D;ba' ${LFILE} +} + +# Make compatible with older versions of init-functions +unset is_true + +is_true() +{ + [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] || + [ "$1" = "y" ] || [ "$1" = "t" ] +} + +case "$2" in + up) + + if [ -e ${PIDFILE} ]; then + ps $(cat ${PIDFILE}) | grep dhclient >/dev/null + if [ "$?" = "0" ]; then + log_warning_msg "\n dhclient appears to be running on $1" + exit 0 + else + rm ${PIDFILE} + fi + fi + + log_info_msg "\n Starting dhclient on the $1 interface..." + + /sbin/dhclient -lf ${LFILE} -pf ${PIDFILE} $DHCP_START $1 + + if [ "$?" != "0" ]; then + log_failure_msg2 + exit 1 + fi + + # Print the assigned settings if requested + if is_true "$PRINTIP" -o is_true "$PRINTALL"; then + # Get info from dhclient.leases file + + IPADDR=`getipstats | grep "fixed-address" | \ + sed 's/ fixed-address //' | \ + sed 's/\;//'` + + NETMASK=`getipstats | grep "subnet-mask" | \ + sed 's/ option subnet-mask //' | \ + sed 's/\;//'` + + GATEWAY=`getipstats | grep "routers" | \ + sed 's/ option routers //' | \ + sed 's/\;//'` + + DNS=`getipstats | grep "domain-name-servers" | \ + sed 's/ option domain-name-servers //' | \ + sed 's/\;//' | sed 's/,/ and /'` + + if [ "$PRINTALL" = "yes" ]; then + # This is messy, the messages are on one very long + # line on the screen and in the log + log_info_msg " DHCP Assigned Settings for $1:" + log_info_msg " IP Address: $IPADDR" + log_info_msg " Subnet Mask: $NETMASK" + log_info_msg " Default Gateway: $GATEWAY" + log_info_msg " DNS Server: $DNS" + else + log_info_msg " IP Addresss:""$IPADDR" + fi + fi + + log_success_msg2 + ;; + + down) + if [ ! -e ${PIDFILE} ]; then + log_warning_msg "\n dhclient doesn't appear to be running on $1" + exit 0 + fi + + log_info_msg "\n Stopping dhclient on the $1 interface..." + + /sbin/dhclient -r -lf ${LFILE} -pf ${PIDFILE} $DHCP_STOP $1 + + ps $(cat ${PIDFILE}) | grep dhclient >/dev/null + if [ "$?" != "0" ]; then + rm -f ${PIDFILE} + fi + + evaluate_retval + ;; + + *) + echo "Usage: $0 [interface] {up|down}" + exit 1 + ;; +esac + +# End services/dhclient diff --git a/clfs/services/dhcpcd b/clfs/services/dhcpcd new file mode 100644 index 0000000..0408df1 --- /dev/null +++ b/clfs/services/dhcpcd @@ -0,0 +1,69 @@ +#!/bin/bash +# Begin services/dhcpcd + +# Origianlly dased upon lfs-bootscripts-1.12 $NETWORK_DEVICES/if{down,up} +# Rewritten by Nathan Coulson <nathan@linuxfromscratch.org> +# Adapted for dhcpcd by DJ Lucas <dj@linuxfromscratch.org> +# Update for LFS 7.0 by Bruce Dubbs <bdubbs@linuxfromscratch,org> + +# Call with: IFCONFIG=<filename> /lib/services/dhcpcd <IFACE> <up | down> + +#$LastChangedBy: bdubbs $ +#$Date: 2012-04-09 21:48:51 +0200 (Mon, 09 Apr 2012) $ + +. /lib/lsb/init-functions +. $IFCONFIG + +pidfile="/var/run/dhcpcd-$1.pid" + +case "$2" in + up) + # Cosmetic output not needed for multiple services + if ! $(echo ${SERVICE} | grep -q " "); then + log_info_msg2 "\n" # Terminate the previous message + fi + + log_info_msg "Starting dhcpcd on the $1 interface..." + + # Test to see if there is a stale pid file + if [ -f "$pidfile" ]; then + ps `cat "$pidfile"` | grep dhcpcd > /dev/null + + if [ $? != 0 ]; then + rm -f /var/run/dhcpcd-$1.pid > /dev/null + + else + log_warning_msg "dhcpcd is already running!" + exit 2 + fi + fi + + /sbin/dhcpcd $1 $DHCP_START + evaluate_retval + ;; + + down) + log_info_msg "Stopping dhcpcd on the $1 interface..." + + if [ -z "$DHCP_STOP" ]; then + killproc -p "${pidfile}" /sbin/dhcpcd + + else + /sbin/dhcpcd $1 $DHCP_STOP &> /dev/null + + if [ "$?" -eq 1 ]; then + log_warning_msg "dhcpcd not running!" + exit 2 + fi + fi + + evaluate_retval + ;; + + *) + echo "Usage: $0 [interface] {up|down}" + exit 1 + ;; +esac + +# End services/dhcpcd diff --git a/clfs/services/wpa b/clfs/services/wpa new file mode 100644 index 0000000..a02f0e8 --- /dev/null +++ b/clfs/services/wpa @@ -0,0 +1,89 @@ +#!/bin/bash +# Begin services/wpa + +# Origianlly based upon lfs-bootscripts-1.12 $NETWORK_DEVICES/if{down,up} +# Written by Armin K. <krejzi at email dot com> + +# Call with: IFCONFIG=<filename> /lib/services/wpa <IFACE> <up | down> + +#$LastChangedBy: krejzi $ +#$Date: 2013-03-24 16:39:14 +0100 (Sun, 24 Mar 2013) $ + +. /lib/lsb/init-functions +. $IFCONFIG + +CFGFILE=/etc/sysconfig/wpa_supplicant-${IFCONFIG##*.}.conf +PIDFILE=/run/wpa_supplicant/$1.pid +CONTROL_IFACE=/run/wpa_supplicant/$1 + +case "$2" in + up) + + if [ -e ${PIDFILE} ]; then + ps $(cat ${PIDFILE}) | grep wpa_supplicant >/dev/null + if [ "$?" = "0" ]; then + log_warning_msg "\n wpa_supplicant already running on $1." + exit 0 + else + rm ${PIDFILE} + fi + fi + + if [ ! -e ${CFGFILE} ]; then + log_info_msg "\n wpa_supplicant configuration file ${CFGFILE} not present" + log_failure_msg2 + exit 1 + fi + + log_info_msg "\n Starting wpa_supplicant on the $1 interface..." + + mkdir -p /run/wpa_supplicant + + /sbin/wpa_supplicant -q -B -Dnl80211,wext -P${PIDFILE} -C/run/wpa_supplicant -c${CFGFILE} -i$1 ${WPA_ARGS} + + if [ "$?" != "0" ]; then + log_failure_msg2 + exit 1 + fi + + log_success_msg2 + + if [ -n "${WPA_SERVICE}" ]; then + if [ ! -e /lib/services/${WPA_SERVICE} -a ! -x /lib/services/${WPA_SERVICE} ]; then + log_info_msg "\n Cannot start ${WPA_SERVICE} on $1" + log_failure_msg2 + exit 1 + fi + + IFCONFIG=${IFCONFIG} /lib/services/${WPA_SERVICE} $1 up + fi + ;; + + down) + if [ -n "${WPA_SERVICE}" ]; then + if [ ! -e /lib/services/${WPA_SERVICE} -a ! -x /lib/services/${WPA_SERVICE} ]; then + log_warning_msg "\n Cannot stop ${WPA_SERVICE} on $1" + else + IFCONFIG=${IFCONFIG} /lib/services/${WPA_SERVICE} $1 down + fi + fi + + log_info_msg "\n Stopping wpa_supplicant on the $1 interface..." + + if [ -e ${PIDFILE} ]; then + kill -9 $(cat ${PIDFILE}) + rm -f ${PIDFILE} ${CONTROL_IFACE} + evaluate_retval + else + log_warning_msg "\n wpa_supplicant already stopped on $1" + exit 0 + fi + ;; + + *) + echo "Usage: $0 [interface] {up|down}" + exit 1 + ;; +esac + +# End services/wpa diff --git a/clfs/tmpfiles/httpd.conf b/clfs/tmpfiles/httpd.conf new file mode 100644 index 0000000..3d892e0 --- /dev/null +++ b/clfs/tmpfiles/httpd.conf @@ -0,0 +1 @@ +d /run/httpd 755 root root - diff --git a/clfs/tmpfiles/mysqld.conf b/clfs/tmpfiles/mysqld.conf new file mode 100644 index 0000000..6883dc7 --- /dev/null +++ b/clfs/tmpfiles/mysqld.conf @@ -0,0 +1 @@ +d /run/mysqld 0755 mysql mysql - diff --git a/clfs/tmpfiles/named.conf b/clfs/tmpfiles/named.conf new file mode 100644 index 0000000..1cfc82d --- /dev/null +++ b/clfs/tmpfiles/named.conf @@ -0,0 +1 @@ +d /run/named 0750 named named - diff --git a/clfs/tmpfiles/nscd.conf b/clfs/tmpfiles/nscd.conf new file mode 100644 index 0000000..c11675b --- /dev/null +++ b/clfs/tmpfiles/nscd.conf @@ -0,0 +1,2 @@ +d /run/nscd 755 root root - + diff --git a/clfs/tmpfiles/postgresql.conf b/clfs/tmpfiles/postgresql.conf new file mode 100644 index 0000000..c2e0747 --- /dev/null +++ b/clfs/tmpfiles/postgresql.conf @@ -0,0 +1 @@ +d /run/postgresql 0775 postgres postgres - diff --git a/clfs/tmpfiles/samba.conf b/clfs/tmpfiles/samba.conf new file mode 100644 index 0000000..84d7db7 --- /dev/null +++ b/clfs/tmpfiles/samba.conf @@ -0,0 +1 @@ +d /run/samba 755 root root - diff --git a/clfs/tmpfiles/saslauthd.conf b/clfs/tmpfiles/saslauthd.conf new file mode 100644 index 0000000..96c5a7f --- /dev/null +++ b/clfs/tmpfiles/saslauthd.conf @@ -0,0 +1 @@ +d /run/saslauthd 755 root root - diff --git a/clfs/tmpfiles/slapd.conf b/clfs/tmpfiles/slapd.conf new file mode 100644 index 0000000..8857aed --- /dev/null +++ b/clfs/tmpfiles/slapd.conf @@ -0,0 +1 @@ +d /run/openldap 0755 ldap ldap - diff --git a/clfs/tmpfiles/sshd.conf b/clfs/tmpfiles/sshd.conf new file mode 100644 index 0000000..b76640e --- /dev/null +++ b/clfs/tmpfiles/sshd.conf @@ -0,0 +1 @@ +d /run/sshd 755 root root - diff --git a/clfs/tmpfiles/svnserve.conf b/clfs/tmpfiles/svnserve.conf new file mode 100644 index 0000000..07317c8 --- /dev/null +++ b/clfs/tmpfiles/svnserve.conf @@ -0,0 +1 @@ +d /run/svnserve 0700 root root - diff --git a/clfs/units/acpid.service b/clfs/units/acpid.service new file mode 100644 index 0000000..733edc9 --- /dev/null +++ b/clfs/units/acpid.service @@ -0,0 +1,7 @@ +[Unit] +Description=ACPI event daemon +Requires=acpid.socket + +[Service] +StandardInput=socket +ExecStart=/usr/sbin/acpid diff --git a/clfs/units/acpid.socket b/clfs/units/acpid.socket new file mode 100644 index 0000000..1e5365b --- /dev/null +++ b/clfs/units/acpid.socket @@ -0,0 +1,8 @@ +[Unit] +Description=ACPID Listen Socket + +[Socket] +ListenStream=/run/acpid.socket + +[Install] +WantedBy=sockets.target diff --git a/clfs/units/dhcpd.service b/clfs/units/dhcpd.service new file mode 100644 index 0000000..bacfc47 --- /dev/null +++ b/clfs/units/dhcpd.service @@ -0,0 +1,13 @@ +[Unit] +Description=ISC DHCP Server +After=network.target + +[Service] +Type=forking +PIDFile=/run/dhcpd.pid +EnvironmentFile=/etc/default/dhcpd +ExecStart=/usr/sbin/dhcpd -pf /run/dhcpd.pid -q $DHCPD_OPTS $DHCPD_INTERFACES +KillSignal=SIGINT + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/fcron.service b/clfs/units/fcron.service new file mode 100644 index 0000000..5fedc79 --- /dev/null +++ b/clfs/units/fcron.service @@ -0,0 +1,19 @@ +#systemd service configuration file for fcron installed from fcron 3.1.2 package +#2014-02-06 Add EnvironmentFile to use runtime options using $FCRON_OPTS + +[Unit] +Description=fcron periodical command scheduler +After=remote-fs.target syslog.target time-sync.target +Before=shutdown.target + +[Service] +Type=forking +EnvironmentFile=/etc/sysconfig/fcron +PIDFile=/var/run/fcron.pid +ExecStart=/usr/sbin/fcron $FCRON_OPTS +ExecReload=/bin/kill -USR1 $MAINPID +Restart=always +KillMode=process + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/httpd.service b/clfs/units/httpd.service new file mode 100644 index 0000000..bb02b59 --- /dev/null +++ b/clfs/units/httpd.service @@ -0,0 +1,15 @@ +[Unit] +Description=Apache Web Server +After=network.target remote-fs.target nss-lookup.target + +[Service] +Type=forking +PIDFile=/run/httpd/httpd.pid +ExecStart=/usr/sbin/apachectl start +ExecStop=/usr/sbin/apachectl graceful-stop +ExecReload=/usr/sbin/apachectl graceful +PrivateTmp=true +LimitNOFILE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/kdm.service b/clfs/units/kdm.service new file mode 100644 index 0000000..c57aba9 --- /dev/null +++ b/clfs/units/kdm.service @@ -0,0 +1,9 @@ +[Unit] +Description=K Display Manager +After=systemd-user-sessions.service + +[Service] +ExecStart=/usr/bin/kdm -nodaemon + +[Install] +Alias=display-manager.service diff --git a/clfs/units/krb5-kadmind.service b/clfs/units/krb5-kadmind.service new file mode 100644 index 0000000..f038e7f --- /dev/null +++ b/clfs/units/krb5-kadmind.service @@ -0,0 +1,8 @@ +[Unit] +Description=Kerberos 5 Administration Server + +[Service] +ExecStart=/usr/sbin/kadmind -nofork + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/krb5-kdc.service b/clfs/units/krb5-kdc.service new file mode 100644 index 0000000..6ec93bb --- /dev/null +++ b/clfs/units/krb5-kdc.service @@ -0,0 +1,9 @@ +[Unit] +Description=Kerberos 5 KDC + +[Service] +ExecStart=/usr/sbin/krb5kdc -n +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/krb5-kpropd.service b/clfs/units/krb5-kpropd.service new file mode 100644 index 0000000..8bd335a --- /dev/null +++ b/clfs/units/krb5-kpropd.service @@ -0,0 +1,8 @@ +[Unit] +Description=Kerberos 5 Propagation Server + +[Service] +ExecStart=/usr/sbin/kpropd -S + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/mysqld.service b/clfs/units/mysqld.service new file mode 100644 index 0000000..3b81725 --- /dev/null +++ b/clfs/units/mysqld.service @@ -0,0 +1,13 @@ +[Unit] +Description=MySQL Server +After=network.target + +[Service] +User=mysql +Group=mysql +ExecStart=/usr/sbin/mysqld --pid-file=/run/mysqld/mysqld.pid +Restart=always +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/named.service b/clfs/units/named.service new file mode 100644 index 0000000..c21f13f --- /dev/null +++ b/clfs/units/named.service @@ -0,0 +1,11 @@ +[Unit] +Description=Internet domain name server +After=network.target + +[Service] +ExecStart=/usr/sbin/named -f -u named +ExecReload=/usr/sbin/rndc reload +ExecStop=/usr/sbin/rndc stop + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/nmbd.service b/clfs/units/nmbd.service new file mode 100644 index 0000000..a2e3a45 --- /dev/null +++ b/clfs/units/nmbd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Samba NetBIOS name server +After=network.target + +[Service] +Type=forking +EnvironmentFile=/etc/default/samba +PIDFile=/run/samba/nmbd.pid +ExecStart=/usr/sbin/nmbd -D $NMBD_OPTS +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/nscd.service b/clfs/units/nscd.service new file mode 100644 index 0000000..ff200a1 --- /dev/null +++ b/clfs/units/nscd.service @@ -0,0 +1,16 @@ +[Unit] +Description=Name Service Cache Daemon + +[Service] +Type=forking +ExecStart=/usr/sbin/nscd +ExecStop=/usr/sbin/nscd --shutdown +ExecReload=/usr/sbin/nscd -i passwd +ExecReload=/usr/sbin/nscd -i group +ExecReload=/usr/sbin/nscd -i hosts +ExecReload=/usr/sbin/nscd -i services +Restart=always +PIDFile=/run/nscd/nscd.pid + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/ntpd.service b/clfs/units/ntpd.service new file mode 100644 index 0000000..b8f06bc --- /dev/null +++ b/clfs/units/ntpd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Network Time Protocol daemon +After=network.target nss-lookup.target + +[Service] +Type=forking +PrivateTmp=true +ExecStart=/usr/sbin/ntpd -g -u ntp:ntp +ControlGroup=cpu:/ + +[Install] +WantedBy=multi-user.target + diff --git a/clfs/units/postfix.service b/clfs/units/postfix.service new file mode 100644 index 0000000..e7d4cd2 --- /dev/null +++ b/clfs/units/postfix.service @@ -0,0 +1,14 @@ +[Unit] +Description=Postfix Mail Transport Agent +After=network.target + +[Service] +Type=forking +PIDFile=/var/spool/postfix/pid/master.pid +ExecStart=/usr/sbin/postfix start +ExecStop=/usr/sbin/postfix stop +ExecReload=/usr/sbin/postfix reload +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/postgresql.service b/clfs/units/postgresql.service new file mode 100644 index 0000000..7ce472f --- /dev/null +++ b/clfs/units/postgresql.service @@ -0,0 +1,25 @@ +[Unit] +Description=PostgreSQL database server +After=network.target + +[Service] +Type=forking +TimeoutSec=120 +User=postgres +Group=postgres + +Environment=PGROOT=/srv/pgsql + +SyslogIdentifier=postgres +PIDFile=${PGROOT}/data/postmaster.pid + +ExecStart= /usr/bin/pg_ctl -s -D ${PGROOT}/data start -w -t 120 +ExecReload=/usr/bin/pg_ctl -s -D ${PGROOT}/data reload +ExecStop= /usr/bin/pg_ctl -s -D ${PGROOT}/data stop -m fast + +# Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in +# killing Postgres, so adjust it downward +OOMScoreAdjust=-200 + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/saslauthd.service b/clfs/units/saslauthd.service new file mode 100644 index 0000000..e7ef809 --- /dev/null +++ b/clfs/units/saslauthd.service @@ -0,0 +1,11 @@ +[Unit] +Description=Cyrus SASL authentication daemon + +[Service] +Type=forking +EnvironmentFile=/etc/default/saslauthd +ExecStart=/usr/sbin/saslauthd -a $MECHANISMS -n $THREADS $MECH_OPTIONS $SASLAUTHD_OPTS +PidFile=/run/saslauthd/saslauthd.pid + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/slapd.service b/clfs/units/slapd.service new file mode 100644 index 0000000..8244128 --- /dev/null +++ b/clfs/units/slapd.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenLDAP server daemon +After=network.target + +[Service] +Type=forking +EnvironmentFile=/etc/default/slapd +ExecStart=/usr/sbin/slapd -u ldap -g ldap $SLAPD_OPTS + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/smbd.service b/clfs/units/smbd.service new file mode 100644 index 0000000..2d6da9c --- /dev/null +++ b/clfs/units/smbd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Samba SMB/CIFS server +After=network.target nmbd.service winbindd.service + +[Service] +Type=forking +EnvironmentFile=/etc/default/samba +PIDFile=/run/samba/smbd.pid +ExecStart=/usr/sbin/smbd -D $SMBD_OPTS +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/smbd.socket b/clfs/units/smbd.socket new file mode 100644 index 0000000..833bf43 --- /dev/null +++ b/clfs/units/smbd.socket @@ -0,0 +1,9 @@ +[Unit] +Description=Samba SMB/CIFS server socket + +[Socket] +ListenStream=445 +Accept=yes + +[Install] +WantedBy=sockets.target diff --git a/clfs/units/smbdat.service b/clfs/units/smbdat.service new file mode 100644 index 0000000..4b9ab62 --- /dev/null +++ b/clfs/units/smbdat.service @@ -0,0 +1,10 @@ +[Unit] +Description=Samba SMB/CIFS server instance + +[Service] +Type=forking +EnvironmentFile=/etc/default/samba +PIDFile=/run/samba/smbd.pid +ExecStart=/usr/sbin/smbd -F $SMBD_OPTS +ExecReload=/bin/kill -HUP $MAINPID +StandardInput=socket diff --git a/clfs/units/sshd.service b/clfs/units/sshd.service new file mode 100644 index 0000000..e4d6c4f --- /dev/null +++ b/clfs/units/sshd.service @@ -0,0 +1,11 @@ +[Unit] +Description=OpenSSH Daemon + +[Service] +ExecStart=/usr/sbin/sshd -D +ExecReload=/bin/kill -HUP $MAINPID +KillMode=process +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/sshd.socket b/clfs/units/sshd.socket new file mode 100644 index 0000000..fd68407 --- /dev/null +++ b/clfs/units/sshd.socket @@ -0,0 +1,9 @@ +[Unit] +Conflicts=sshd.service + +[Socket] +ListenStream=22 +Accept=yes + +[Install] +WantedBy=sockets.target diff --git a/clfs/units/sshdat.service b/clfs/units/sshdat.service new file mode 100644 index 0000000..144b129 --- /dev/null +++ b/clfs/units/sshdat.service @@ -0,0 +1,7 @@ +[Unit] +Description=SSH Per-Connection Server + +[Service] +ExecStart=/usr/sbin/sshd -i +StandardInput=socket +StandardError=syslog diff --git a/clfs/units/svnserve.service b/clfs/units/svnserve.service new file mode 100644 index 0000000..ba2fcc3 --- /dev/null +++ b/clfs/units/svnserve.service @@ -0,0 +1,11 @@ +[Unit] +Description=Subversion protocol daemon +After=network.target + +[Service] +Type=forking +EnvironmentFile=/etc/default/svnserve +ExecStart=/usr/bin/svnserve --daemon --pid-file=/run/svnserve/svnserve.pid $SVNSERVE_OPTS + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/swat.socket b/clfs/units/swat.socket new file mode 100644 index 0000000..e703413 --- /dev/null +++ b/clfs/units/swat.socket @@ -0,0 +1,9 @@ +[Unit] +Description=SWAT Samba Web Admin Tool + +[Socket] +ListenStream=127.0.0.1:901 +Accept=true + +[Install] +WantedBy=sockets.target diff --git a/clfs/units/swatat.service b/clfs/units/swatat.service new file mode 100644 index 0000000..a036b2c --- /dev/null +++ b/clfs/units/swatat.service @@ -0,0 +1,7 @@ +[Unit] +Description=SWAT Samba Web Admin Tool +After=local-fs.target + +[Service] +ExecStart=/usr/sbin/swat +StandardInput=socket diff --git a/clfs/units/tor.service b/clfs/units/tor.service new file mode 100644 index 0000000..29adf92 --- /dev/null +++ b/clfs/units/tor.service @@ -0,0 +1,12 @@ +[Unit] +Description=Anonymizing Overlay Network +After=network.target + +[Service] +Type=forking +ExecStart=/usr/bin/tor +ExecReload=/bin/kill -HUP $MAINPID +KillSignal=SIGINT + +[Install] +WantedBy=multi-user.target diff --git a/clfs/units/winbindd.service b/clfs/units/winbindd.service new file mode 100644 index 0000000..e9de2ee --- /dev/null +++ b/clfs/units/winbindd.service @@ -0,0 +1,13 @@ +[Unit] +Description=Samba Winbind daemon +After=network.target nmbd.service + +[Service] +Type=forking +EnvironmentFile=/etc/default/samba +PIDFile=/run/samba/winbindd.pid +ExecStart=/usr/sbin/winbindd -D $WINBINDD_OPTS +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target |