diff options
| -rw-r--r-- | helper/fileutil.inc | 46 | ||||
| -rwxr-xr-x | mltk | 2 | ||||
| -rwxr-xr-x | remote/setup_tools | 13 | ||||
| -rw-r--r-- | remote/tools/base/base.build | 4 | ||||
| -rw-r--r-- | remote/tools/base/base.conf | 3 | ||||
| -rw-r--r-- | remote/tools/base/base.conf.zypper | 56 | ||||
| -rw-r--r-- | remote/tools/busybox/busybox.build | 5 | ||||
| -rw-r--r-- | remote/tools/busybox/busybox.conf | 1 | ||||
| -rw-r--r-- | remote/tools/dbus/dbus.build | 9 | ||||
| -rw-r--r-- | remote/tools/dbus/dbus.conf | 4 | ||||
| -rw-r--r-- | remote/tools/dbus/dbus.conf.zypper | 9 | ||||
| -rw-r--r-- | remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build | 4 | ||||
| -rw-r--r-- | remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.conf | 2 | ||||
| -rw-r--r-- | remote/tools/ldm/ldm.build | 4 | ||||
| -rw-r--r-- | remote/tools/ldm/ldm.conf | 2 | ||||
| -rw-r--r-- | remote/tools/plymouth/plymouth.build | 6 | ||||
| -rw-r--r-- | remote/tools/plymouth/plymouth.conf | 2 | ||||
| -rw-r--r-- | remote/tools/policykit/policykit.build | 4 | ||||
| -rw-r--r-- | remote/tools/policykit/policykit.conf | 2 | ||||
| -rw-r--r-- | remote/tools/sshd/sshd.build | 4 | ||||
| -rw-r--r-- | remote/tools/systemd/systemd.build | 37 | ||||
| -rw-r--r-- | remote/tools/systemd/systemd.conf | 2 | ||||
| -rw-r--r-- | remote/tools/xorg/xorg.build | 4 |
23 files changed, 143 insertions, 82 deletions
diff --git a/helper/fileutil.inc b/helper/fileutil.inc index 3e1ea56a..e3a79b4a 100644 --- a/helper/fileutil.inc +++ b/helper/fileutil.inc @@ -1,3 +1,16 @@ +# one time jobs + +# determine packet manager: +if [ ! -z "$(which apt-get)" ]; then + PACKET_MANAGER="apt" +elif [ ! -z "$(which zypper)" ]; then + PACKET_MANAGER="zypper" +else + perror "Could not determine this platform's packet manager" +fi + +# + # copy list of files using tar tarcopy () { [ $# -ne 2 ] && perror "Sanity check failed: tarcopy needs exactly two params, but $# were given." @@ -16,3 +29,36 @@ tarcopy () { [ "x${PS[1]}" != "x0" ] && perror "unpacking-part of tar-copy from '$SHORT' to '$TO' failed. (${PS[1]})" } +# get all files of required packages by a module +list_packet_files() { + [ -z "$REQUIRED_PACKAGES" ] && return + for PACKAGE in $REQUIRED_PACKAGES; do + local FILES="" + if [ "$PACKET_MANAGER" = "apt" ]; then + FILES="$(dpkg -L "$PACKAGE" | grep -v share/doc | grep -v share/man; echo ":###:${PIPESTATUS[0]}")" + elif [ "$PACKET_MANAGER" = "zypper" ]; then + FILES="$(rpm -ql "$PACKAGE" | grep -v share/doc | grep -v share/man; echo ":###:${PIPESTATUS[0]}")" + fi + # ugly hack to get our return value + #local LPRET=$(echo "$FILES" | tail -1 | sed 's/^.*:###:\([0-9]*\)$/\1/g') + #FILES=$(echo "$FILES" | sed 's/^\(.*\):###:[0-9]*$/\1/g') + local LPRET=$(echo "$FILES" | awk -F ':###:' '{printf $2}') + FILES=$(echo "$FILES" | awk -F ':###:' '{print $1}') + [ "x$LPRET" != "x0" ] && perror "list_packet_files exited with code '$LPRET' for packet ${PACKAGE}." + [ -z "$FILES" ] && perror "list_packet_files empty for packet ${PACKAGE}." + for FILE in $FILES; do + [ ! -d "$FILE" ] && echo "$FILE" + done + done +} + +# install all dependencies of a module +install_dependencies() { + [ -z "$REQUIRED_DEPENDENCIES" ] && return + if [ "$PACKET_MANAGER" = "apt" ]; then + apt-get install -y $REQUIRED_DEPENDENCIES || perror "Could not apt-get install $REQUIRED_DEPENDENCIES" + elif [ "$PACKET_MANAGER" = "zypper" ]; then + zypper install -y $REQUIRED_DEPENDENCIES || perror "Could not zypper install $REQUIRED_DEPENDENCIES" + fi +} + @@ -32,6 +32,8 @@ qnd_exit() { . "${ROOT_DIR}/helper/fileutil.inc" . "${ROOT_DIR}/helper/binutil.inc" +pinfo "System's packet manager is $PACKET_MANAGER" + banner () { echo -e "\033[38;5;202m\t __ __ __ " echo -e "\033[38;5;202m\t.--------.| | | |_| |--." diff --git a/remote/setup_tools b/remote/setup_tools index e96d8e2c..2af8abe5 100755 --- a/remote/setup_tools +++ b/remote/setup_tools @@ -27,12 +27,19 @@ read_config () unset REQUIRED_FILES unset REQUIRED_MODULES unset REQUIRED_PACKAGES + unset REQUIRED_DEPENDENCIES local TOOL_CONFIG="${TOOL_DIR}/${TOOL}/${TOOL}.conf" - [ ! -e "${TOOL_CONFIG}" ] && perror "Config for '$TOOL' not found." - - . "${TOOL_CONFIG}" || perror "Sourcing '${TOOL_CONFIG}' failed." + if [ -e "${TOOL_CONFIG}.${PACKET_MANAGER}" ]; then + # a specific tool.conf seems to exist, try to use that one + # TODO: Maybe move this down right after loading the generic one, to allow "overloading".... but might be a bit confusing + . "${TOOL_CONFIG}.${PACKET_MANAGER}" || perror "Sourcing '${TOOL_CONFIG}.${PACKET_MANAGER}' failed." + else + # otherwise, use the generic one + [ ! -e "${TOOL_CONFIG}" ] && perror "Config for '$TOOL' not found." + . "${TOOL_CONFIG}" || perror "Sourcing '${TOOL_CONFIG}' failed." + fi } read_build () diff --git a/remote/tools/base/base.build b/remote/tools/base/base.build index efabaedd..71886d8a 100644 --- a/remote/tools/base/base.build +++ b/remote/tools/base/base.build @@ -1,7 +1,3 @@ -install_dependencies() { - apt-get install -y $DEPS -} - fetch_source() { : } diff --git a/remote/tools/base/base.conf b/remote/tools/base/base.conf index 6a95ab2c..22e91214 100644 --- a/remote/tools/base/base.conf +++ b/remote/tools/base/base.conf @@ -1,4 +1,4 @@ -DEPS="nfs-common aufs-tools squashfs-tools" +REQUIRED_DEPENDENCIES="nfs-common aufs-tools squashfs-tools" REQUIRED_BINARIES=" bash agetty cat @@ -12,7 +12,6 @@ REQUIRED_BINARIES=" bash mount.nfs4 umount.nfs4 mount.aufs - umount.aufs rm ldd strace diff --git a/remote/tools/base/base.conf.zypper b/remote/tools/base/base.conf.zypper new file mode 100644 index 00000000..084bff5c --- /dev/null +++ b/remote/tools/base/base.conf.zypper @@ -0,0 +1,56 @@ +REQUIRED_DEPENDENCIES="nfs-client aufs squashfs" +REQUIRED_BINARIES=" bash + agetty + cat + false + loadkeys + setfont + login + sulogin + mount + umount + mount.nfs4 + umount.nfs4 + mount.aufs + rm + ldd + strace + blkid + modprobe + rsyslogd + ps + scp + ssh" +REQUIRED_LIBRARIES=" libcap + libcidn + libcom_err + libcrypt + libcrypto + libnsl + libnss_compat + libnss_dns + libnss_files + libnss_hesiod + libnss_nis + libnss_nisplus + libpam + libutil + libtinfo + libresolv + libau" +REQUIRED_DIRECTORIES=" /etc/pam.d + /etc/security" +REQUIRED_FILES=" /etc/environment + /etc/pam.conf + /etc/issue + /etc/inputrc + /etc/localtime + /etc/login.defs + /etc/nsswitch.conf + /etc/securetty + /etc/default/locale + /etc/default/aufs + /etc/protocols + /etc/services + /etc/networks + /etc/netconfig" diff --git a/remote/tools/busybox/busybox.build b/remote/tools/busybox/busybox.build index 050da667..936f0730 100644 --- a/remote/tools/busybox/busybox.build +++ b/remote/tools/busybox/busybox.build @@ -1,10 +1,5 @@ #!/bin/bash -install_dependencies() -{ - : -} - fetch_source() { [ ! -d src ] && mkdir src diff --git a/remote/tools/busybox/busybox.conf b/remote/tools/busybox/busybox.conf index bcfc4bf5..b0c1f886 100644 --- a/remote/tools/busybox/busybox.conf +++ b/remote/tools/busybox/busybox.conf @@ -1,5 +1,4 @@ GIT=git://git.openslx.org/openslx/tools/busybox -DEPS="" TARGET_DIR="openslx" REQUIRED_BINARIES=" busybox" REQUIRED_DIRECTORIES=" /$TARGET_DIR/bin diff --git a/remote/tools/dbus/dbus.build b/remote/tools/dbus/dbus.build index 83cc8efa..e0e03943 100644 --- a/remote/tools/dbus/dbus.build +++ b/remote/tools/dbus/dbus.build @@ -1,9 +1,5 @@ #!/bin/bash -install_dependencies() { - echo "No dependencies." -} - fetch_source() { echo "Extracting from running system..." } @@ -14,10 +10,7 @@ build() { COPYLIST="list_dpkg_output" [ -e "${COPYLIST}" ] && rm "${COPYLIST}" - for FILE in $(dpkg -L dbus | grep -v share/doc | grep -v share/man) - do - [ ! -d "${FILE}" ] && echo ${FILE} >> "${COPYLIST}" - done + list_packet_files >> "${COPYLIST}" # prepare target dir & copy there [ ! -d ${BUILDDIR} ] && mkdir -p ${BUILDDIR} diff --git a/remote/tools/dbus/dbus.conf b/remote/tools/dbus/dbus.conf index 9847862f..a8c97d9c 100644 --- a/remote/tools/dbus/dbus.conf +++ b/remote/tools/dbus/dbus.conf @@ -1,3 +1,4 @@ +REQUIRED_PACKAGES="dbus" REQUIRED_BINARIES=" dbus-cleanup-sockets dbus-daemon dbus-uuidgen @@ -5,5 +6,4 @@ REQUIRED_BINARIES=" dbus-cleanup-sockets dbus-send dbus-daemon-launch-helper" REQUIRED_DIRECTORIES=" /etc/dbus-1" -REQUIRED_FILES=" /etc/default/dbus - /etc/init/dbus.conf" +REQUIRED_FILES=" /etc/default/dbus" diff --git a/remote/tools/dbus/dbus.conf.zypper b/remote/tools/dbus/dbus.conf.zypper new file mode 100644 index 00000000..db7183c5 --- /dev/null +++ b/remote/tools/dbus/dbus.conf.zypper @@ -0,0 +1,9 @@ +REQUIRED_PACKAGES="dbus-1" +REQUIRED_BINARIES=" dbus-cleanup-sockets + dbus-daemon + dbus-uuidgen + dbus-monitor + dbus-send + dbus-daemon-launch-helper" +REQUIRED_DIRECTORIES=" /etc/dbus-1" +REQUIRED_FILES="" diff --git a/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build b/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build index edd3427a..23895580 100644 --- a/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build +++ b/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build @@ -5,10 +5,6 @@ fetch_source () { touch .fetched_source } -install_dependencies() { - apt-get install -y $DEPS -} - build () { BUILDDIR="$TOOL_DIR/$TOOL/build" diff --git a/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.conf b/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.conf index f243fc20..800e5f79 100644 --- a/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.conf +++ b/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.conf @@ -1,6 +1,6 @@ VERSION=lightdm-gtk-greeter-1.3.1 URL=https://launchpad.net/lightdm-gtk-greeter/1.4/1.3.1/+download/lightdm-gtk-greeter-1.3.1.tar.gz -DEPS="gtk+-3.0 liblightdm-gobject-1-dev libgdk-pixbuf2.0-0 libpango1.0-0 librsvg2-common shared-mime-info gnome-themes-standard" +REQUIRED_DEPENDENCIES="gtk+-3.0 liblightdm-gobject-1-dev libgdk-pixbuf2.0-0 libpango1.0-0 librsvg2-common shared-mime-info gnome-themes-standard" REQUIRED_PACKAGES="libgdk-pixbuf2.0-0 libpango1.0-0 librsvg2-common shared-mime-info gnome-themes-standard policykit-1" REQUIRED_BINARIES="lightdm-gtk-greeter" REQUIRED_DIRECTORIES="/usr/lib /usr/share/lightdm-gtk-greeter /usr/share/mime /usr/share/xgreeters /usr/share/icons /usr/share/themes /etc /usr/bin /usr/share/polkit-1 /usr/share/dbus-1" diff --git a/remote/tools/ldm/ldm.build b/remote/tools/ldm/ldm.build index 9f45e058..c1bc08e8 100644 --- a/remote/tools/ldm/ldm.build +++ b/remote/tools/ldm/ldm.build @@ -5,10 +5,6 @@ fetch_source () { touch .fetched_source } -install_dependencies() { - apt-get install -y $DEPS -} - build () { BUILDDIR="$TOOL_DIR/$TOOL/build" if [ ! -e .built ]; then diff --git a/remote/tools/ldm/ldm.conf b/remote/tools/ldm/ldm.conf index 7e133e54..d40aab7f 100644 --- a/remote/tools/ldm/ldm.conf +++ b/remote/tools/ldm/ldm.conf @@ -1,6 +1,6 @@ VERSION=lightdm-1.4.0 URL=https://launchpad.net/lightdm/1.4/1.4.0/+download/lightdm-1.4.0.tar.gz -DEPS="libpam-dev itstool liblightdm-gobject-1-dev" +REQUIRED_DEPENDENCIES="libpam-dev itstool liblightdm-gobject-1-dev" REQUIRED_PACKAGES="" REQUIRED_BINARIES="dm-tool lightdm lightdm-set-defaults gdmflexiserver lightdm-guest-session-wrapper lightdm-set-defaults" REQUIRED_DIRECTORIES="/etc /lib" diff --git a/remote/tools/plymouth/plymouth.build b/remote/tools/plymouth/plymouth.build index fd54d876..b7302971 100644 --- a/remote/tools/plymouth/plymouth.build +++ b/remote/tools/plymouth/plymouth.build @@ -1,11 +1,5 @@ #!/bin/bash -install_dependencies() { - - # TODO dev libs check (no gtk) - apt-get install --yes $DEPS -} - fetch_source() { if [ ! -e .fetched_source ]; then # download and extract tarball diff --git a/remote/tools/plymouth/plymouth.conf b/remote/tools/plymouth/plymouth.conf index 3b4126ef..04144a0f 100644 --- a/remote/tools/plymouth/plymouth.conf +++ b/remote/tools/plymouth/plymouth.conf @@ -1,6 +1,6 @@ VERSION=plymouth-0.8.6.1 URL=http://www.freedesktop.org/software/plymouth/releases/${VERSION}.tar.bz2 -DEPS=" libpng-dev +REQUIRED_DEPENDENCIES=" libpng-dev libpango1.0-dev libcairo-dev libgtk2.0-dev diff --git a/remote/tools/policykit/policykit.build b/remote/tools/policykit/policykit.build index a42f48b7..079985ac 100644 --- a/remote/tools/policykit/policykit.build +++ b/remote/tools/policykit/policykit.build @@ -6,10 +6,6 @@ fetch_source () { touch .fetched_source } -install_dependencies() { - apt-get install -y $DEPS -} - build () { BUILDDIR=$TOOL_DIR/$TOOL/build diff --git a/remote/tools/policykit/policykit.conf b/remote/tools/policykit/policykit.conf index c8c27cf3..fbf997f6 100644 --- a/remote/tools/policykit/policykit.conf +++ b/remote/tools/policykit/policykit.conf @@ -1,6 +1,6 @@ VERSION=polkit-0.110 URL=http://www.freedesktop.org/software/polkit/releases/polkit-0.110.tar.gz -DEPS="libmozjs185-dev" +REQUIRED_DEPENDENCIES="libmozjs185-dev" REQUIRED_PACKAGES="" REQUIRED_BINARIES="" REQUIRED_DIRECTORIES="/bin /etc /lib /usr/share/dbus-1 /usr/share/polkit-1" diff --git a/remote/tools/sshd/sshd.build b/remote/tools/sshd/sshd.build index 82dc8a54..efd4f728 100644 --- a/remote/tools/sshd/sshd.build +++ b/remote/tools/sshd/sshd.build @@ -1,7 +1,3 @@ -install_dependencies() { - : -} - fetch_source() { : } diff --git a/remote/tools/systemd/systemd.build b/remote/tools/systemd/systemd.build index 7d9588c0..1d5a9a87 100644 --- a/remote/tools/systemd/systemd.build +++ b/remote/tools/systemd/systemd.build @@ -5,34 +5,19 @@ fetch_source () { touch .fetched_source } -install_dependencies() { - # quick fix for missing libkmod repo... - #libkmod=$(apt-cache search libkmod-dev) - #if [[ -z $libkmod ]]; - #then - # echo "libkmod cannot be found. Adding ppa:pitti/systemd" - # add-apt-repository --yes ppa:pitti/systemd - # apt-get update --force-yes - #fi - # install libkmod from source - # TODO: Use download_untar - local libkmodversion=kmod-12 - if [ ! -d $libkmodversion ]; then - wget http://www.kernel.org/pub/linux/utils/kernel/kmod/${libkmodversion}.tar.gz - tar xf $libkmodversion.tar.gz - rm ${libkmodversion}.tar.gz - cd $libkmodversion - ./configure - make -j5 - make install - cd - - fi - - apt-get install -y $DEPS -} - build () { if [ ! -e .built ]; then + local libkmodversion=kmod-12 + if [ ! -d $libkmodversion ]; then + wget http://www.kernel.org/pub/linux/utils/kernel/kmod/${libkmodversion}.tar.gz + tar xf $libkmodversion.tar.gz + rm ${libkmodversion}.tar.gz + cd $libkmodversion + ./configure + make -j5 + make install + cd - + fi cd "src/$VERSION/" pinfo "calling configure" ./configure --disable-manpages --enable-split-usr --sysconfdir="/etc" --enable-gtk-doc-html=no || perror "configure failed." diff --git a/remote/tools/systemd/systemd.conf b/remote/tools/systemd/systemd.conf index 98cd8ba9..c5e72aeb 100644 --- a/remote/tools/systemd/systemd.conf +++ b/remote/tools/systemd/systemd.conf @@ -1,6 +1,6 @@ VERSION=systemd-197 URL=http://www.freedesktop.org/software/systemd/${VERSION}.tar.xz -DEPS=" intltool +REQUIRED_DEPENDENCIES=" intltool gperf dbus pkg-config diff --git a/remote/tools/xorg/xorg.build b/remote/tools/xorg/xorg.build index 6ce5747c..9cd90db9 100644 --- a/remote/tools/xorg/xorg.build +++ b/remote/tools/xorg/xorg.build @@ -1,9 +1,5 @@ #!/bin/bash -install_dependencies() { - : -} - fetch_source() { : } |
