#tool/distro specific functions for fetching, building and installing dependencies fetch_source () { download_untar "$REQUIRED_URL" "src/" download_untar "$REQUIRED_LIBKMOD_URL" "src/" # Patch PATH environment sed -s -i -r 's#"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin(:/sbin:/bin)?"#& ":/opt/openslx/usr/sbin:/opt/openslx/usr/bin:/opt/openslx/sbin:/opt/openslx/bin"#g' src/systemd-*/src/core/main.c sed -s -i -r 's#"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"#& ":/opt/openslx/usr/sbin:/opt/openslx/usr/bin:/opt/openslx/sbin:/opt/openslx/bin"#g' src/systemd-*/src/nspawn/nspawn.c } build () { #build libkmod pinfo "Building libkmod" cd "${MODULE_DIR}/src/$REQUIRED_LIBKMOD_VERSION" ./configure || perror "./configure kmod failed." make || perror "kmod make failed." make install || perror "kmod make install failed." cd - &> /dev/null #build systemd pinfo "Building systemd" cd "${MODULE_DIR}/src/$REQUIRED_VERSION" pinfo "calling configure" ./configure --disable-manpages --enable-split-usr --sysconfdir="/etc" --enable-gtk-doc-html=no --disable-nls --disable-microhttpd --disable-bootchart --disable-quotacheck --disable-hostnamed --disable-timedated --disable-localed --disable-coredump --disable-keymap --without-python --enable-blkid --enable-acl --enable-pam|| perror "configure failed." pinfo "calling make" make || perror "make failed." pinfo "calling make install" DESTDIR="${MODULE_BUILD_DIR}" make install || perror "make install failed." cd - &> /dev/null # Delete unneeded services pinfo "Deleting unneeded services" local SERVICE= local OTHER= for SERVICE in $REQUIRED_DISABLED_SERVICES; do find "${MODULE_BUILD_DIR}" -name "$SERVICE" -exec rm -r {} \; for OTHER in $(grep -l -r "$SERVICE" "$MODULE_BUILD_DIR/usr/lib/systemd/system"); do sed -i -r "s#\s*$SERVICE\s*# #g" "$OTHER" done done } post_copy() { # dont clear systemd log at startup sed -i "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" # add pam_systemd.so to pam modules directory if [ -e "${MODULE_BUILD_DIR}/usr/lib/security/pam_systemd.so" ]; then cp "${MODULE_BUILD_DIR}/usr/lib/security/pam_systemd.so" "${TARGET_BUILD_DIR}/lib/security/" else pdebug "No such file: ${MODULE_BUILD_DIR}/usr/lib/security/pam_systemd.so" fi }