diff options
author | mikem <mikem> | 2004-08-02 20:45:00 +0000 |
---|---|---|
committer | mikem <mikem> | 2004-08-02 20:45:00 +0000 |
commit | 67406e0d8f111f3b561edbcfaa1db028b1d9e699 (patch) | |
tree | 8e88acdd68bd13273cbfbb367c65cedd4e9581eb /scripts | |
parent | ce83e0bae94cf9f3d45cb3fe6e5b1f9235b131a8 (diff) | |
download | anaconda-67406e0d8f111f3b561edbcfaa1db028b1d9e699.tar.gz anaconda-67406e0d8f111f3b561edbcfaa1db028b1d9e699.tar.xz anaconda-67406e0d8f111f3b561edbcfaa1db028b1d9e699.zip |
make sure dirs exist before cd-ing into them.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/upd-instroot | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/upd-instroot b/scripts/upd-instroot index 0041ce6ca..60fa10472 100755 --- a/scripts/upd-instroot +++ b/scripts/upd-instroot @@ -78,6 +78,7 @@ expandPackageSet() { PKGDEST=$2 KEEPFILES=$3 + [ -d $PKGDEST ] || die "ERROR: directory missing: $PKGDEST" for n in $RPMS; do [ -n "$DEBUG" ] && echo -ne "\rExpanding packages..." $(basename $n) if [ "$(rpm --nosignature --nodigest -qp --qf '%{NAME}' $n)" = "tzdata" ] ; then @@ -88,6 +89,12 @@ expandPackageSet() { done } +die () { + echo "$@" + echo "Aborting instroot creation..." + exit 1 +} + if [ -z "$2" ]; then DEST=/tmp/upd-instroot else @@ -805,11 +812,7 @@ echo "retrieving timezones" TZDIR=/tmp/glibc-timezone-$$ mkdir -p $TZDIR/usr/share/zoneinfo rpm2cpio $TZDATA | (cd $TZDIR; cpio --quiet -iumd usr/share/zoneinfo ./usr/share/zoneinfo ./usr/share/zoneinfo/* usr/share/zoneinfo/*) -if [ $? != 0 ]; then - echo "ERROR: Unable to expand timezone data ($TZDATA)" - echo "Aborting instroot creation..." - exit 1 -fi +[ $? = 0 ] || die "ERROR: Unable to expand timezone data ($TZDATA)" (cd $TZDIR; tar cSpf - $TIMEZONES) | (cd $DEST; tar xSpf -) (cd $TZDIR; tar cSpf - $TIMEZONES) | (cd $DESTGR; tar xSpf -) @@ -1002,6 +1005,8 @@ for p in $DEST $DESTGR; do ln -s ash $p/bin/sh fi + [ -d $p/bin ] || die "ERROR: directory missing: $p/bin" + [ -d $p/sbin ] || die "ERROR: directory missing: $p/sbin" (cd $p/bin; find) | (cd $p/bin; /bin/cpio --quiet -pdmu $p/usr/bin) (cd $p/sbin; find) | (cd $p/sbin; /bin/cpio --quiet -pdmu $p/usr/sbin) rm -rf $p/bin @@ -1010,6 +1015,7 @@ for p in $DEST $DESTGR; do # copy bootloader files for sparc if [ $ARCH = sparc -a $p = $DESTGR ]; then mkdir -p $p/usr/lib/anaconda-runtime/boot + [ -d $p/boot ] || die "ERROR: directory missing: $p/boot" (cd $p/boot; find -name "*.b") | (cd $p/boot; /bin/cpio --quiet -pdmu $p/usr/lib/anaconda-runtime/boot) fi @@ -1042,7 +1048,7 @@ for p in $DEST $DESTGR; do done if [ "$ARCH" != "s390" -a "$ARCH" != "s390x" ]; then - (cd $p/lib; rm -f libnss_files.so.1 libnss_dns.so.1) + (cd $p/lib && rm -f libnss_files.so.1 libnss_dns.so.1) fi if [ -d $DEST/usr/share/zoneinfo ]; then |