Use "set -o errexit" to error out when a command failed. Make sure parent
directories are created as needed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35784 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -o errexit
|
||||||
|
|
||||||
# The first argument is the shell script that initializes the variables:
|
# The first argument is the shell script that initializes the variables:
|
||||||
# sourceDir
|
# sourceDir
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -o errexit
|
||||||
|
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
echo "Usage: $0 <archive> <scripts> ..."
|
echo "Usage: $0 <archive> <scripts> ..."
|
||||||
@@ -34,7 +35,7 @@ rm=rm
|
|||||||
|
|
||||||
# clear output dir
|
# clear output dir
|
||||||
$rm -rf $outputDir
|
$rm -rf $outputDir
|
||||||
$mkdir $outputDir
|
$mkdir -p $outputDir
|
||||||
|
|
||||||
# populate output dir
|
# populate output dir
|
||||||
echo "Preparing contents of archive $archive ..."
|
echo "Preparing contents of archive $archive ..."
|
||||||
@@ -47,7 +48,7 @@ done
|
|||||||
echo "Building archive $archive ..."
|
echo "Building archive $archive ..."
|
||||||
$rm -f $archive
|
$rm -f $archive
|
||||||
contents=$(cd $outputDir; ls)
|
contents=$(cd $outputDir; ls)
|
||||||
tar -C $outputDir --format ustar -czf $archive $contents || exit 1
|
tar -C $outputDir --format ustar -czf $archive $contents
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
$rm -rf $outputDir
|
$rm -rf $outputDir
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
set -o errexit
|
||||||
|
|
||||||
if [ $# -lt 2 ]; then
|
if [ $# -lt 2 ]; then
|
||||||
echo "Usage: $0 <archive> <scripts> ..."
|
echo "Usage: $0 <archive> <scripts> ..."
|
||||||
@@ -36,7 +37,7 @@ rm=rm
|
|||||||
|
|
||||||
# clear output dir
|
# clear output dir
|
||||||
$rmAttrs -rf $outputDir
|
$rmAttrs -rf $outputDir
|
||||||
$mkdir $outputDir
|
$mkdir -p $outputDir
|
||||||
|
|
||||||
# populate output dir
|
# populate output dir
|
||||||
echo "Preparing contents of archive $archive ..."
|
echo "Preparing contents of archive $archive ..."
|
||||||
@@ -55,7 +56,7 @@ cd $cwd
|
|||||||
echo "Building archive $archive ..."
|
echo "Building archive $archive ..."
|
||||||
$rm -f $archive
|
$rm -f $archive
|
||||||
cd $outputDir
|
cd $outputDir
|
||||||
$zip -ryq $archive . || exit 1
|
$zip -ryq $archive .
|
||||||
cd $cwd
|
cd $cwd
|
||||||
|
|
||||||
# clean up
|
# clean up
|
||||||
|
|||||||
Reference in New Issue
Block a user