Added function(s) wrt_delete_existings_dirs. Requested by Gerald B
This commit is contained in:
parent
b9ec725079
commit
5842156609
2 changed files with 55 additions and 2 deletions
|
@ -141,7 +141,12 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
|
|||
*) FILE="$name-$vrs.tar.*" ;;
|
||||
esac
|
||||
# Insert instructions for unpacking the package and to set the PKGDIR variable.
|
||||
wrt_unpack "$FILE"
|
||||
case $this_script in
|
||||
*binutils* )
|
||||
wrt_unpack "$FILE" 1 ;; # Do not delete an existing package directories
|
||||
*)
|
||||
wrt_unpack "$FILE" ;;
|
||||
esac
|
||||
[[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
|
||||
fi
|
||||
|
||||
|
|
|
@ -208,10 +208,49 @@ EOF
|
|||
}
|
||||
|
||||
|
||||
#----------------------------------#
|
||||
wrt_remove_existing_dirs() { #
|
||||
#----------------------------------#
|
||||
local PKG_NAME=$1
|
||||
(
|
||||
cat << EOF
|
||||
@ROOT=\`tar -tf \$(MOUNT_PT)\$(SRC)/${PKG_NAME} | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\
|
||||
[[ -n \$\$ROOT ]] && \\
|
||||
rm -rf \$(MOUNT_PT)\$(SRC)/\$\$ROOT && \\
|
||||
if [ -e \$(MOUNT_PT)\$(SRC)/${PKG_NAME%%-*}-build ]; then \\
|
||||
rm -rf \$(MOUNT_PT)\$(SRC)/${PKG_NAME%%-*}-build; \\
|
||||
fi;
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
||||
#----------------------------------#
|
||||
wrt_remove_existing_dirs2() { #
|
||||
#----------------------------------#
|
||||
local PKG_NAME=$1
|
||||
(
|
||||
cat << EOF
|
||||
@ROOT=\`tar -tf \$(SRC)/${PKG_NAME} | head -n1 | sed -e 's@^./@@;s@/.*@@'\` && \\
|
||||
[[ -n \$\$ROOT ]] && \\
|
||||
rm -rf \$(SRC)/\$\$ROOT && \\
|
||||
if [ -e \$(SRC)/${PKG_NAME%%-*}-build ]; then \\
|
||||
rm -rf \$(SRC)/${PKG_NAME%%-*}-build; \\
|
||||
fi;
|
||||
EOF
|
||||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
||||
|
||||
|
||||
#----------------------------------#
|
||||
wrt_unpack() { # Unpack and set 'ROOT' var
|
||||
#----------------------------------#
|
||||
local FILE=$1
|
||||
local optSAVE_PREVIOUS=$2
|
||||
|
||||
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
||||
wrt_remove_existing_dirs "$FILE"
|
||||
fi
|
||||
(
|
||||
cat << EOF
|
||||
@\$(call unpack,$FILE)
|
||||
|
@ -227,6 +266,11 @@ EOF
|
|||
wrt_unpack2() { #
|
||||
#----------------------------------#
|
||||
local FILE=$1
|
||||
local optSAVE_PREVIOUS=$2
|
||||
|
||||
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
||||
wrt_remove_existing_dirs "$FILE"
|
||||
fi
|
||||
(
|
||||
cat << EOF
|
||||
@\$(call unpack2,$FILE)
|
||||
|
@ -241,6 +285,11 @@ EOF
|
|||
wrt_unpack3() { #
|
||||
#----------------------------------#
|
||||
local FILE=$1
|
||||
local optSAVE_PREVIOUS=$2
|
||||
|
||||
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
|
||||
wrt_remove_existing_dirs2 "$FILE"
|
||||
fi
|
||||
(
|
||||
cat << EOF
|
||||
@\$(call unpack3,$FILE)
|
||||
|
@ -250,7 +299,6 @@ EOF
|
|||
) >> $MKFILE.tmp
|
||||
}
|
||||
|
||||
|
||||
#----------------------------------#
|
||||
wrt_target_vars() { # Target vars for hlfs (cross-build method)
|
||||
#----------------------------------#
|
||||
|
|
Reference in a new issue