111. systemd

wget https://www.gnuwakes.org/depot/1.1/main/sources/systemd-v230.tar.gz

tar -xf systemd-v230.tar.gz

wget https://www.gnuwakes.org/depot/1.1/main/sources/systemd.patch
cd systemd-230
patch -p1 < ../systemd.patch 
cd ..

SOURCES_DIR=$PWD/systemd-230
INSTALL_DIR=$PWD/systemd-230-install
BUILD_DIR=$PWD/systemd-230-build

mkdir $INSTALL_DIR $BUILD_DIR
cd $BUILD_DIR

set -e

$SOURCES_DIR/autogen.sh

$SOURCES_DIR/configure       \
  CFLAGS='-g -O0 -ftrapv'    \
  --enable-kdbus             \
  --sysconfdir=/etc          \
  --localstatedir=/var       \
  --libdir=/usr/lib64        \
  --with-rootprefix=/        \
  --with-rootlibdir=/lib64 

make

make DESTDIR=$INSTALL_DIR install

mkdir -v $INSTALL_DIR/sbin
for tool in runlevel reboot shutdown poweroff halt telinit
do
  ln -sfv /bin/systemctl $INSTALL_DIR/sbin/${tool}
done
ln -sfv /lib/systemd/systemd $INSTALL_DIR/sbin/init

# needed by systemd to boot
mkdir -v $INSTALL_DIR/run
# systemd requires that the /run mount point exists. systemd also
# requires that /var/run is a a symlink to /run.
ln -vs /run $INSTALL_DIR/var/run

# disable screen clearing
mkdir -pv $INSTALL_DIR/etc/systemd/system/getty@tty1.service.d
cat > $INSTALL_DIR/etc/systemd/system/getty@tty1.service.d/noclear.conf << EOF
[Service]
TTYVTDisallocate=no
EOF

# disable console errors in fsck
for f in $INSTALL_DIR/lib/systemd/system/systemd-fsck@.service \
  $INSTALL_DIR/lib/systemd/system/systemd-fsck-root.service
do
  sed -i '/^StandardOutput=/s/^.*$/StandardOutput=journal/' $f
done