mirror of
https://frontier.innolan.net/github/amigaos-cross-toolchain6.git
synced 2024-10-19 10:29:55 +00:00
Fix argument checking and file path schema.
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh -e
|
||||||
|
|
||||||
# 1) Splits a patch file into smaller patches - one for each file.
|
# 1) Splits a patch file into smaller patches - one for each file.
|
||||||
# 2) Build a directory structure correspoding to paths in patch headers.
|
# 2) Build a directory structure correspoding to paths in patch headers.
|
||||||
@ -6,14 +6,14 @@
|
|||||||
# 4) If a patch introduces a completely new file, it will be put into directory
|
# 4) If a patch introduces a completely new file, it will be put into directory
|
||||||
# as a regular file and not diff file.
|
# as a regular file and not diff file.
|
||||||
|
|
||||||
[ $# == 1 ] || echo "Error: expected single patch file as an argument."
|
[ $# == 1 ] || { echo "Error: expected single patch file as an argument."; false; }
|
||||||
[ -f $1 ] || echo "Error: no such file '$1'."
|
[ -f $1 ] || { echo "Error: no such file '$1'."; false; }
|
||||||
|
|
||||||
path="$1"
|
path="$1"
|
||||||
|
|
||||||
splitdiff -a "${path}" >/dev/null
|
splitdiff -a "${path}" >/dev/null
|
||||||
|
|
||||||
for p in ${path}.part???; do
|
for p in ${path}.part*; do
|
||||||
file=`sed -E -n -e '1s/---[[:space:]]+([^[:space:]]+).*/\1/p' ${p}`
|
file=`sed -E -n -e '1s/---[[:space:]]+([^[:space:]]+).*/\1/p' ${p}`
|
||||||
origsize=`sed -E -n -e '3s/@@ ([^[:space:]]+) .*/\1/p' ${p}`
|
origsize=`sed -E -n -e '3s/@@ ([^[:space:]]+) .*/\1/p' ${p}`
|
||||||
mkdir -p `dirname ${file}`
|
mkdir -p `dirname ${file}`
|
||||||
|
|||||||
Reference in New Issue
Block a user