summaryrefslogtreecommitdiffstats
path: root/data/liveinst
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2010-11-16 13:21:44 -0500
committerDavid Lehman <dlehman@redhat.com>2010-12-02 12:29:55 -0600
commitcb387c67eb351f97664b7f0b3150c1619fe41425 (patch)
treeac0df95601ee8b7b7520fadcd96e225613a9b3ed /data/liveinst
parent5be1233e815c836e2232499d5e6d4f0b951b29ef (diff)
downloadanaconda-cb387c67eb351f97664b7f0b3150c1619fe41425.tar.gz
anaconda-cb387c67eb351f97664b7f0b3150c1619fe41425.tar.xz
anaconda-cb387c67eb351f97664b7f0b3150c1619fe41425.zip
Add support for installing onto block device image files.
Multiple image files can be specified via "--image=/path/to/image[:name]" on the anaconda command line. The name cannot contain colons. Whenever disk images are specified, they automatically become the only disks visible to anaconda, as if "ignoredisks --only-use" had been used. Fow now, only normal disk images are supported. Do not try to build a fwraid or mpath in image files and expect anaconda to handle it correctly. Don't log to system log for disk image installs. For one thing, it adds a huge amount of text to /var/log/messages. It also has some problem that prevents subsequent attempts to connect to the syslog socket (from anaconda_log.py, anyway) to fail. Don't allow configuration of network devices during disk image installs. Also, don't write anything in /etc/sysconfig on the host system when doing image installs. Don't start auditd when doing an image install. Don't run setupTimezone if installing to disk image file(s). We don't want to change settings on the host system. Don't start or stop iscsi, fcoe, dasd, or zfcp during image installs.
Diffstat (limited to 'data/liveinst')
-rwxr-xr-xdata/liveinst/liveinst113
1 files changed, 74 insertions, 39 deletions
diff --git a/data/liveinst/liveinst b/data/liveinst/liveinst
index e424a62dc..46213a8a9 100755
--- a/data/liveinst/liveinst
+++ b/data/liveinst/liveinst
@@ -18,6 +18,30 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+if [ -n "$DISPLAY" -a -n "$LANG" ]; then
+ INSTLANG="--lang $LANG"
+fi
+
+LIVE_INSTALL=0
+IMAGE_INSTALL=0
+RESCUE=0
+if [[ "$LIVECMD $*" =~ "--rescue" ]]; then
+ RESCUE=1
+fi
+
+if [ -z "$LIVECMD" ]; then
+ LIVE_INSTALL=1
+fi
+
+if [[ "$LIVECMD $*" =~ "--image" ]]; then
+ IMAGE_INSTALL=1
+fi
+
+if [[ "$LIVECMD $*" =~ "--liveinst" ]]; then
+ LIVE_INSTALL=1
+fi
+
+
if [ -z "$LIVE_BLOCK" ]; then
if [ -b "/dev/mapper/live-osimg-min" ]; then
LIVE_BLOCK="/dev/mapper/live-osimg-min"
@@ -26,16 +50,25 @@ if [ -z "$LIVE_BLOCK" ]; then
fi
fi
-if [ ! -b $LIVE_BLOCK ]; then
+if [ $LIVE_INSTALL = 1 -a ! -b $LIVE_BLOCK ]; then
zenity --error --title="Not a Live image" --text "Can't do live image installation unless running from a live image"
exit 1
fi
+# Allow running another command in the place of anaconda, but in this same
+# environment. This allows storage testing to make use of all the module
+# loading and lvm control in this file, too.
+ANACONDA=${LIVECMD:=/usr/sbin/anaconda --liveinst --method=livecd://$LIVE_BLOCK $INSTLANG}
+
# load modules that would get loaded by the loader... (#230945)
for i in raid0 raid1 raid5 raid6 raid456 raid10 dm-mod dm-zero dm-mirror dm-snapshot dm-multipath dm-round-robin vfat dm-crypt cbc sha256 lrw xts iscsi_tcp iscsi_ibft; do /sbin/modprobe $i 2>/dev/null ; done
export ANACONDA_PRODUCTNAME=$( cat /etc/system-release | sed -r -e 's/ *release.*//' )
-export ANACONDA_PRODUCTVERSION=$( cat /etc/system-release | sed -r -e 's/^.* ([0-9\.]+).*$/\1/' )
+if [ $LIVE_INSTALL = 1 ]; then
+ export ANACONDA_PRODUCTVERSION=$( cat /etc/system-release | sed -r -e 's/^.* ([0-9\.]+).*$/\1/' )
+elif [ $IMAGE_INSTALL = 1 ]; then
+ export ANACONDA_PRODUCTVERSION=$(rpmquery -q --qf '%{VERSION}' anaconda | cut -d. -f1)
+fi
export ANACONDA_BUGURL=${ANACONDA_BUGURL:="https://bugzilla.redhat.com/bugzilla/"}
RELEASE=$(rpm -q --qf '%{Release}' fedora-release)
@@ -47,15 +80,6 @@ fi
export PATH=/sbin:/usr/sbin:$PATH
-if [ -n "$DISPLAY" -a -n "$LANG" ]; then
- INSTLANG="--lang $LANG"
-fi
-
-# Allow running another command in the place of anaconda, but in this same
-# environment. This allows storage testing to make use of all the module
-# loading and lvm control in this file, too.
-ANACONDA=${LIVECMD:=/usr/sbin/anaconda --liveinst --method=livecd://$LIVE_BLOCK $INSTLANG}
-
if [ -x /usr/sbin/setenforce -a -e /selinux/enforce ]; then
current=$(cat /selinux/enforce)
/usr/sbin/setenforce 0
@@ -74,34 +98,38 @@ for opt in `cat /proc/cmdline`; do
esac
done
-# devkit-disks is now mounting lots of stuff. for now, let's just try to unmount it all
-umount /media/* 2>/dev/null
-tac /proc/mounts | grep ^/dev | grep -v live | while read dev mntpoint rest; do
- # hack - don't unmount devices the storage test code requires
- if [ "$mntpoint" = "/mnt/anactest" ]; then
- continue
- fi
-
- if [ -b $dev ]; then
- umount $mntpoint 2>/dev/null
- fi
-done
-
-/sbin/swapoff -a
-/sbin/lvm vgchange -an --ignorelockingfailure
-for i in /dev/md*; do
- if [ ! -b $i ]; then
- continue
- fi
-
- case "$i" in
- /dev/md*p*)
- ;;
- *)
- mdadm --stop $i >/dev/null 2>&1
- ;;
- esac
-done
+if [ $IMAGE_INSTALL = 0 ]; then
+ # devkit-disks is now mounting lots of stuff. for now, let's just try to
+ # unmount it all
+ umount /media/* 2>/dev/null
+ tac /proc/mounts | grep ^/dev | grep -v live | \
+ while read dev mntpoint rest; do
+ # hack - don't unmount devices the storage test code requires
+ if [ "$mntpoint" = "/mnt/anactest" ]; then
+ continue
+ fi
+
+ if [ -b $dev ]; then
+ umount $mntpoint 2>/dev/null
+ fi
+ done
+
+ /sbin/swapoff -a
+ /sbin/lvm vgchange -an --ignorelockingfailure
+ for i in /dev/md*; do
+ if [ ! -b $i ]; then
+ continue
+ fi
+
+ case "$i" in
+ /dev/md*p*)
+ ;;
+ *)
+ mdadm --stop $i >/dev/null 2>&1
+ ;;
+ esac
+ done
+fi
/sbin/udevadm control --env=ANACONDA=1
@@ -113,6 +141,13 @@ else
$ANACONDA $*
fi
+# try to teardown the filesystems if this was an image install
+if [ $IMAGE_INSTALL = 1 -a $RESCUE = 0 ]; then
+ anaconda-image-cleanup
+fi
+
+rm -f /dev/.in_sysinit 2>/dev/null
+
if [ -n "$current" ]; then
/usr/sbin/setenforce $current
fi