From 8d34cf49ad72e556b88033202f7dde130d80fa74 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 25 Feb 2013 20:13:48 +0100 Subject: Several fixes and improvements: - return uid and gid again for add_user and add_group - abort execution if sourcing the .build or .conf file of a module fails - make sure lightdm user and group exists when building the ldm module - use tarcopy in all modules if appropriate --- remote/setup_tools | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'remote/setup_tools') diff --git a/remote/setup_tools b/remote/setup_tools index bf3f5157..74cc1c78 100755 --- a/remote/setup_tools +++ b/remote/setup_tools @@ -18,20 +18,20 @@ initial_checks () read_config () { - local TOOL_CONFIG=${TOOL_DIR}/${TOOL}/${TOOL}.conf + local TOOL_CONFIG="${TOOL_DIR}/${TOOL}/${TOOL}.conf" - [ ! -e ${TOOL_CONFIG} ] && perror "Config for '$TOOL' not found." + [ ! -e "${TOOL_CONFIG}" ] && perror "Config for '$TOOL' not found." - . ${TOOL_CONFIG} + . "${TOOL_CONFIG}" || perror "Sourcing '${TOOL_CONFIG}' failed." } read_build () { - local BUILD_SCRIPT=${TOOL_DIR}/${TOOL}/${TOOL}.build + local BUILD_SCRIPT="${TOOL_DIR}/${TOOL}/${TOOL}.build" - [ ! -e ${BUILD_SCRIPT} ] && perror "Build script for specified tool not found." + [ ! -e "${BUILD_SCRIPT}" ] && perror "Build script for specified tool not found." - . ${BUILD_SCRIPT} + . "${BUILD_SCRIPT}" || perror "Sourcing '${BUILD_SCRIPT}' failed." } copyfileswithdependencies () @@ -190,13 +190,14 @@ generate_stage32 () { fi # now iterate over given tools and copy them - cd ${TOOL_DIR} + cd "${TOOL_DIR}" while (( "$#" )); do TOOL=$1 + TOOL_STR="" + pinfo ">>>>>>>>>>>>>>>>> Processing module [ $TOOL ]" + TOOL_STR="[${TOOL}]" if [ -d ${TOOL} ]; then - TOOL_STR="[${TOOL}]" - pinfo "## ## Processing module ## ##" #[ "x$DEBUG" != "x1" ] \ # && echo "Logging to ${TOOL_DIR}/${TOOL}/stage32.log" \ @@ -225,13 +226,13 @@ generate_stage32 () { #[ "x$DEBUG" != "x1" ] && exec 1>&6 6>&- # TODO pinfo "## ## Module completed ## ##" - TOOL_STR="" else perror "Tool directory for '$TOOL' not found." # maybe make this a warning instead of error? fi shift done + TOOL_STR="" } clean_tools() { -- cgit v1.2.3-55-g7522 From 6192918205e74ce1fde46817447ab6addd77df61 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 26 Feb 2013 15:50:50 +0100 Subject: Added dependency system for modules (REQUIRED_MODULES var in *.conf of module, for an example, see policykit.conf) --- remote/setup_tools | 116 ++++++++++++--------- remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build | 1 + remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.conf | 2 + remote/tools/policykit/policykit.conf | 2 + 4 files changed, 73 insertions(+), 48 deletions(-) (limited to 'remote/setup_tools') diff --git a/remote/setup_tools b/remote/setup_tools index 74cc1c78..4c7d65e2 100755 --- a/remote/setup_tools +++ b/remote/setup_tools @@ -1,10 +1,13 @@ #!/bin/bash -MODULE_DIR=${ROOT_DIR}/remote +MODULE_DIR="${ROOT_DIR}/remote" #Create tools directory if not exists -TOOL_DIR=${MODULE_DIR}/tools -INIT_DIR=${MODULE_DIR}/stage3.2 +TOOL_DIR="${MODULE_DIR}/tools" +INIT_DIR="${MODULE_DIR}/stage3.2" + +# Keep track of processed modules +PROCESSED_MODULES="" initial_checks () { @@ -18,6 +21,12 @@ initial_checks () read_config () { + unset REQUIRED_BINARIES + unset REQUIRED_LIBRARIES + unset REQUIRED_DIRECTORIES + unset REQUIRED_FILES + unset REQUIRED_MODULES + local TOOL_CONFIG="${TOOL_DIR}/${TOOL}/${TOOL}.conf" [ ! -e "${TOOL_CONFIG}" ] && perror "Config for '$TOOL' not found." @@ -153,10 +162,6 @@ copyfileswithdependencies () pinfo "Copying $CLISTCOUNT files to stage 3.2 target directory." tarcopy "$(cat ${COPYFILES_LIST}|sort -u)" "${INIT_DIR}" fi - unset REQUIRED_BINARIES - unset REQUIRED_LIBRARIES - unset REQUIRED_DIRECTORIES - unset REQUIRED_FILES } get_basic_libs () { @@ -190,58 +195,74 @@ generate_stage32 () { fi # now iterate over given tools and copy them - cd "${TOOL_DIR}" while (( "$#" )); do - TOOL=$1 - TOOL_STR="" - pinfo ">>>>>>>>>>>>>>>>> Processing module [ $TOOL ]" - TOOL_STR="[${TOOL}]" - if [ -d ${TOOL} ]; - then - - #[ "x$DEBUG" != "x1" ] \ - # && echo "Logging to ${TOOL_DIR}/${TOOL}/stage32.log" \ - # && exec 6>&1 > ${TOOL_DIR}/${TOOL}/stage32.log - # TODO: Make above work with the new logging system (add function to logging.inc to switch logfile) - cd "${TOOL}" - pinfo "## Reading config" - read_config - pinfo "## Reading build" - read_build - pinfo "## Installing dependencies" - install_dependencies - pinfo "## Fetching source" - fetch_source - pinfo "## Building" - build - # remove *.la files as they might confuse libtool/linker of other tool packages - find "${TOOL_DIR}/${TOOL}/build" -name '*.la' -exec rm -f {} \; - pinfo "## Copying files with dependencies" - copyfileswithdependencies - pinfo "## Post copy" - post_copy - cd ${TOOL_DIR} - - # reset pipes - #[ "x$DEBUG" != "x1" ] && exec 1>&6 6>&- - # TODO - pinfo "## ## Module completed ## ##" - else - perror "Tool directory for '$TOOL' not found." - # maybe make this a warning instead of error? - fi + process_module "$1" shift done TOOL_STR="" } +process_module() { + [ "$#" -ne "1" ] && perror "process_module: want 1 param." + local TOOL="$1" + [[ "$PROCESSED_MODULES" == *"!${TOOL}!"* ]] && return # Already processed this module + PROCESSED_MODULES="${PROCESSED_MODULES}!${TOOL}!" + local TOOL_STR="" + pinfo ">>>>>>>>>>>>>>>>> Processing module [ $TOOL ]" + TOOL_STR="[${TOOL}]" + if [ -d "${TOOL_DIR}/${TOOL}" ]; + then + + #[ "x$DEBUG" != "x1" ] \ + # && echo "Logging to ${TOOL_DIR}/${TOOL}/stage32.log" \ + # && exec 6>&1 > ${TOOL_DIR}/${TOOL}/stage32.log + # TODO: Make above work with the new logging system (add function to logging.inc to switch logfile) + cd "${TOOL_DIR}/${TOOL}" || perror "Tool dir '${TOOL_DIR}/${TOOL}' seems to exist, but cd to it failed." + pinfo "## Reading config" + read_config + # Check if this module has a dependency that wasn't built yet: + if [ ! -z "$REQUIRED_MODULES" ]; then + pinfo "$TOOL depends on ${REQUIRED_MODULES}...." + for DEP in $REQUIRED_MODULES; do + #[[ "$DESIRED_MODULES" != *"!${DEP}!"* ]] && perror "$TOOL has dependency $DEP, but $DEP is not in current profile." + process_module "$DEP" + done + # Read old config again, as it got overwritten by the deps + cd "${TOOL_DIR}/${TOOL}" || perror "Tool dir '${TOOL_DIR}/${TOOL}' seems to exist, but cd to it failed (after building deps)." + read_config + pinfo "<<<<<<<<<<<<<<<<< Dependency modules processed, back to module [ $TOOL ]" + fi + pinfo "## Reading build" + read_build + pinfo "## Installing dependencies" + install_dependencies + pinfo "## Fetching source" + fetch_source + pinfo "## Building" + build + # remove *.la files as they might confuse libtool/linker of other tool packages + find "${TOOL_DIR}/${TOOL}/build" -name '*.la' -exec rm -f {} \; + pinfo "## Copying files with dependencies" + copyfileswithdependencies + pinfo "## Post copy" + post_copy + + # reset pipes + #[ "x$DEBUG" != "x1" ] && exec 1>&6 6>&- + # TODO + pinfo "Module completed." + else + perror "Tool directory for '$TOOL' not found." + # maybe make this a warning instead of error? + fi +} + clean_tools() { if [ "x$1" = "x" -o "x$1" = "xall" ]; then #clean all if [ -d ${INIT_DIR} ]; then pinfo "Cleaning ${INIT_DIR}..." rm -rf "${INIT_DIR}" || perror "Error deleting $INIT_DIR" - pinfo "done." fi for TOOL in $(ls ${TOOL_DIR}); do clean_tool $TOOL @@ -276,7 +297,6 @@ clean_tool() { if [ -e ${TOOLDIR}/list_binaries_and_files ]; then rm "${TOOLDIR}/list_binaries_and_files" || perror "Could not delete list_binaries_and_files" fi - pinfo "done." } #generate_stage32 $@ diff --git a/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build b/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build index 31ad6181..edd3427a 100644 --- a/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build +++ b/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.build @@ -53,6 +53,7 @@ post_copy() { pango-querymodules > "${INIT_DIR}/etc/pango/pango.modules" || perror "pango-querymodules failed." gtk-update-icon-cache-3.0 "${INIT_DIR}/usr/share/icons/hicolor/" || perror "update-icon-cache-3.0 failed." update-mime-database "${INIT_DIR}/usr/share/mime" || perror "update-mime-database failed." + mkdir -p "${INIT_DIR}/var/lib" cp -r "/var/lib/polkit-1" "${INIT_DIR}/var/lib/" || perror "Copying -r /var/lib/polkit-1 to '${INIT_DIR}/var/lib/' failed." } diff --git a/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.conf b/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.conf index faf9f32c..f243fc20 100644 --- a/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.conf +++ b/remote/tools/ldm-gtk-greeter/ldm-gtk-greeter.conf @@ -5,3 +5,5 @@ REQUIRED_PACKAGES="libgdk-pixbuf2.0-0 libpango1.0-0 librsvg2-common shared-mime- 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" REQUIRED_FILES="/etc/lightdm/lightdm-gtk-greeter.conf" +REQUIRED_MODULES="ldm" + diff --git a/remote/tools/policykit/policykit.conf b/remote/tools/policykit/policykit.conf index 1ccef0e6..c8c27cf3 100644 --- a/remote/tools/policykit/policykit.conf +++ b/remote/tools/policykit/policykit.conf @@ -5,3 +5,5 @@ REQUIRED_PACKAGES="" REQUIRED_BINARIES="" REQUIRED_DIRECTORIES="/bin /etc /lib /usr/share/dbus-1 /usr/share/polkit-1" REQUIRED_FILES="" +REQUIRED_MODULES="systemd" + -- cgit v1.2.3-55-g7522