From 49bb18e8d8728aa177095adade1a5ead690c9151 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 26 Nov 2019 15:10:29 +0100 Subject: [*] cd <...> || perror --> cde <...> --- core/modules/beamergui/module.build | 2 +- core/modules/busybox/module.build | 6 ++---- core/modules/cron/module.build | 2 +- core/modules/cups-sicgs/module.build | 2 +- core/modules/dmidecode/module.build | 2 +- core/modules/idleaction/module.build | 2 +- core/modules/kernel-vanilla/module.build | 12 ++++++------ core/modules/kernel/module.build | 6 +++--- core/modules/nvidia-common/module.build | 2 +- core/modules/printergui/module.build | 2 +- core/modules/pvs2/module.build | 2 +- core/modules/redsocks/module.build | 6 +++--- core/modules/slxbrowser/module.build | 2 +- core/modules/vmware12/module.build | 4 ++-- core/modules/vmware15/module.build | 6 +++--- core/modules/xorg/module.build | 4 ++-- 16 files changed, 30 insertions(+), 32 deletions(-) diff --git a/core/modules/beamergui/module.build b/core/modules/beamergui/module.build index 316b9757..c091171b 100644 --- a/core/modules/beamergui/module.build +++ b/core/modules/beamergui/module.build @@ -8,7 +8,7 @@ build() { local SRCDIR="${MODULE_WORK_DIR}/src/beamergui" mkdir -p "$MODULE_BUILD_DIR/opt/openslx/bin" - cd "${MODULE_BUILD_DIR}/opt/openslx/bin" || perror "Could not cd!" + cde "${MODULE_BUILD_DIR}/opt/openslx/bin" pinfo "Running cmake" cmake "$SRCDIR" || perror "'cmake $SRCDIR' failed." pinfo "Running make" diff --git a/core/modules/busybox/module.build b/core/modules/busybox/module.build index 9214a484..a6954efd 100644 --- a/core/modules/busybox/module.build +++ b/core/modules/busybox/module.build @@ -4,7 +4,7 @@ fetch_source() { if ! [ -d "src/.git" ]; then git clone --depth 1 "${REQUIRED_GIT}" --branch "$REQUIRED_BRANCH" src || perror "Could not clone busybox git" fi - cd src || perror "Could not cd to src" + cde src # Patch image centering and background filling if not patched yet if ! grep -q "bcenter_image" "miscutils/fbsplash.c"; then git apply "${MODULE_DIR}/fbsplash-center.patch" || perror "Could not apply busybox patch for fbsplash image centering" @@ -19,19 +19,17 @@ fetch_source() { if [ -n "$CC" ]; then sed -i -r 's/^CC\s*=\s*(\S)/CC ?= \1/' Makefile || perror "Could not patch Makefile" fi - cd .. || perror "cd .. failed" } build() { cp "${MODULE_DIR}/openslx-busybox-config" "src/.config" - cd src || perror "Could not cd to src" + cde src yes '' | make oldconfig pinfo "Running make (if this hangs, check for unset options, ie. when you increased the REQUIRED_BRANCH)" make || perror "failed." pinfo "Running make install" make CONFIG_PREFIX="$MODULE_BUILD_DIR" install || perror "failed" rm -f "$MODULE_BUILD_DIR/bin/mount" "$MODULE_BUILD_DIR/bin/umount" "$MODULE_BUILD_DIR/bin/bash" - cd - &> /dev/null } post_copy() { diff --git a/core/modules/cron/module.build b/core/modules/cron/module.build index 6a467d4e..d4ecce79 100644 --- a/core/modules/cron/module.build +++ b/core/modules/cron/module.build @@ -10,7 +10,7 @@ fetch_source() { build() { # compilation - cd "${MODULE_WORK_DIR}/src" || perror "Could not cd to '${MODULE_WORK_DIR}/src'. Did fetch_source work?" + cde "${MODULE_WORK_DIR}/src" ./autogen.sh || perror "Autogen failed" ./configure --disable-dependency-tracking --enable-syscrontab --prefix= --exec-prefix= --bindir=/opt/openslx/bin --sbindir=/opt/openslx/sbin || perror "configure failed" diff --git a/core/modules/cups-sicgs/module.build b/core/modules/cups-sicgs/module.build index 37c22798..874176c4 100644 --- a/core/modules/cups-sicgs/module.build +++ b/core/modules/cups-sicgs/module.build @@ -9,7 +9,7 @@ fetch_source() { } build() { - cd "${MODULE_WORK_DIR}/src/" || perror "Could not cd to '${MODULE_WORK_DIR}/src'. Did fetch_source work?" + cde "${MODULE_WORK_DIR}/src/" # Initial archive is zip unzip -j -o "${MODULE_WORK_DIR}/src/driver.zip" || perror "Could not extract initial driver.zip" # Then we have two tgz, 32bit and 64bit diff --git a/core/modules/dmidecode/module.build b/core/modules/dmidecode/module.build index 7e944bcd..6b891730 100644 --- a/core/modules/dmidecode/module.build +++ b/core/modules/dmidecode/module.build @@ -9,7 +9,7 @@ fetch_source() { build() { # compilation - cd "${MODULE_WORK_DIR}/src" || perror "Could not cd to '${MODULE_WORK_DIR}/src'. Did fetch_source work?" + cde "${MODULE_WORK_DIR}/src" make || perror "Could not compile dmidecode using 'make'." diff --git a/core/modules/idleaction/module.build b/core/modules/idleaction/module.build index 6aac9d93..41fe2445 100644 --- a/core/modules/idleaction/module.build +++ b/core/modules/idleaction/module.build @@ -15,7 +15,7 @@ build() { local SRCDIR="${MODULE_WORK_DIR}/src/idle-daemon" mkdir -p "$MODULE_BUILD_DIR/opt/openslx/sbin" - cd "${MODULE_BUILD_DIR}/opt/openslx/sbin" || perror "Could not cd!" + cde "${MODULE_BUILD_DIR}/opt/openslx/sbin" pinfo "Running cmake" cmake "$SRCDIR" || perror "'cmake $SRCDIR' failed." pinfo "Running make" diff --git a/core/modules/kernel-vanilla/module.build b/core/modules/kernel-vanilla/module.build index d6128172..26a58792 100644 --- a/core/modules/kernel-vanilla/module.build +++ b/core/modules/kernel-vanilla/module.build @@ -27,7 +27,7 @@ fetch_source() { pdebug "getting kernel sources via git ...." if grep -q -- "${REQUIRED_GIT}" "./ksrc/.git/config" && grep -q -- "v${REQUIRED_KERNEL}" "./ksrc/.git/config"; then pinfo "Trying to update existing clone" - cd ksrc || perror "Could not cd to ksrc" + cde ksrc git pull || perror "Could not pull already checked out repo" cd .. else @@ -44,7 +44,7 @@ fetch_source() { fi # Other patches local patch - cd "$MODULE_WORK_DIR/ksrc" || perror "Could not CD to kernel-source dir ksrc" + cde "$MODULE_WORK_DIR/ksrc" for patch in "${MODULE_DIR}/patches/"*; do [ -f "$patch" ] || continue grep -q -F "$patch" "patches-done" && continue @@ -71,7 +71,7 @@ build() { update_config cp "${TARGET_CONFIG_FILE}" "ksrc/.config" # make kernel with the new config - cd ksrc || perror "Could not cd to ksrc, was the kernel source fetched properly?" + cde ksrc pinfo "Preparing kernel for new config ('make oldconfig')." if [ "x$MLTK_QUIET" = "x1" ]; then make olddefconfig || perror "make oldconfig failed." @@ -159,7 +159,7 @@ patch_aufs() { git clone "git://github.com/sfjro/${AUFS}-standalone.git" || perror "Cloning ${AUFS} failed." fi # get the needed version - cd "${MODULE_WORK_DIR}/${AUFS}-standalone" || perror "Could not CD to ${AUFS}-standalone" + cde "${MODULE_WORK_DIR}/${AUFS}-standalone" local branches=( $( git branch -r | grep -oE 'aufs[0-9\.\+]+$' ) ) local major minor patch IFS=. read major minor patch _ <<<"$REQUIRED_KERNEL" @@ -186,7 +186,7 @@ patch_aufs() { [ -e "include/linux/aufs_type.h" ] && cp "include/linux/aufs_type.h" "$MODULE_WORK_DIR/ksrc/include/linux/" [ -e "include/uapi/linux/aufs_type.h" ] && cp "include/uapi/linux/aufs_type.h" "$MODULE_WORK_DIR/ksrc/include/uapi/linux/" - cd "$MODULE_WORK_DIR/ksrc" || perror "Could not CD to kernel-source dir ksrc" + cde "$MODULE_WORK_DIR/ksrc" local PATCH # Mandatory @@ -201,6 +201,6 @@ patch_aufs() { pinfo "Applied '$MODULE_WORK_DIR/${AUFS}-standalone/${PATCH}.patch'" done pinfo "Patched kernel source with ${NEEDED_BRANCH}" - cd "$MODULE_WORK_DIR" || perror "Where is WORK_DIR?" + cde "$MODULE_WORK_DIR" } diff --git a/core/modules/kernel/module.build b/core/modules/kernel/module.build index bb825fac..6df7464f 100644 --- a/core/modules/kernel/module.build +++ b/core/modules/kernel/module.build @@ -46,7 +46,7 @@ build() { update_config cp "${TARGET_CONFIG_FILE}" "ksrc/.config" # make kernel with the new config - cd ksrc || perror "Could not cd to ksrc, was the kernel source fetched properly?" + cde ksrc pinfo "Preparing kernel for new config ('make oldconfig')." if [ "x$MLTK_QUIET" = "x1" ]; then make olddefconfig || perror "make olddefconfig failed." @@ -123,7 +123,7 @@ patch_aufs() { [ ! -z ${SYSTEM_KERNEL_LONG} ] && local NEEDED_BRANCH=$(echo $SYSTEM_KERNEL_LONG | awk -F "." '{print $1"."$2}') \ || perror "SYSTEM_KERNEL_LONG not set, this should not happen!" pinfo "Getting branch origin/$NEEDED_BRANCH" - cd "$MODULE_WORK_DIR/aufs3-standalone" || perror "Could not CD to aufs3-standalone" + cde "$MODULE_WORK_DIR/aufs3-standalone" git checkout "origin/aufs$NEEDED_BRANCH" || perror "Could not checkout needed branch." pinfo "Starting to patch... $NEEDED_BRANCH" tarcopy "Documentation fs" "$MODULE_WORK_DIR/ksrc" @@ -132,7 +132,7 @@ patch_aufs() { [ -e "include/linux/aufs_type.h" ] && cp "include/linux/aufs_type.h" "$MODULE_WORK_DIR/ksrc/include/linux/" [ -e "include/uapi/linux/aufs_type.h" ] && cp "include/uapi/linux/aufs_type.h" "$MODULE_WORK_DIR/ksrc/include/uapi/linux/" - cd "$MODULE_WORK_DIR/ksrc" || perror "Could not CD to kernel-source dir ksrc" + cde "$MODULE_WORK_DIR/ksrc" patch -p1 < "$MODULE_WORK_DIR/aufs3-standalone/aufs3-kbuild.patch" || perror "aufs3-standalone/aufs3-kbuild.patch failed!" patch -p1 < "$MODULE_WORK_DIR/aufs3-standalone/aufs3-base.patch" || perror "aufs3-standalone/aufs3-base.patch failed!" diff --git a/core/modules/nvidia-common/module.build b/core/modules/nvidia-common/module.build index 619d1170..c402f5d2 100644 --- a/core/modules/nvidia-common/module.build +++ b/core/modules/nvidia-common/module.build @@ -2,7 +2,7 @@ fetch_source() { local version mkdir -p src - cd src || perror "Could not change into src directory." + cde src for version in $NVIDIA_VERSIONS; do download "${REQUIRED_URL//%VERSION%/$version}" "${version}.run" done diff --git a/core/modules/printergui/module.build b/core/modules/printergui/module.build index 0f335341..fcf55406 100644 --- a/core/modules/printergui/module.build +++ b/core/modules/printergui/module.build @@ -15,7 +15,7 @@ build() { activate_qt 4 mkdir -p "$DESTDIR" - cd "$DESTDIR" || perror "Could not cd to $DESTDIR!" + cde "$DESTDIR" pinfo "Running cmake" cmake "$SRCDIR/" || perror "'cmake' failed (e.g. not installed)." pinfo "Running make" diff --git a/core/modules/pvs2/module.build b/core/modules/pvs2/module.build index a1039e7d..3be43b87 100644 --- a/core/modules/pvs2/module.build +++ b/core/modules/pvs2/module.build @@ -11,7 +11,7 @@ build() { mkdir -p "${DESTDIR}" || perror "Could not mkdir ${DESTDIR}!" mkdir -p "${BUILDDIR}" || perror "Could not mkdir ${BUILDDIR}!" - cd "${BUILDDIR}" || perror "Could not cd to ${BUILDDIR}!" + cde "${BUILDDIR}" pinfo "Running cmake" cmake .. || perror "'cmake ..' failed." diff --git a/core/modules/redsocks/module.build b/core/modules/redsocks/module.build index 4903cdbd..9dacd88b 100644 --- a/core/modules/redsocks/module.build +++ b/core/modules/redsocks/module.build @@ -4,16 +4,16 @@ fetch_source () { mkdir -p src - cd src || perror "Could not cd to src" + cde src if [ ! -d "redsocks" ]; then git clone "$REQUIRED_GIT" "redsocks" || perror "Could not clone redoscks from github" fi - cd redsocks || perror "Could not cd to src/redsocks" + cde redsocks git checkout "$REQUIRED_REVISION" || perror "Could not checkout revision $REQUIRED_REVISION" } build () { - cd "$MODULE_WORK_DIR/src/redsocks" || perror "src/redsocks not found" + cde "$MODULE_WORK_DIR/src/redsocks" make || perror "make failed." mkdir -p "$MODULE_BUILD_DIR/sbin" cp "redsocks" "$MODULE_BUILD_DIR/sbin/" || perror "Could not copy redsocks binary to build dir" diff --git a/core/modules/slxbrowser/module.build b/core/modules/slxbrowser/module.build index 89a56b6d..d8b66125 100644 --- a/core/modules/slxbrowser/module.build +++ b/core/modules/slxbrowser/module.build @@ -8,7 +8,7 @@ build() { local SRCDIR="${MODULE_WORK_DIR}/src/" mkdir -p "${MODULE_BUILD_DIR}/${REQUIRED_PREFIX}" - cd "${MODULE_BUILD_DIR}/${REQUIRED_PREFIX}" || perror "No dir" + cde "${MODULE_BUILD_DIR}/${REQUIRED_PREFIX}" pinfo "Running cmake" diff --git a/core/modules/vmware12/module.build b/core/modules/vmware12/module.build index 5f05596b..0df2f17e 100644 --- a/core/modules/vmware12/module.build +++ b/core/modules/vmware12/module.build @@ -3,7 +3,7 @@ fetch_source() { [ -d "${MODULE_WORK_DIR}/src" ] && \ { rm -r "${MODULE_WORK_DIR}/src" || perror "Could not delete old src dir."; } mkdir -p "${MODULE_WORK_DIR}/src" || perror "Could not mkdir src" - cd "${MODULE_WORK_DIR}/src" || perror "cd to '${MODULE_WORK_DIR}/src' failed." + cde "${MODULE_WORK_DIR}/src" local BASE_URL LIST_URL BUILD_NO #BASE_URL="http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.5.2/4638234/linux/core/" @@ -140,7 +140,7 @@ build() { [ -s "\$KMOD" ] || perror "Kmod \$KMOD does not exist" [ ! -d "\${SHORT}-only" ] && tar xf "\$KMOD" [ ! -d "\${SHORT}-only" ] && perror "untar of \$KMOD failed." - cd "\${SHORT}-only" || perror "Where is \${SHORT}-only?" + cde "\${SHORT}-only" if ! patch -p1 < "\$file"; then cd .. rm -rf -- "\${SHORT}-only" diff --git a/core/modules/vmware15/module.build b/core/modules/vmware15/module.build index ef76fc6f..5c5de701 100644 --- a/core/modules/vmware15/module.build +++ b/core/modules/vmware15/module.build @@ -3,7 +3,7 @@ fetch_source() { [ -d "${MODULE_WORK_DIR}/src" ] && \ { rm -r "${MODULE_WORK_DIR}/src" || perror "Could not delete old src dir."; } mkdir -p "${MODULE_WORK_DIR}/src" || perror "Could not mkdir src" - cd "${MODULE_WORK_DIR}/src" || perror "cd to '${MODULE_WORK_DIR}/src' failed." + cde "${MODULE_WORK_DIR}/src" local BASE_URL LIST_URL BUILD_NO #BASE_URL="http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.5.2/4638234/linux/core/" @@ -95,7 +95,7 @@ build() { [ -s "\$KMOD" ] || perror "Kmod \$KMOD does not exist" [ ! -d "\${SHORT}-only" ] && tar xf "\$KMOD" [ ! -d "\${SHORT}-only" ] && perror "untar of \$KMOD failed." - cd "\${SHORT}-only" || perror "Where is \${SHORT}-only?" + cde "\${SHORT}-only" if ! patch -p1 < "\$file"; then cd .. rm -rf -- "\${SHORT}-only" @@ -111,7 +111,7 @@ build() { vmware-modconfig --console --build-mod -k "${TARGET_KERNEL_LONG}" vmmon $(which gcc) "${KERNEL_HEADERS_DIR}/include" vmplayer vmmon || perror "vmmon build failed" EOF - cd "${MODULE_WORK_DIR}" || perror "Could not cd to '${MODULE_WORK_DIR}'" + cde "${MODULE_WORK_DIR}" # cleanup unneeded files rm -rf -- "${MODULE_BUILD_DIR}/etc/vmware-installer" diff --git a/core/modules/xorg/module.build b/core/modules/xorg/module.build index 390b5922..8e165f08 100644 --- a/core/modules/xorg/module.build +++ b/core/modules/xorg/module.build @@ -4,7 +4,7 @@ fetch_source() { if [ -n "$REQUIRED_XORG_DRIVERS" ]; then local drv mkdir -p src - cd src || perror "No cd to xorg src dir" + cde src for drv in $REQUIRED_XORG_DRIVERS; do drv=${drv%//*} [ -d "${drv}/.git" ] && continue @@ -43,7 +43,7 @@ build() { repo=${drv%//*} vers=${drv#*//} pinfo "Compiling $drv" - cd "${MODULE_WORK_DIR}/src/${repo}" || perror "No src dir for xorg driver $repo" + cde "${MODULE_WORK_DIR}/src/${repo}" if [ "$drv" != "$vers" ]; then git checkout "$vers" || pwarn "Could not checkout $vers for $repo" fi -- cgit v1.2.3-55-g7522