echo "where options are:"
echo " -n | --no-deps Do no install build-time dependencies"
echo " -v | --verbose Verbose"
+ echo " -i | --install Install under / and configure the system"
}
# execution
# parameters check
export NO_DEPS=0
export VERBOSE=0
+export INSTALL=0
while test $# -ge 1
do
if test "$1" = "-n" || test "$1" = "--no-deps"
then
VERBOSE=1
shift 1
+ elif test "$1" = "-i" || test "$1" = "--install"
+ then
+ INSTALL=1
+ shift 1
else
help
exit 1
install_dependencies git
+# build and install under $DESTDIR ($PWD/dist by default)
if test "$XEN_UPSTREAM_REVISION"
then
xen_clean
libvirt_clean
libvirt_build
fi
+
+
+if test -z "$INSTALL" || test "$INSTALL" -eq 0
+then
+ exit 0
+fi
+# install under /
+$TMPFILE=`mktemp`
+cd $INST_DIR
+find . > $TMPFILE
+$SUDO mv $TMPFILE /var/log/raixen.log
+mv * /
+
+# configure
+if test "$XEN_UPSTREAM_REVISION"
+then
+ xen_configure
+fi
+if test "$GRUB_UPSTREAM_REVISION"
+then
+ grub_configure
+fi
+if test "$LIBVIRT_UPSTREAM_REVISION"
+then
+ libvirt_configure
+fi
;;
esac
}
+
+function start_initscripts() {
+ case $DISTRO in
+ "Debian" | "Ubuntu" )
+ while test $# -ge 1
+ do
+ $SUDO update-rc.d $1
+ shift 1
+ done
+ ;;
+ * )
+ echo "I don't know how to start initscripts on $DISTRO"
+ ;;
+ esac
+}
rm -rf memdisk.tar
rm -rf grub-dir
}
+
+function grub_configure() {
+}
--- /dev/null
+#! /bin/sh
+#
+# Init script for libvirtd
+#
+# Loosely based on Debian libvirt-bin initscript:
+# (c) 2007 Guido Guenther <agx@xxxxxxxxxxx>
+# based on the skeletons that comes with dh_make
+#
+### BEGIN INIT INFO
+# Provides: libvirt-bin libvirtd
+# Required-Start: $network $local_fs $remote_fs $syslog
+# Required-Stop: $local_fs $remote_fs $syslog
+# Should-Start: avahi-daemon cgconfig
+# Should-Stop: avahi-daemon cgconfig
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: libvirt management daemon
+### END INIT INFO
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+export PATH
+DAEMON=/usr/local/sbin/libvirtd
+NAME=libvirtd
+DESC="libvirt management daemon"
+
+test -x $DAEMON || exit 0
+. /lib/lsb/init-functions
+
+PIDFILE=/var/run/$NAME.pid
+
+case "$1" in
+ start)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+ start-stop-daemon --start --pidfile $PIDFILE \
+ --exec $DAEMON -- -d $libvirtd_opts
+ [ "$VERBOSE" != no ] && log_end_msg $?
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ start-stop-daemon --stop --pidfile $PIDFILE \
+ --exec $DAEMON
+ [ "$VERBOSE" != no ] && log_end_msg $?
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ reload|force-reload)
+ start-stop-daemon --stop --signal 1 --quiet --pidfile \
+ /var/run/$NAME.pid --exec $DAEMON
+ ;;
+ *)
+ N=/etc/init.d/libvirtd
+ echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
--with-yajl --without-macvtap --without-avahi --prefix=$PREFIX
$MAKE
$MAKE --ignore-errors install DESTDIR=$INST_DIR
+ if test $DISTRO = "Debian"
+ then
+ cp libvirt.debian.init "$INST_DIR"/etc/init.d/libvirtd
+ chmod +x "$INST_DIR"/etc/init.d/libvirtd
+ elif test $DISTRO = "Fedora" || test $DISTRO = "CentOS"
+ then
+ $MAKE -C daemon libvirtd.init
+ cp daemon/libvirtd.init $INST_DIR/etc/init.d/libvirtd
+ chmod +x "$INST_DIR"/etc/init.d/libvirtd
+ else
+ echo "I don't know how write an init script for Libvirt on $DISTRO"
+ fi
cd ..
}
function libvirt_clean() {
rm -rf libvirt-dir
}
+
+function libvirt_configure() {
+ if test "$DISTRO" != "Debian"
+ then
+ echo "I don't know how to configure Libvirt on $DISTRO"
+ return 1
+ fi
+ start_initscripts libvirtd
+}
./configure --prefix=$PREFIX
$MAKE
$MAKE install DESTDIR="$INST_DIR"
+ chmod +x "$INST_DIR"/etc/init.d/xencommons
+ chmod +x "$INST_DIR"/etc/init.d/xendomains
+ chmod +x "$INST_DIR"/etc/init.d/xen-watchdog
cd ..
}
rm -rf xen-dir
}
+function xen_create_bridge_Debian() {
+ BRIDGE="xenbr0"
+ IFACE=`grep "dhcp" /etc/network/interfaces | head -1 | awk '{print$2}'`
+ if test -z "$IFACE"
+ then
+ echo "Please refer to the following page to setup networking:"
+ echo "http://wiki.xenproject.org/wiki/Network_Configuration_Examples_(Xen_4.1%2B)"
+ return 1
+ fi
+ if test "`grep $BRIDGE /etc/network/interfaces`"
+ then
+ echo "a network bridge seems to be already setup"
+ return 0
+ fi
+ TMPFILE=`mktemp`
+ cat /etc/network/interfaces | \
+ sed -e "s/iface $IFACE inet dhcp/iface $IFACE inet manual/" \
+ -e "/auto/s/\<$IFACE\>/$BRIDGE/g" \
+ -e "/allow-hotplug/s/\<$IFACE\>/$BRIDGE/g" > $TMPFILE
+ echo "" >> $TMPFILE
+ echo "iface $BRIDGE inet dhcp" >> $TMPFILE
+ echo " bridge_ports $IFACE" >> $TMPFILE
+ $SUDO cp $TMPFILE /etc/network/interfaces
+ rm $TMPFILE
+}
+
+function xen_configure() {
+ if test "$DISTRO" != "Debian"
+ then
+ echo "I don't know how to configure Xen on $DISTRO"
+ return 1
+ fi
+ xen_create_bridge_$DISTRO
+ start_initscripts xencommons xendomains xen-watchdog
+}