scripts/patch-renumber.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Thu Jun 11 21:47:19 2009 +0000 (2009-06-11)
branch1.4
changeset 1451 25d050084e98
parent 1175 417b32da90bf
child 1577 c774b2cc7863
permissions -rwxr-xr-x
populate: fix installing dynamic linker 'ld.so'

The dynamic linker, ld.so, needs the execute bit to be set.
Detect tht the library being installed is in fact ld.so and
install it with 0755 instead of 0644.

Fix detecting src == dst.

Use a simpler command to copy src -> dst.

Also change echo to printf, get rid of 'echo -n', which is
highly non-portable.


-------- diffstat follows --------
/trunk/scripts/populate.in | 76 43 33 0 +++++++++++++++++++++++++++++-----------------------
1 file changed, 43 insertions(+), 33 deletions(-)
(transplanted from d7ddcb75e0f703e2ba6d17169167356389224870)
yann@756
     1
#!/bin/sh
yann@756
     2
# Yes, this intends to be a true POSIX script file.
yann@1175
     3
set -e
yann@756
     4
yann@756
     5
myname="$0"
yann@756
     6
yann@1175
     7
# Parse the tools' paths configuration
yann@1175
     8
. "paths.mk"
yann@1175
     9
yann@756
    10
doUsage() {
yann@756
    11
  cat <<_EOF_
yann@756
    12
Usage: ${myname} <dir> <base> <inc>
yann@756
    13
    Will renumber all patches found in <dir>, starting at <base>, and with
yann@756
    14
    an increment of <inc>
yann@756
    15
    Eg.: patch-renumber patches/gcc/4.3.1 100 10
yann@756
    16
_EOF_
yann@756
    17
}
yann@756
    18
yann@756
    19
[ $# -eq 3 ] || { doUsage; exit 1; }
yann@756
    20
[ -d "${1}" ] || { doUsage; exit 1; }
yann@756
    21
yann@756
    22
dir="${1}"
yann@756
    23
cpt="${2}"
yann@756
    24
inc="${3}"
yann@756
    25
yann@1192
    26
case "$(LC_ALL=C svnversion "${dir}" 2>/dev/null)" in
yann@756
    27
    exported)   CMD="mv -v";;
yann@756
    28
    *)          CMD="svn mv";;
yann@756
    29
esac
yann@756
    30
yann@756
    31
for p in "${dir}"/*.patch; do
yann@756
    32
    [ -e "${p}" ] || { echo "No such file '${p}'"; exit 1; }
yann@1192
    33
    newname="$(printf "%03d-%s"                                 \
yann@1192
    34
                      "${cpt}"                                  \
yann@1192
    35
                      "$(basename "${p}"                        \
yann@1192
    36
                        |"${sed}" -r -e 's/^[[:digit:]]+[-_]//' \
yann@1192
    37
                       )"                                       \
yann@1192
    38
              )"
yann@756
    39
    [ "${p}" = "${dir}/${newname}" ] || ${CMD} "${p}" "${dir}/${newname}"
yann@756
    40
    cpt=$((cpt+inc))
yann@756
    41
done