From b5bdeec09a583c5a6e8dc1dbed1591723e5b708f Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Generate kickstart file. - Kickstart file renamed to 'p2v.ks'. - Generated by ./configure - Use %post --nochroot to copy files in. --- Makefile.in | 42 +-------------- configure.ac | 23 ++++++++- livecd-post.sh.in | 79 ---------------------------- livecd.ks.in | 88 ------------------------------- p2v.ks.in | 152 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 176 insertions(+), 208 deletions(-) delete mode 100644 livecd-post.sh.in delete mode 100644 livecd.ks.in create mode 100644 p2v.ks.in diff --git a/Makefile.in b/Makefile.in index 68e1a9e..75395e6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -29,19 +29,7 @@ HAVE_QEMU := @HAVE_QEMU@ HAVE_QEMU_KVM := @HAVE_QEMU_KVM@ HAVE_LIVECD_CREATOR := @HAVE_LIVECD_CREATOR@ -# i386 images also work on x86-64, so best to stick with i386. -ARCH := i386 - -# Base repository. -BASE := 8 -BASEURL := http://download.fedora.redhat.com/pub/fedora/linux/releases/$(BASE)/Everything/$(ARCH)/os/ - -LANG := en_US.UTF-8 -KEYBOARD := us -TIMEZONE := US/Eastern - LABEL := $(PACKAGE)-$(VERSION) - ISO := $(LABEL).iso #---------------------------------------------------------------------- @@ -58,37 +46,11 @@ all: ifeq ($(HAVE_LIVECD_CREATOR),livecd-creator) -build: checkroot checkscript livecd.ks +build: p2v.ks checkroot checkscript rm -f $(ISO) - livecd-creator --config=livecd.ks --fslabel=$(LABEL) + livecd-creator --config=$< --fslabel=$(LABEL) ls -lhtr *.iso -livecd.ks: livecd.ks.in livecd-post.sh Makefile - rm -f $@ - sed \ - -e 's|@ARCH@|$(ARCH)|g' \ - -e 's|@BASE@|$(BASE)|g' \ - -e 's|@BASEURL@|$(BASEURL)|g' \ - -e 's|@LANG@|$(LANG)|g' \ - -e 's|@KEYBOARD@|$(KEYBOARD)|g' \ - -e 's|@TIMEZONE@|$(TIMEZONE)|g' \ - < $< | cat - livecd-post.sh > $@ - -livecd-post.sh: livecd-post.sh.in virt-p2v virt-p2v-update-wrapper iso-attach inittab lvm.conf Makefile - rm -f $@ - sed \ - -e '/@VIRT-P2V@/ r virt-p2v' \ - -e '/@VIRT-P2V@/ d' \ - -e '/@VIRT-P2V-UPDATE-WRAPPER@/ r virt-p2v-update-wrapper' \ - -e '/@VIRT-P2V-UPDATE-WRAPPER@/ d' \ - -e '/@ISO-ATTACH@/ r iso-attach' \ - -e '/@ISO-ATTACH@/ d' \ - -e '/@INITTAB@/ r inittab' \ - -e '/@INITTAB@/ d' \ - -e '/@LVM.CONF@/ r lvm.conf' \ - -e '/@LVM.CONF@/ d' \ - < $< > $@ - endif # Run live CD under qemu. diff --git a/configure.ac b/configure.ac index be821a0..ea7f3ad 100644 --- a/configure.ac +++ b/configure.ac @@ -47,11 +47,32 @@ dnl Check for optional qemu or qemu-kvm (for test-booting). AC_CHECK_PROG(HAVE_QEMU,qemu,qemu) AC_CHECK_PROG(HAVE_QEMU_KVM,qemu-kvm,qemu-kvm) +dnl XXX Later we will change these so that the user can set them with +dnl ./configure parameters. This is just for testing. + +# i386 images also work on x86-64, so best to stick with i386. +ARCH=i386 + +# Base repository. +BASE=8 +BASEURL=http://download.fedora.redhat.com/pub/fedora/linux/releases/$BASE/Everything/$ARCH/os/ + +LANG=en_US.UTF-8 +KEYBOARD=us +TIMEZONE=US/Eastern + +AC_SUBST(ARCH) +AC_SUBST(BASE) +AC_SUBST(BASEURL) +AC_SUBST(LANG) +AC_SUBST(KEYBOARD) +AC_SUBST(TIMEZONE) + dnl Summary. echo "------------------------------------------------------------" echo "Thanks for downloading" $PACKAGE_STRING echo "------------------------------------------------------------" dnl Produce output files. -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile p2v.ks]) AC_OUTPUT diff --git a/livecd-post.sh.in b/livecd-post.sh.in deleted file mode 100644 index 3112682..0000000 --- a/livecd-post.sh.in +++ /dev/null @@ -1,79 +0,0 @@ -# This is the post-configuration section of the kickstart -# installer. It runs inside the live CD chroot while it is -# being created (after all the packages have been installed) -# but before we make the ISO. -# -# Copyright (C) 2007 Red Hat Inc. -# Written by Richard W.M. Jones -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -# This is the virt-p2v script. -cat > /usr/bin/virt-p2v << '__EOF1234__' -@VIRT-P2V@ -__EOF1234__ - -chmod 0755 /usr/bin/virt-p2v -/sbin/restorecon /usr/bin/virt-p2v - -# iso-attach program. -cat > /usr/bin/iso-attach << '__EOF2134__' -@ISO-ATTACH@ -__EOF2134__ - -chmod 0755 /usr/bin/iso-attach -/sbin/restorecon /usr/bin/iso-attach - -# Update wrapper - checks the CD-ROM for any attached file. -cat > /usr/bin/virt-p2v-update-wrapper << '__EOF1243__' -@VIRT-P2V-UPDATE-WRAPPER@ -__EOF1243__ - -chmod 0755 /usr/bin/virt-p2v-update-wrapper -/sbin/restorecon /usr/bin/virt-p2v-update-wrapper - -# Install custom inittab. -cat > /etc/inittab << '__EOF4123__' -@INITTAB@ -__EOF4123__ - -# Install custom lvm.conf. The script selects this by adjusting -# $LVM_SYSTEM_DIR environment variable at the right time. -cp -a /etc/lvm /etc/lvm.new -cat > /etc/lvm.new/lvm.conf << '__EOF4312__' -@LVM.CONF@ -__EOF4312__ - -# Turn off firstboot for livecd boots. -echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot - -# Don't start yum-updatesd for livecd boots. -/sbin/chkconfig --level 345 yum-updatesd off - -# Don't start cron/at as they tend to spawn things which are -# disk intensive that are painful on a live image. -/sbin/chkconfig --level 345 crond off -/sbin/chkconfig --level 345 atd off -/sbin/chkconfig --level 345 anacron off -/sbin/chkconfig --level 345 readahead_early off -/sbin/chkconfig --level 345 readahead_later off - -# Stopgap fix for RH #217966; should be fixed in HAL instead -touch /media/.hal-mtab - -# Make some mountpoints. -mkdir /mnt/root - -%end diff --git a/livecd.ks.in b/livecd.ks.in deleted file mode 100644 index 268021d..0000000 --- a/livecd.ks.in +++ /dev/null @@ -1,88 +0,0 @@ -# LiveCD kickstart file for virt-p2v -# -# Copyright (C) 2007 Red Hat Inc. -# Written by Richard W.M. Jones -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# $Id$ - -lang @LANG@ -keyboard @KEYBOARD@ -timezone @TIMEZONE@ -auth --useshadow --enablemd5 -selinux --enforcing -firewall --disabled - -repo --name=released --baseurl=@BASEURL@ -#repo --name=released --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-@BASE@&arch=@ARCH@ - -%packages -bash -kernel -syslinux -passwd -policycoreutils -chkconfig -authconfig -rootfiles - -# dd, sleep, sync, etc. -coreutils - -# For device mapping -device-mapper -util-linux-ng -module-init-tools -gzip -kpartx - -# For remote communications -openssh-clients -nc - -# For the shell script -dialog -grep -sed -gawk -findutils - -# For OCaml -ocaml -ocaml-runtime -ocaml-pcre -ocaml-extlib -ocaml-xml-light -ocaml-libvirt - -# For network configuration -dhclient - -# Some other generally useful packages -which -perl -rpm -lsof -strace -vim-minimal -vim-enhanced -bind-utils -file - - - -# The contents of livecd-post.sh are appended to the file after %post. -%post diff --git a/p2v.ks.in b/p2v.ks.in new file mode 100644 index 0000000..bf6ea39 --- /dev/null +++ b/p2v.ks.in @@ -0,0 +1,152 @@ +# LiveCD kickstart file for virt-p2v +# @configure_input@ +# +# Copyright (C) 2007-2008 Red Hat Inc. +# Written by Richard W.M. Jones +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +lang @LANG@ +keyboard @KEYBOARD@ +timezone @TIMEZONE@ +auth --useshadow --enablemd5 +selinux --enforcing +firewall --disabled + +repo --name=released --baseurl=@BASEURL@ +#repo --name=released --mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-@BASE@&arch=@ARCH@ + +%packages +bash +kernel +syslinux +passwd +policycoreutils +chkconfig +authconfig +rootfiles + +# dd, sleep, sync, etc. +coreutils + +# For device mapping +device-mapper +util-linux-ng +module-init-tools +gzip +kpartx + +# For remote communications +openssh-clients +nc + +# For the shell script +dialog +grep +sed +gawk +findutils + +# For OCaml +ocaml +ocaml-runtime +ocaml-pcre +ocaml-extlib +ocaml-xml-light +ocaml-libvirt + +# For network configuration +dhclient + +# Some other generally useful packages +which +perl +rpm +lsof +strace +vim-minimal +vim-enhanced +bind-utils +file + + +%post --nochroot + +# These files have to be copied from the build directory into the +# squashfs. See also: +# http://www.mail-archive.com/fedora-livecd-list@redhat.com/msg01470.html + +# Just check everything exists, because kickstart will not give +# an error if files or paths are missing. +if test "x$INSTALL_ROOT" = "x"; then ERROR=1; fi +if ! test -d "$INSTALL_ROOT/usr/bin"; then ERROR=1; fi +if ! test -d "@abs_top_srcdir@"; then ERROR=1; fi +if ! test -f "@abs_top_srcdir@/virt-p2v"; then ERROR=1; fi + +if test "x$ERROR" = "x1"; then + echo "**************************************************" + echo "**************************************************" + echo "**************************************************" + echo "Missing files or directories found. This ISO will be bad." + echo "**************************************************" + echo "**************************************************" + echo "**************************************************" + # Exit 1 won't stop anything, but it makes me feel better. + exit 1 +fi + +install -m 0755 -o root -g root \ + @abs_top_srcdir@/virt-p2v \ + @abs_top_srcdir@/virt-p2v-update-wrapper \ + @abs_top_srcdir@/iso-attach \ + $INSTALL_ROOT/usr/bin + +install -m 0644 -o root -g root @abs_top_srcdir@/inittab \ + $INSTALL_ROOT/etc + +cp -a $INSTALL_ROOT/etc/lvm $INSTALL_ROOT/etc/lvm.new +install -m 0644 -o root -g root @abs_top_srcdir@/lvm.conf \ + $INSTALL_ROOT/etc/lvm.new + +%end + +%post + +# Restore SELinux permissions on installed binaries. +/sbin/restorecon /usr/bin/virt-p2v +/sbin/restorecon /usr/bin/virt-p2v-update-wrapper +/sbin/restorecon /usr/bin/iso-attach + +# Turn off firstboot for livecd boots. +echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot + +# Don't start yum-updatesd for livecd boots. +/sbin/chkconfig --level 345 yum-updatesd off + +# Don't start cron/at as they tend to spawn things which are +# disk intensive that are painful on a live image. +/sbin/chkconfig --level 345 crond off +/sbin/chkconfig --level 345 atd off +/sbin/chkconfig --level 345 anacron off +/sbin/chkconfig --level 345 readahead_early off +/sbin/chkconfig --level 345 readahead_later off + +# Stopgap fix for RH #217966; should be fixed in HAL instead +touch /media/.hal-mtab + +# Make some mountpoints. +mkdir /mnt/root + +%end -- 1.8.3.1