Added function(s) wrt_delete_existings_dirs. Requested by Gerald B

This commit is contained in:
George Boudreau 2006-06-01 02:34:38 +00:00
parent b9ec725079
commit 5842156609
2 changed files with 55 additions and 2 deletions

View file

@ -141,7 +141,12 @@ chapter5_Makefiles() { # Bootstrap or temptools phase
*) FILE="$name-$vrs.tar.*" ;; *) FILE="$name-$vrs.tar.*" ;;
esac esac
# Insert instructions for unpacking the package and to set the PKGDIR variable. # 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" [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name"
fi fi

View file

@ -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 wrt_unpack() { # Unpack and set 'ROOT' var
#----------------------------------# #----------------------------------#
local FILE=$1 local FILE=$1
local optSAVE_PREVIOUS=$2
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
wrt_remove_existing_dirs "$FILE"
fi
( (
cat << EOF cat << EOF
@\$(call unpack,$FILE) @\$(call unpack,$FILE)
@ -227,6 +266,11 @@ EOF
wrt_unpack2() { # wrt_unpack2() { #
#----------------------------------# #----------------------------------#
local FILE=$1 local FILE=$1
local optSAVE_PREVIOUS=$2
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
wrt_remove_existing_dirs "$FILE"
fi
( (
cat << EOF cat << EOF
@\$(call unpack2,$FILE) @\$(call unpack2,$FILE)
@ -241,6 +285,11 @@ EOF
wrt_unpack3() { # wrt_unpack3() { #
#----------------------------------# #----------------------------------#
local FILE=$1 local FILE=$1
local optSAVE_PREVIOUS=$2
if [ "${optSAVE_PREVIOUS}" != "1" ]; then
wrt_remove_existing_dirs2 "$FILE"
fi
( (
cat << EOF cat << EOF
@\$(call unpack3,$FILE) @\$(call unpack3,$FILE)
@ -250,7 +299,6 @@ EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
#----------------------------------# #----------------------------------#
wrt_target_vars() { # Target vars for hlfs (cross-build method) wrt_target_vars() { # Target vars for hlfs (cross-build method)
#----------------------------------# #----------------------------------#