blob: d226f3fea591a4ce0f5312400d1a578d1ecdbdfc (
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
#!/bin/bash
#
# 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 [ -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
# Try to sort out where the live device is
if [ -z "$LIVE_BLOCK" ]; then
if [ -b "/run/initramfs/live-baseloop" ]; then
LIVE_BLOCK="/run/initramfs/live-baseloop"
elif [ -b "/dev/mapper/live-osimg-min" ]; then
LIVE_BLOCK="/dev/mapper/live-osimg-min"
elif [ -b "/dev/live-osimg" ]; then
LIVE_BLOCK="/dev/live-osimg"
fi
fi
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:=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.*//' )
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)
if [ "${RELEASE:0:2}" = "0." ]; then
export ANACONDA_ISFINAL="false"
else
export ANACONDA_ISFINAL="true"
fi
export PATH=/sbin:/usr/sbin:$PATH
if [ -x /usr/sbin/getenforce ]; then
current=$(/usr/sbin/getenforce)
/usr/sbin/setenforce 0
fi
if [ -z "$(sestatus | grep enabled)" ]; then
ANACONDA="$ANACONDA --noselinux"
fi
# Process cmdline args
for opt in `cat /proc/cmdline` $*; do
case $opt in
xdriver=*)
ANACONDA="$ANACONDA --$opt"
;;
updates=*)
UPDATES="${opt#updates=}"
;;
--updates=*)
UPDATES="${opt#--updates=}"
;;
esac
done
# unmount anything that shouldn't be mounted prior to install
anaconda-cleanup $ANACONDA $*
/sbin/udevadm control --env=ANACONDA=1
# Set up the updates, if provided.
if [ ! -z "$UPDATES" ]; then
if [ -e /tmp/updates.img -o -e /tmp/updates ]; then
zenity --error --title="Updates already exist" --text "updates= was provided, but an updates image already exists. Please remove /tmp/updates.img and /tmp/updates and try again."
exit 1
fi
curl -o /tmp/updates.img $UPDATES
mkdir /tmp/updates
# We officially support two updates.img formats: a filesystem image, and
# a compressed cpio blob.
if [ ! -z "$(file /tmp/updates.img | grep 'gzip compressed data')" ]; then
( cd /tmp/updates ; gzip -dc /tmp/updates.img | cpio -id )
else
mount -t auto /tmp/updates.img /tmp/updates
fi
export PYTHONPATH=/tmp/updates:$PYTHONPATH
export LD_LIBRARY_PATH=/tmp/updates:$LD_LIBRARY_PATH
export PATH=/tmp/updates:$PATH
fi
# Prevents breakage if the hostname is changed during the install
xhost +si:localuser:root
if [ -x /usr/bin/udisks ]; then
/usr/bin/udisks --inhibit -- $ANACONDA $*
else
$ANACONDA $*
fi
if [ -e /tmp/updates ]; then rm -r /tmp/updates; fi
if [ -e /tmp/updates.img ]; then rm /tmp/updates.img; fi
# try to teardown the filesystems if this was an image install
if [ $IMAGE_INSTALL = 1 -a $RESCUE = 0 ]; then
anaconda-cleanup
fi
rm -f /dev/.in_sysinit 2>/dev/null
if [ -n "$current" ]; then
/usr/sbin/setenforce $current
fi
|