Remove some troublesome trailing slashes from paths
[catalyst.git] / targets / support / functions.sh
old mode 100644 (file)
new mode 100755 (executable)
index 4018716..c8757d4
@@ -20,13 +20,20 @@ exec_in_chroot(){
 # and executes it.
        local file_name=$(basename ${1})
        local subdir=${2}
-       local destdir=".${subdir}/tmp"
+       local destdir="${subdir}/tmp"
 
+       echo "Copying ${file_name} to ${destdir}"
        copy_to_chroot ${1} ${destdir}
-       chroot_path=${clst_chroot_path}${subdir}
        copy_to_chroot ${clst_sharedir}/targets/support/chroot-functions.sh \
                ${destdir}
-       echo "Running ${file_name} in chroot ${chroot_path}"
+
+       chroot_path=${clst_chroot_path}${subdir}
+
+       echo "Ensure the file has the executable bit set"
+       chmod +x ${chroot_path}/${destdir}/${file_name}
+
+       echo "Running ${file_name} in chroot:"
+       echo "    ${clst_CHROOT} ${chroot_path} ${destdir}/${file_name}"
        ${clst_CHROOT} ${chroot_path} ${destdir}/${file_name} || exit 1
 
        delete_from_chroot ${destdir}/${file_name}
@@ -46,7 +53,7 @@ extract_cdtar() {
        # boot-loader/filesystem skeleton for the ISO.
        cdtar=${clst_cdtar}
        [ -z "${cdtar}" ] && die "Required key cdtar not defined, exiting"
-       tar xjpf ${cdtar} -C $1 || die "Couldn't extract cdtar ${cdtar}"
+       tar -I lbzip2 -xpf ${cdtar} -C $1 || die "Couldn't extract cdtar ${cdtar}"
 }
 
 extract_kernels() {
@@ -71,7 +78,7 @@ extract_kernels() {
 
                [ ! -e "${kbinary}" ] && die "Can't find kernel tarball at ${kbinary}"
                mkdir -p ${1}/
-               tar xjf ${kbinary} -C ${1}/
+               tar -I lbzip2 -xf ${kbinary} -C ${1}/
 
                # change config name from "config-*" to "gentoo", for example
                #mv ${1}/config-* ${1}/${x}-config
@@ -115,7 +122,7 @@ extract_modules() {
        if [ -f "${kmodules}" ]
        then
                mkdir -p ${1}/
-               tar xjf ${kmodules} -C ${1} lib
+               tar -I lbzip2 -xf ${kmodules} --strip-components 1 -C ${1}/lib lib
        else
                echo "Can't find kernel modules tarball at ${kmodules}.  Skipping...."
        fi
@@ -127,7 +134,7 @@ extract_kernel() {
        kbinary="${clst_chroot_path}/tmp/kerncache/${2}-kernel-initrd-${clst_version_stamp}.tar.bz2"
        [ ! -e "${kbinary}" ] && die "Can't find kernel tarball at ${kbinary}"
        mkdir -p ${1}/
-       tar xjf ${kbinary} -C ${1}/
+       tar -I lbzip2 -xf ${kbinary} -C ${1}/
        # change config name from "config-*" to "gentoo", for example
        #mv ${1}/config-* ${1}/${2}-config
        rm ${1}/config-*