summaryrefslogtreecommitdiffstats
path: root/liveinst/liveinst
blob: 51eae2f2b7fee03b980bd38a665281be8b8a2a3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/sh
#
# Simple script to kick off an install from a live CD
#
# Copyright (C) 2007  Red Hat, Inc.  All rights reserved.
#
# 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, see <http://www.gnu.org/licenses/>.
#

if [ -z "$LIVE_BLOCK" ]; then
    if [ -b "/dev/mapper/live-osimg-min" ]; then
       LIVE_BLOCK="/dev/mapper/live-osimg-min"
    else
       LIVE_BLOCK="/dev/live-osimg"
    fi
fi

if [ ! -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

# 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 ; do /sbin/modprobe $i 2>/dev/null ; done

export ANACONDA_PRODUCTNAME=$( cat /etc/system-release | cut -d ' ' -f 1 )
export ANACONDA_PRODUCTVERSION=$( cat /etc/system-release | sed -r -e 's/^.*([0-9]+) *\(.*$/\1/' )
export ANACONDA_BUGURL=${ANACONDA_BUGURL:="https://bugzilla.redhat.com/bugzilla/"}

export PATH=/sbin:/usr/sbin:$PATH

if [ -n "$DISPLAY" -a -n "$LANG" ]; then
    INSTLANG="--lang $LANG"
fi

# eventually, we might want to allow a more "normal" install path
ANACONDA="/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
fi

if [ ! -e /selinux/load ]; then
    ANACONDA="$ANACONDA --noselinux"
fi

# devkit-disks is now mounting lots of stuff.  for now, let's just try to unmount it all
umount /media/*
tac /proc/mounts | grep ^/dev | grep -v live | while read dev mntpoint rest; do
    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

/sbin/udevadm control --env=ANACONDA=1

if [ -x /usr/bin/devkit-disks ]; then
    /usr/bin/devkit-disks --inhibit -- /usr/bin/hal-lock --interface org.freedesktop.Hal.Device.Storage --exclusive --run "$ANACONDA $*"
elif [ -x /usr/bin/hal-lock -a -e /var/lock/subsys/haldaemon ]; then
    /usr/bin/hal-lock --interface org.freedesktop.Hal.Device.Storage --exclusive --run "$ANACONDA $*"
else
    $ANACONDA $*
fi

if [ -n "$current" ]; then
    /usr/sbin/setenforce $current
fi