swapon -v "$XENSWAP" || exit 1
fi
set "/.build-srcdir/$SPECFILE"
+ HOST="$MYHOSTNAME"
fi
while test -n "$1"; do
#
# say hello
#
+test -z "$HOST" && HOST=`hostname`
echo $HOST started \"build $SPECFILES\" at `date`.
echo
test -n "$REASON" && echo "$REASON"
echo "CREATE_BASELIBS='$CREATE_BASELIBS'" >> $BUILD_ROOT/.build/build.data
echo "REASON='${REASON//\'/$Q}'" >> $BUILD_ROOT/.build/build.data
test -n "$XENSWAP" && echo "XENSWAP='/dev/hda2'" >> $BUILD_ROOT/.build/build.data
- PERSONALITY=`perl -e 'print syscall(135, 0)."\n"'`
+ PERSONALITY_SYSCALL=
+ PERSONALITY=0
+ case `perl -V:archname` in
+ *x86_64*) PERSONALITY_SYSCALL=135 ;;
+ *i?86*) PERSONALITY_SYSCALL=136 ;;
+ esac
+ test -n "$PERSONALITY_SYSCALL" && PERSONALITY=`perl -e 'print syscall('$PERSONALITY_SYSCALL', 0)."\n"'`
echo "PERSONALITY='$PERSONALITY'" >> $BUILD_ROOT/.build/build.data
echo "MYHOSTNAME='`hostname`'" >> $BUILD_ROOT/.build/build.data
umount $BUILD_ROOT
XENID="${XENID##*/}"
if test "$PERSONALITY" != 0 ; then
# have to switch back to PER_LINUX to make xm work
- perl -e 'syscall(135, 0); exec(@ARGV) || die("$ARGV[0]: $!\n")' xm create -c $BUILD_DIR/xen.conf name="build:$XENID" $XENMEMORY $XMROOT $XMSWAP extra="init=/.build/build panic=1"
+ perl -e 'syscall('$PERSONALITY_SYSCALL', 0); exec(@ARGV) || die("$ARGV[0]: $!\n")' xm create -c $BUILD_DIR/xen.conf name="build:$XENID" $XENMEMORY $XMROOT $XMSWAP extra="init=/.build/build panic=1"
else
xm create -c $BUILD_DIR/xen.conf name="build:$XENID" $XENMEMORY $XMROOT $XMSWAP extra="init=/.build/build panic=1"
fi
# check if we want to build with the abuild user
#
BUILD_USER=root
- test -n "$NOROOTFORBUILD" && BUILD_USER=abuild
- if egrep '^#[ ]*norootforbuild[ ]*$' >/dev/null <$SPECFILE; then
- BUILD_USER=abuild
+ if test "$BUILD_USER" = abuild ; then
+ egrep '^#[ ]*needsrootforbuild[ ]*$' >/dev/null <$SPECFILE && BUILD_USER=root
+ else
+ egrep '^#[ ]*norootforbuild[ ]*$' >/dev/null <$SPECFILE && BUILD_USER=abuild
fi
+ test -n "$NOROOTFORBUILD" && BUILD_USER=abuild
if test $BUILD_USER = abuild ; then
if ! egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then
echo 'abuild::99:99:Autobuild:/home/abuild:/bin/bash' >>$BUILD_ROOT/etc/passwd
mkdir -p $BUILD_ROOT/home/abuild
chown 99:99 $BUILD_ROOT/home/abuild
fi
+ sed -e "s@^root::@root:*:@" < $BUILD_ROOT/etc/shadow > $BUILD_ROOT/etc/shadow.t && mv $BUILD_ROOT/etc/shadow.t $BUILD_ROOT/etc/shadow
else
if egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then
egrep -v '^abuild:' <$BUILD_ROOT/etc/passwd >$BUILD_ROOT/etc/passwd.new
test "$PACKAGES_TO_PREINSTALL" = "${PACKAGES_TO_PREINSTALL/util-linux}" && PACKAGES_TO_PREINSTALL="$PACKAGES_TO_PREINSTALL util-linux"
test "$PACKAGES_TO_PREINSTALL" = "${PACKAGES_TO_PREINSTALL/perl}" && PACKAGES_TO_PREINSTALL="$PACKAGES_TO_PREINSTALL perl"
test "$PACKAGES_TO_PREINSTALL" = "${PACKAGES_TO_PREINSTALL/libvolume_id}" -a "$PACKAGES_TO_INSTALL" != "${PACKAGES_TO_INSTALL/libvolume_id}" && PACKAGES_TO_PREINSTALL="$PACKAGES_TO_PREINSTALL libvolume_id"
+ test "$PACKAGES_TO_PREINSTALL" = "${PACKAGES_TO_PREINSTALL/device-mapper}" -a "$PACKAGES_TO_INSTALL" != "${PACKAGES_TO_INSTALL/device-mapper}" && PACKAGES_TO_PREINSTALL="$PACKAGES_TO_PREINSTALL device-mapper"
test $PSUF = deb -a "$PACKAGES_TO_PREINSTALL" = "${PACKAGES_TO_PREINSTALL/binutils}" && PACKAGES_TO_PREINSTALL="$PACKAGES_TO_PREINSTALL binutils"
test $PSUF = deb -a "$PACKAGES_TO_PREINSTALL" = "${PACKAGES_TO_PREINSTALL/mount}" && PACKAGES_TO_PREINSTALL="$PACKAGES_TO_PREINSTALL mount"
+ test "$PACKAGES_TO_PREINSTALL" = "${PACKAGES_TO_PREINSTALL/mount}" -a "$PACKAGES_TO_INSTALL" != "${PACKAGES_TO_INSTALL/ mount }" && PACKAGES_TO_PREINSTALL="$PACKAGES_TO_PREINSTALL mount"
fi
fi
if test $PSUF = deb ; then
mkdir -p $BUILD_ROOT/var/lib/dpkg
mkdir -p $BUILD_ROOT/var/log
- mkdir -p $BUILD_ROOT/etc
+ mkdir -p $BUILD_ROOT/etc/default
:> $BUILD_ROOT/var/lib/dpkg/status
:> $BUILD_ROOT/var/lib/dpkg/available
:> $BUILD_ROOT/var/log/dpkg.log
:> $BUILD_ROOT/etc/ld.so.conf
+ :> $BUILD_ROOT/etc/default/rcS
fi
for PKG in $PACKAGES_TO_RUNSCRIPTS ; do
: > $BUILD_ROOT/.init_b_cache/scripts/$PKG.run
preinstall ${PKG##*/}
done
test -c $BUILD_ROOT/dev/null || create_devs
+ test -e $BUILD_ROOT/etc/fstab || touch $BUILD_ROOT/etc/fstab
test -e $BUILD_ROOT/etc/ld.so.conf || cp $BUILD_ROOT/etc/ld.so.conf.in $BUILD_ROOT/etc/ld.so.conf
if test -z "$PREPARE_XEN" ; then
preinstall '' true
if test -n "$PREPARE_XEN" ; then
mkdir -p $BUILD_ROOT/.build
- echo "PACKAGES_TO_INSTALL='${PACKAGES_TO_INSTALL//\'/\'\\\'\'}'" > $BUILD_ROOT/.build/init_buildsystem.data
- echo "PACKAGES_TO_RUNSCRIPTS='${PACKAGES_TO_RUNSCRIPTS//\'/\'\\\'\'}'" >> $BUILD_ROOT/.build/init_buildsystem.data
- echo "PSUF='$PSUF'" >> $BUILD_ROOT/.build/init_buildsystem.data
echo "copying packages..."
for PKG in $PACKAGES_TO_INSTALL ; do
rm -f $BUILD_ROOT/.init_b_cache/$PKG.$PSUF
cp $BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF $BUILD_ROOT/.init_b_cache/$PKG.$PSUF || cleanup_and_exit 1
ln -s -f ../$PKG.$PSUF $BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF
done
+ # alreadyinstalled check will not work, but we have to live with
+ # that...
+ echo -n 'reordering...'
+ REORDER_MISSED=
+ PACKAGES_TO_INSTALL=`reorder $PACKAGES_TO_INSTALL`
+ echo 'done'
+ test -n "$REORDER_MISSED" && echo "WARNING: reorder missed$REORDER_MISSED"
+ echo "PACKAGES_TO_INSTALL='${PACKAGES_TO_INSTALL//\'/\'\\\'\'}'" > $BUILD_ROOT/.build/init_buildsystem.data
+ echo "PACKAGES_TO_RUNSCRIPTS='${PACKAGES_TO_RUNSCRIPTS//\'/\'\\\'\'}'" >> $BUILD_ROOT/.build/init_buildsystem.data
+ echo "PSUF='$PSUF'" >> $BUILD_ROOT/.build/init_buildsystem.data
rm -f $BUILD_IS_RUNNING
exit 0
fi
fi
#
-# reorder packages
+# reorder packages (already done in XEN continuation)
#
-echo -n 'reordering...'
-REORDER_MISSED=
-PACKAGES_TO_INSTALL_FIRST=`reorder $PACKAGES_TO_INSTALL_FIRST`
-PACKAGES_TO_INSTALL=`reorder $PACKAGES_TO_INSTALL`
-echo 'done'
-test -n "$REORDER_MISSED" && echo "WARNING: reorder missed$REORDER_MISSED"
+if ! test -e $BUILD_ROOT/.build/init_buildsystem.data ; then
+ echo -n 'reordering...'
+ REORDER_MISSED=
+ PACKAGES_TO_INSTALL_FIRST=`reorder $PACKAGES_TO_INSTALL_FIRST`
+ PACKAGES_TO_INSTALL=`reorder $PACKAGES_TO_INSTALL`
+ echo 'done'
+ test -n "$REORDER_MISSED" && echo "WARNING: reorder missed$REORDER_MISSED"
+fi
#
# delete all packages we don't want
chroot $BUILD_ROOT zic -l UTC
fi
+HOST=`hostname`
+if ! grep -F "127.0.0.1 $HOST" $BUILD_ROOT/etc/hosts ; then
+ # this makes a reverse lookup on 127.0.0.1 return the host name,
+ # which is bad, but 127.0.0.2 does not work on all unix systems
+ echo "127.0.0.1 $HOST" > $BUILD_ROOT/etc/hosts.new
+ test -f $BUILD_ROOT/etc/hosts && cat $BUILD_ROOT/etc/hosts >> $BUILD_ROOT/etc/hosts.new
+ mv $BUILD_ROOT/etc/hosts.new $BUILD_ROOT/etc/hosts
+fi
+
if test -x $BUILD_ROOT/bin/rpm -a ! -f $BUILD_ROOT/var/lib/rpm/packages.rpm -a ! -f $BUILD_ROOT/var/lib/rpm/Packages ; then
echo "initializing rpm db..."
chroot $BUILD_ROOT rpm --initdb || cleanup_and_exit 1