summaryrefslogtreecommitdiffstats
path: root/remote/setup_target
diff options
context:
space:
mode:
authorroot2014-07-24 23:26:00 +0200
committerroot2014-07-24 23:26:00 +0200
commitec9fb42e19ed245baf9915f7da9209253ffbec98 (patch)
treeffb011af7e836669a6f98a5c11a0c06233901f3a /remote/setup_target
parent[kernel] Remove set -x call (diff)
downloadtm-scripts-ec9fb42e19ed245baf9915f7da9209253ffbec98.tar.gz
tm-scripts-ec9fb42e19ed245baf9915f7da9209253ffbec98.tar.xz
tm-scripts-ec9fb42e19ed245baf9915f7da9209253ffbec98.zip
Keep split usr if original system has it, add extra logic if no split usr
Diffstat (limited to 'remote/setup_target')
-rwxr-xr-xremote/setup_target37
1 files changed, 25 insertions, 12 deletions
diff --git a/remote/setup_target b/remote/setup_target
index 0d28db29..02400cd1 100755
--- a/remote/setup_target
+++ b/remote/setup_target
@@ -246,6 +246,28 @@ copy_files_with_deps () {
#
#
+# If the system has no usr split, recreate the structure in the given
+# directory, otherwise, do nothing
+#
+#
+prepare_usr_split () {
+ local DIR DEST
+ local BASE=$1
+ [ -z "$BASE" ] && perror "prepare_usr_split called with empty base dir"
+ if [ "$USR_SPLIT" == "no" ]; then # no usr split, /bin /lib etc are symlinks
+ for DIR in lib lib32 lib64 bin sbin; do
+ [ -L "/${DIR}" ] || continue
+ DEST=$(readlink "/${DIR}")
+ if [ ! -L "/${DEST}" ]; then
+ mkdir -p "${BASE}/${DEST}" || perror "Could not create '${BASE}/${DEST}'"
+ fi
+ [ -L "${BASE}/${DIR}" ] || ln -s "${DEST}" "${BASE}/${DIR}" || perror "Could not symlink '${BASE}/${DIR}' to '${DEST}'"
+ done
+ fi
+}
+
+#
+#
# main public function. Requires the TARGET to be given as argument.
# this will simply go over all the modules as found in the remote/target/<TARGET>
# and run following functions:
@@ -255,7 +277,6 @@ generate_target() {
initial_checks
- local DIR
TARGET=$1 && shift
TARGET_DIR="${MODE_DIR}/targets/${TARGET}"
TARGET_BUILD_DIR="${MODE_DIR}/builds/${TARGET}"
@@ -267,10 +288,8 @@ generate_target() {
perror "Target directory cannot be named 'builds' or 'modules'."
pdebug "Generating '$TARGET_BUILD_DIR' for '$TARGET'"
- for DIR in lib lib64 bin sbin; do
- mkdir -p "${TARGET_BUILD_DIR}/usr/${DIR}" || perror "Could not create '${TARGET_BUILD_DIR}/usr/${DIR}'"
- [ -L "${TARGET_BUILD_DIR}/${DIR}" ] || ln -s "usr/${DIR}" "${TARGET_BUILD_DIR}/${DIR}" || perror "Could not symlink '${TARGET_BUILD_DIR}/${DIR}' to 'usr/${DIR}"
- done
+ mkdir -p "$TARGET_BUILD_DIR" || perror "Failed to create $TARGET_BUILD_DIR"
+ prepare_usr_split "${TARGET_BUILD_DIR}"
# if no arguments assume all.
if [ "x$1" = "x" -o "x$1" = "xall" ]; then
@@ -373,13 +392,7 @@ process_module() {
read_config
# Prepare build directory
mkdir -p "${MODULE_BUILD_DIR}" || perror "Could not create build dir"
- if [ -z "${REQUIRED_ORIGINAL_USR_SPLIT}" -o "x${REQUIRED_ORIGINAL_USR_SPLIT}" = "xno" ]; then
- local DIR
- for DIR in lib lib64 bin sbin; do
- mkdir -p "${MODULE_BUILD_DIR}/usr/${DIR}" || perror "Could not create '${MODULE_BUILD_DIR}/usr/${DIR}'"
- [ -L "${MODULE_BUILD_DIR}/${DIR}" ] || ln -s "usr/${DIR}" "${MODULE_BUILD_DIR}/${DIR}" || perror "Could not symlink '${MODULE_BUILD_DIR}/${DIR}' to 'usr/${DIR}"
- done
- fi
+ prepare_usr_split "${MODULE_BUILD_DIR}"
# Check if this module has a dependency that wasn't built yet:
if [ ! -z "$REQUIRED_MODULES" ]; then
pdebug "$MODULE depends on ${REQUIRED_MODULES}...."