1 |
#!/bin/bash |
#!/bin/bash |
2 |
|
# $Id$ |
3 |
# |
# |
4 |
# new-kernel-pkg |
# new-kernel-pkg |
5 |
# Invoked upon installation or removal of a kernel package, the following |
# Invoked upon installation or removal of a kernel package, the following |
32 |
# some defaults that are sane for most arches |
# some defaults that are sane for most arches |
33 |
kernelName=kernel |
kernelName=kernel |
34 |
|
|
35 |
if [ -x ./grubby ]; then |
if [ -x ./grubby ] |
36 |
grubby=./grubby |
then |
37 |
|
grubby=./grubby |
38 |
else |
else |
39 |
grubby=/sbin/grubby |
grubby=/sbin/grubby |
40 |
fi |
fi |
41 |
|
|
42 |
[ -f /etc/sysconfig/kernel ] && . /etc/sysconfig/kernel |
[ -f /etc/conf.d/grubby ] && . /etc/conf.d/grubby |
43 |
|
[ -f /etc/conf.d/grubby-uboot ] && . /etc/conf.d/grubby-uboot |
44 |
|
|
45 |
|
cfgGrub2="" |
46 |
|
cfgGrub2Efi="" |
47 |
cfgGrub="" |
cfgGrub="" |
48 |
cfgLilo="" |
cfgLilo="" |
49 |
|
cfguBoot="" |
50 |
runLilo="" |
runLilo="" |
51 |
grubConfig="" |
grubConfig="" |
52 |
|
grub2Config="" |
53 |
|
grub2EfiConfig="" |
54 |
|
|
55 |
ARCH=$(uname -m) |
ARCH=$(uname -m) |
56 |
|
|
57 |
if [ $ARCH = 'ia64' ]; then |
if [[ ${ARCH} = ia64 ]] |
58 |
liloConfig=/boot/efi/EFI/redhat/elilo.conf |
then |
59 |
bootPrefix=/boot/efi/EFI/redhat |
liloConfig=/boot/efi/EFI/redhat/elilo.conf |
60 |
liloFlag=elilo |
bootPrefix=/boot/efi/EFI/redhat |
61 |
isx86="" |
liloFlag=elilo |
62 |
elif [ $ARCH = 'ppc64' -o $ARCH = 'ppc' ]; then |
isx86="" |
63 |
liloConfig=/etc/yaboot.conf |
elif [[ ${ARCH} = ppc64 ]] || [[ ${ARCH} = ppc ]] |
64 |
bootPrefix=/boot |
then |
65 |
lilo=/sbin/ybin |
liloConfig=/etc/yaboot.conf |
66 |
liloFlag=yaboot |
bootPrefix=/boot |
67 |
runLilo="yes" |
lilo=/sbin/ybin |
68 |
isx86="" |
liloFlag=yaboot |
69 |
elif [ $ARCH = 'sparc' -o $ARCH = 'sparc64' ]; then |
runLilo="yes" |
70 |
liloConfig=/etc/silo.conf |
isx86="" |
71 |
bootPrefix=/boot |
elif [[ ${ARCH} = sparc ]] || [[ ${ARCH} = sparc64 ]] |
72 |
liloFlag=silo |
then |
73 |
lilo=/sbin/silo |
liloConfig=/etc/silo.conf |
74 |
isx86="" |
bootPrefix=/boot |
75 |
elif [ $ARCH = 's390' -o $ARCH = 's390x' ]; then |
liloFlag=silo |
76 |
liloConfig=/etc/zipl.conf |
lilo=/sbin/silo |
77 |
bootPrefix=/boot |
isx86="" |
78 |
liloFlag=zipl |
elif [[ ${ARCH} = s390 ]] || [[ ${ARCH} = s390x ]] |
79 |
lilo=/sbin/zipl |
then |
80 |
runLilo="yes" |
liloConfig=/etc/zipl.conf |
81 |
isx86="" |
bootPrefix=/boot |
82 |
|
liloFlag=zipl |
83 |
|
lilo=/sbin/zipl |
84 |
|
runLilo="yes" |
85 |
|
isx86="" |
86 |
|
elif [[ ${ARCH} = armv7l ]] |
87 |
|
then |
88 |
|
liloConfig="" |
89 |
|
bootPrefix=/boot |
90 |
|
ubootDir=${UBOOT_DIR:-"/boot/uboot"} |
91 |
|
ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"} |
92 |
|
ubootKList=${UBOOT_KLIST:-"klist.txt"} |
93 |
|
ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"} |
94 |
|
ubootDefaultImage=${UBOOT_UIMAGE:-"uImage"} |
95 |
|
ubootDefaultInitrd=${UBOOT_UINITRD:-"uInitrd"} |
96 |
|
mounted="" |
97 |
|
liloFlag="" |
98 |
|
isx86="" |
99 |
else |
else |
100 |
# this leaves i?86 and x86_64 |
# this leaves i?86 and x86_64 |
101 |
liloConfig=/etc/lilo.conf |
liloConfig=/etc/lilo.conf |
102 |
grubConfig=/boot/grub/grub.conf |
grubConfig=/boot/grub/grub.conf |
103 |
bootPrefix=/boot |
grub2Config=/boot/grub/grub.cfg |
104 |
liloFlag=lilo |
grub2EfiConfig=/boot/grub/grub-efi.cfg |
105 |
isx86="yes" |
bootPrefix=/boot |
106 |
|
liloFlag=lilo |
107 |
|
isx86="yes" |
108 |
fi |
fi |
109 |
|
|
110 |
mode="" |
mode="" |
111 |
version="" |
version="" |
112 |
initrd="" |
initrd="" |
113 |
|
dracut="" |
114 |
|
dracuthostonly="" |
115 |
initrdfile="" |
initrdfile="" |
116 |
moddep="" |
moddep="" |
117 |
verbose="" |
verbose="" |
119 |
package="" |
package="" |
120 |
mbkernel="" |
mbkernel="" |
121 |
mbargs="" |
mbargs="" |
122 |
|
adddracutargs="" |
123 |
|
addplymouthinitrd="" |
124 |
|
|
125 |
usage() { |
usage() |
126 |
echo "Usage: `basename $0` [-v] [--mkinitrd] [--rminitrd]" >&2 |
{ |
127 |
echo " [--initrdfile=<initrd-image>] [--depmod] [--rmmoddep]" >&2 |
echo "Usage: $(basename $0) [-v] [--mkinitrd] [--rminitrd] [--dracut]" >&2 |
128 |
echo " [--kernel-args=<args>] [--remove-args=<args>]" >&2 |
echo " [--initrdfile=<initrd-image>] [--depmod] [--rmmoddep]" >&2 |
129 |
echo " [--banner=<banner>] [--multiboot=multiboot]" >&2 |
echo " [--kernel-args=<args>] [--remove-args=<args>]" >&2 |
130 |
echo " [--mbargs=mbargs] [--make-default]" >&2 |
echo " [--banner=<banner>] [--multiboot=multiboot]" >&2 |
131 |
echo " <--install | --remove | --update> <kernel-version>" >&2 |
echo " [--mbargs=mbargs] [--make-default] [--add-dracut-args]" >&2 |
132 |
echo " (ex: `basename $0` --mkinitrd --depmod --install 2.4.7-2)" >&2 |
echo " [--add-plymouth-initrd]" >&2 |
133 |
exit 1 |
echo " [--host-only]" >&2 |
134 |
|
echo " <--install | --remove | --update> <kernel-version>" >&2 |
135 |
|
echo " (ex: $(basename $0) --mkinitrd --depmod --install 2.4.7-2)" >&2 |
136 |
|
exit 1 |
137 |
} |
} |
138 |
|
|
139 |
install() { |
install() |
140 |
# XXX kernel should be able to be specified also (or work right on ia64) |
{ |
141 |
if [ ! -f $bootPrefix/$kernelName-$version ] ; then |
# XXX kernel should be able to be specified also (or work right on ia64) |
142 |
[ -n "$verbose" ] && echo "kernel for $version does not exist, not running grubby" |
if [ ! -f ${bootPrefix}/${kernelName}-${version} ] |
143 |
return |
then |
144 |
fi |
[[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby" |
145 |
|
return |
146 |
INITRD="" |
fi |
147 |
if [ -f $initrdfile ]; then |
|
148 |
[ -n "$verbose" ] && echo "found $initrdfile and using it with grubby" |
INITRD="" |
149 |
INITRD="--initrd $initrdfile" |
if [ -f ${initrdfile} ] |
150 |
fi |
then |
151 |
|
[[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby" |
152 |
# FIXME: is this a good heuristic to find out if we're on iSeries? |
INITRD="--initrd ${initrdfile}" |
153 |
if [ -d /proc/iSeries ]; then |
|
154 |
[ -n "$verbose" ] && echo "On an iSeries, just making img file" |
if [[ -n ${addplymouthinitrd} ]] |
155 |
if [ -z $initrdfile ]; then |
then |
156 |
[ -n "$verbose" ] && echo "No initrd, just adding system map" |
INITRD="${INITRD} --extra-initrd ${bootPrefix}/initrd-plymouth.img" |
157 |
/sbin/addSystemMap $bootPrefix/System.map-$version $bootPrefix/$kernelName-$version $bootPrefix/vmlinitrd-$version |
fi |
158 |
else |
fi |
159 |
/sbin/addSystemMap $bootPrefix/System.map-$version $bootPrefix/$kernelName-$version $bootPrefix/vmlinux.sm-$version |
|
160 |
/sbin/addRamDisk $initrdfile $bootPrefix/System.map-$version $bootPrefix/vmlinux.sm-$version $bootPrefix/vmlinitrd-$version 2>/dev/null |
# FIXME: is this a good heuristic to find out if we're on iSeries? |
161 |
rm $bootPrefix/vmlinux.sm-$version |
if [ -d /proc/iSeries ] |
162 |
fi |
then |
163 |
return |
[[ -n ${verbose} ]] && echo "On an iSeries, just making img file" |
164 |
fi |
if [[ -z ${initrdfile} ]] |
165 |
|
then |
166 |
# get the root filesystem to use |
[[ -n ${verbose} ]] && echo "No initrd, just adding system map" |
167 |
rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab) |
/sbin/addSystemMap ${bootPrefix}/System.map-${version} ${bootPrefix}/${kernelName}-${version} ${bootPrefix}/vmlinitrd-${version} |
168 |
|
else |
169 |
if [ -n "$mbkernel" -a -n "$cfgLilo" -a "$liloFlag" != "elilo" ]; then |
/sbin/addSystemMap ${bootPrefix}/System.map-${version} ${bootPrefix}/${kernelName}-${version} ${bootPrefix}/vmlinux.sm-${version} |
170 |
[ -n "$verbose" ] && echo "multiboot specified, not updating lilo.conf" |
/sbin/addRamDisk ${initrdfile} ${bootPrefix}/System.map-${version} ${bootPrefix}/vmlinux.sm-${version} ${bootPrefix}/vmlinitrd-${version} 2>/dev/null |
171 |
cfgLilo="" |
rm ${bootPrefix}/vmlinux.sm-${version} |
172 |
fi |
fi |
173 |
|
return |
174 |
if [ -n "$cfgGrub" ]; then |
fi |
175 |
[ -n "$verbose" ] && echo "adding $version to $grubConfig" |
|
176 |
|
# get the root filesystem to use |
177 |
if [ -n "$banner" ]; then |
rootdevice=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/fstab) |
178 |
title="$banner ($version)" |
|
179 |
elif [ -f /etc/mageversion ]; then |
if [[ -n ${mbkernel} ]] && [[ -n ${cfgLilo} ]] && [[ ${liloFlag} != elilo ]] |
180 |
title="Magellan Linux $(< /etc/mageversion) ($version)" |
then |
181 |
else |
[[ -n ${verbose} ]] && echo "multiboot specified, not updating lilo.conf" |
182 |
title="Magellan Linux ($version)" |
cfgLilo="" |
183 |
fi |
fi |
|
$grubby --add-kernel=$bootPrefix/$kernelName-$version \ |
|
|
$INITRD --copy-default $makedefault --title "$title" \ |
|
|
${mbkernel:+--add-multiboot="$mbkernel"} ${mbargs:+--mbargs="$mbargs"} \ |
|
|
--args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$title" |
|
|
else |
|
|
[ -n "$verbose" ] && echo "$grubConfig does not exist, not running grubby" |
|
|
fi |
|
|
|
|
|
if [ -n "$cfgLilo" ]; then |
|
|
[ -n "$verbose" ] && echo "adding $version to $liloConfig" |
|
|
|
|
|
$grubby --add-kernel=$bootPrefix/$kernelName-$version $INITRD \ |
|
|
--copy-default $makedefault --title $version \ |
|
|
${mbkernel:+--add-multiboot="$mbkernel"} ${mbargs:+--mbargs="$mbargs"} \ |
|
|
--args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$version" \ |
|
|
--$liloFlag |
|
|
|
|
|
if [ -n "$runLilo" ]; then |
|
|
[ -n "$verbose" ] && echo "running $lilo" |
|
|
if [ ! -x $lilo ] ; then |
|
|
[ -n "$verbose" ] && echo "$lilo does not exist" |
|
|
else |
|
|
$lilo > /dev/null |
|
|
fi |
|
|
fi |
|
|
else |
|
|
[ -n "$verbose" ] && echo "$liloConfig does not exist, not running grubby" |
|
|
fi |
|
184 |
|
|
185 |
|
if [[ -n ${cfgGrub} ]] |
186 |
|
then |
187 |
|
[[ -n ${verbose} ]] && echo "adding ${version} to ${grubConfig}" |
188 |
|
|
189 |
|
if [[ -n ${banner} ]] |
190 |
|
then |
191 |
|
title="${banner} (${version})" |
192 |
|
elif [ -f /etc/mageversion ] |
193 |
|
then |
194 |
|
title="Magellan Linux $(< /etc/mageversion) (${version})" |
195 |
|
else |
196 |
|
title="Magellan Linux (${version})" |
197 |
|
fi |
198 |
|
${grubby} --grub --add-kernel=${bootPrefix}/${kernelName}-${version} \ |
199 |
|
${INITRD} --copy-default ${makedefault} --title "${title}" \ |
200 |
|
${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \ |
201 |
|
--args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}" |
202 |
|
else |
203 |
|
[[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97" |
204 |
|
fi |
205 |
|
if [[ -n ${cfgGrub2} ]] |
206 |
|
then |
207 |
|
[[ -n ${verbose} ]] && echo "adding ${version} to ${grub2Config}" |
208 |
|
|
209 |
|
if [[ -n ${banner} ]] |
210 |
|
then |
211 |
|
title="${banner} (${version})" |
212 |
|
elif [ -f /etc/mageversion ] |
213 |
|
then |
214 |
|
title="Magellan Linux $(< /etc/mageversion) (${version})" |
215 |
|
else |
216 |
|
title="Magellan Linux (${version})" |
217 |
|
fi |
218 |
|
${grubby} --grub2 -c ${grub2Config} \ |
219 |
|
--add-kernel=${bootPrefix}/${kernelName}-${version} \ |
220 |
|
${INITRD} --copy-default ${makedefault} --title "${title}" \ |
221 |
|
${mbkernel:+--add-multiboot="${mbkernel}"} \ |
222 |
|
${mbargs:+--mbargs="${mbargs}"} \ |
223 |
|
--args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}" |
224 |
|
else |
225 |
|
[[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2" |
226 |
|
fi |
227 |
|
if [[ -n ${cfgGrub2Efi} ]] |
228 |
|
then |
229 |
|
[[ -n ${verbose} ]] && echo "adding ${version} to ${grub2EfiConfig}" |
230 |
|
|
231 |
|
if [[ -n ${banner} ]] |
232 |
|
then |
233 |
|
title="${banner} (${version})" |
234 |
|
elif [ -f /etc/mageversion ] |
235 |
|
then |
236 |
|
title="Magellan Linux $(< /etc/mageversion) (${version})" |
237 |
|
else |
238 |
|
title="Magellan Linux (${version})" |
239 |
|
fi |
240 |
|
${grubby} --grub2 -c ${grub2EfiConfig} \ |
241 |
|
--add-kernel=${bootPrefix}/${kernelName}-${version} \ |
242 |
|
${INITRD} --copy-default ${makedefault} --title "${title}" \ |
243 |
|
${mbkernel:+--add-multiboot="${mbkernel}"} \ |
244 |
|
${mbargs:+--mbargs="${mbargs}"} \ |
245 |
|
--args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${title}" |
246 |
|
else |
247 |
|
[[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby for grub 2 with UEFI" |
248 |
|
fi |
249 |
|
|
250 |
|
if [[ -n ${cfgLilo} ]] |
251 |
|
then |
252 |
|
[[ -n ${verbose} ]] && echo "adding ${version} to ${liloConfig}" |
253 |
|
|
254 |
|
${grubby} --add-kernel=${bootPrefix}/${kernelName}-${version} ${INITRD} \ |
255 |
|
--copy-default ${makedefault} --title ${version} \ |
256 |
|
${mbkernel:+--add-multiboot="${mbkernel}"} ${mbargs:+--mbargs="${mbargs}"} \ |
257 |
|
--args="root=${rootdevice} ${kernargs}" --remove-kernel="TITLE=${version}" \ |
258 |
|
--${liloFlag} |
259 |
|
|
260 |
|
if [[ -n ${runLilo} ]] |
261 |
|
then |
262 |
|
[[ -n ${verbose} ]] && echo "running ${lilo}" |
263 |
|
if [ ! -x ${lilo} ] |
264 |
|
then |
265 |
|
[[ -n ${verbose} ]] && echo "${lilo} does not exist" |
266 |
|
else |
267 |
|
${lilo} > /dev/null |
268 |
|
fi |
269 |
|
fi |
270 |
|
else |
271 |
|
[[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby" |
272 |
|
fi |
273 |
} |
} |
274 |
|
|
275 |
remove() { |
remove() |
276 |
# FIXME: is this a good heuristic to find out if we're on iSeries? |
{ |
277 |
if [ -d /proc/iSeries ]; then |
# FIXME: is this a good heuristic to find out if we're on iSeries? |
278 |
[ -n "$verbose" ] && echo "On an iSeries, remove img file" |
if [ -d /proc/iSeries ] |
279 |
rm -f $bootPrefix/$kernelName-$version.img 2>/dev/null |
then |
280 |
return |
[[ -n ${verbose} ]] && echo "On an iSeries, remove img file" |
281 |
fi |
rm -f ${bootPrefix}/${kernelName}-${version}.img 2>/dev/null |
282 |
|
return |
283 |
if [ -n "$cfgGrub" ]; then |
fi |
284 |
[ -n "$verbose" ] && echo "removing $version from $grubConfig" |
|
285 |
$grubby --remove-kernel=$bootPrefix/$kernelName-$version |
if [[ -n ${cfgGrub} ]] |
286 |
else |
then |
287 |
[ -n "$verbose" ] && echo "$grubConfig does not exist, not running grubby" |
[[ -n ${verbose} ]] && echo "removing ${version} from ${grubConfig}" |
288 |
fi |
${grubby} --grub --remove-kernel=${bootPrefix}/${kernelName}-${version} |
289 |
|
else |
290 |
if [ -n "$cfgLilo" ]; then |
[[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby for grub 0.97" |
291 |
[ -n "$verbose" ] && echo "removing $version from $liloConfig" |
fi |
292 |
$grubby --remove-kernel=$bootPrefix/$kernelName-$version \ |
if [[ -n ${cfgGrub2} ]] |
293 |
--$liloFlag |
then |
294 |
|
[[ -n ${verbose} ]] && echo "removing ${version} from ${grub2Config}" |
295 |
if [ -n "$runLilo" ]; then |
${grubby} --grub2 -c ${grub2Config} \ |
296 |
[ -n "$verbose" ] && echo "running $lilo" |
--remove-kernel=${bootPrefix}/${kernelName}-${version} |
297 |
if [ ! -x $lilo ] ; then |
else |
298 |
[ -n "$verbose" ] && echo "$lilo does not exist" |
[[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby for grub 2" |
299 |
else |
fi |
300 |
$lilo > /dev/null |
if [[ -n ${cfgGrub2Efi} ]] |
301 |
fi |
then |
302 |
fi |
[[ -n ${verbose} ]] && echo "removing ${version} from ${grub2EfiConfig}" |
303 |
else |
${grubby} --grub2 -c ${grub2EfiConfig} \ |
304 |
[ -n "$verbose" ] && echo "$liloConfig does not exist, not running grubby" |
--remove-kernel=${bootPrefix}/${kernelName}-${version} |
305 |
fi |
else |
306 |
|
[[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby grub 2 with UEFI" |
307 |
|
fi |
308 |
|
|
309 |
|
if [[ -n ${cfgLilo} ]] |
310 |
|
then |
311 |
|
[[ -n ${verbose} ]] && echo "removing ${version} from ${liloConfig}" |
312 |
|
${grubby} --remove-kernel=${bootPrefix}/${kernelName}-${version} --${liloFlag} |
313 |
|
|
314 |
|
if [[ -n ${runLilo} ]] |
315 |
|
then |
316 |
|
[[ -n ${verbose} ]] && echo "running ${lilo}" |
317 |
|
if [ ! -x ${lilo} ] |
318 |
|
then |
319 |
|
[[ -n ${verbose} ]] && echo "${lilo} does not exist" |
320 |
|
else |
321 |
|
${lilo} > /dev/null |
322 |
|
fi |
323 |
|
fi |
324 |
|
else |
325 |
|
[[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby" |
326 |
|
fi |
327 |
|
|
328 |
|
if [[ -n ${cfguBoot} ]] |
329 |
|
then |
330 |
|
[[ -n ${verbose} ]] && echo "removing ${version} from ${ubootDir}..." |
331 |
|
|
332 |
|
if [ -f ${ubootDir}/${ubootKList} ] |
333 |
|
then |
334 |
|
tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX) |
335 |
|
curversion=$(tail -n1 ${ubootDir}/${ubootKList}) |
336 |
|
sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList} |
337 |
|
newversion=$(tail -n1 ${tmpKList}) |
338 |
|
if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ] |
339 |
|
then |
340 |
|
if [[ ${curversion} != ${newversion} ]] |
341 |
|
then |
342 |
|
cp -fp ${ubootDir}/uImage-${newversion} ${ubootDir}/${ubootDefaultImage} |
343 |
|
if [ $? -ne 0 ] |
344 |
|
then |
345 |
|
[[ -n ${verbose} ]] && echo "copy uImage-${newversion} error, default kernel not replaced!" && exit |
346 |
|
fi |
347 |
|
cp -fp ${ubootDir}/uInitrd-${newversion} ${ubootDir}/${ubootDefaultInitrd} |
348 |
|
if [ $? -ne 0 ] |
349 |
|
then |
350 |
|
[[ -n ${verbose} ]] && echo "copy uInitrd-${newversion} error, default Initrd not replaced!" && exit |
351 |
|
fi |
352 |
|
fi |
353 |
|
|
354 |
|
[[ -n ${verbose} ]] && echo "removing uImage-${version}" |
355 |
|
if [ -f ${ubootDir}/uImage-${version} ] |
356 |
|
then |
357 |
|
rm -f ${ubootDir}/uImage-${version} |
358 |
|
else |
359 |
|
[[ -n ${verbose} ]] && echo "uImage-${version} did not exist!" |
360 |
|
fi |
361 |
|
|
362 |
|
[[ -n ${verbose} ]] && echo "removing uInitrd-${version}" |
363 |
|
if [ -f ${ubootDir}/uInitrd-${version} ] |
364 |
|
then |
365 |
|
rm -f ${ubootDir}/uInitrd-${version} |
366 |
|
else |
367 |
|
[[ -n ${verbose} ]] && echo "uInitrd-${version} did not exist!" |
368 |
|
fi |
369 |
|
|
370 |
|
mv ${tmpKList} ${ubootDir}/${ubootKList} |
371 |
|
else |
372 |
|
[[ -n ${verbose} ]] && echo "uImage ${newversion} does not exist!" |
373 |
|
[ -f ${tmpKList} ] && rm -f ${tmpKList} |
374 |
|
fi |
375 |
|
else |
376 |
|
[[ -n ${verbose} ]] && echo "No previous kernel version. uBoot images not removed!" |
377 |
|
fi |
378 |
|
else |
379 |
|
[[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not modifying ${ubootDir}" |
380 |
|
fi |
381 |
} |
} |
382 |
|
|
383 |
update() { |
update() |
384 |
if [ -n "$cfgGrub" ]; then |
{ |
385 |
[ -n "$verbose" ] && echo "updating $version from $grubConfig" |
if [ ! -f ${bootPrefix}/${kernelName}-${version} ] |
386 |
$grubby --update-kernel=$bootPrefix/$kernelName-$version \ |
then |
387 |
${kernargs:+--args="$kernargs"} \ |
[[ -n ${verbose} ]] && echo "kernel for ${version} does not exist, not running grubby" |
388 |
${removeargs:+--remove-args="$removeargs"} |
return |
389 |
else |
fi |
390 |
[ -n "$verbose" ] && echo "$grubConfig does not exist, not running grubby" |
|
391 |
fi |
INITRD="" |
392 |
|
if [ -f ${initrdfile} ] |
393 |
if [ -n "$cfgLilo" ]; then |
then |
394 |
[ -n "$verbose" ] && echo "updating $version from $liloConfig" |
[[ -n ${verbose} ]] && echo "found ${initrdfile} and using it with grubby" |
395 |
$grubby --update-kernel=$bootPrefix/$kernelName-$version \ |
INITRD="--initrd ${initrdfile}" |
396 |
${kernargs:+--args="$kernargs"} \ |
|
397 |
${removeargs:+--remove-args="$removeargs"} \ |
if [[ -n ${addplymouthinitrd} ]] |
398 |
--$liloFlag |
then |
399 |
|
INITRD="${INITRD} --extra-initrd ${bootPrefix}/initrd-plymouth.img" |
400 |
if [ -n "$runLilo" ]; then |
fi |
401 |
[ -n "$verbose" ] && echo "running $lilo" |
fi |
402 |
if [ ! -x $lilo ] ; then |
|
403 |
[ -n "$verbose" ] && echo "$lilo does not exist" |
if [[ -n ${cfgGrub} ]] |
404 |
else |
then |
405 |
$lilo > /dev/null |
[[ -n ${verbose} ]] && echo "updating ${version} from ${grubConfig}" |
406 |
fi |
${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \ |
407 |
fi |
${INITRD} \ |
408 |
else |
${kernargs:+--args="${kernargs}"} \ |
409 |
[ -n "$verbose" ] && echo "$liloConfig does not exist, not running grubby" |
${removeargs:+--remove-args="${removeargs}"} |
410 |
fi |
else |
411 |
|
[[ -n ${verbose} ]] && echo "${grubConfig} does not exist, not running grubby" |
412 |
|
fi |
413 |
|
|
414 |
|
if [[ -n ${cfgGrub2} ]] |
415 |
|
then |
416 |
|
[[ -n ${verbose} ]] && echo "updating ${version} from ${grub2Config}" |
417 |
|
${grubby} --grub2 -c ${grub2Config} \ |
418 |
|
--update-kernel=${bootPrefix}/${kernelName}-${version} \ |
419 |
|
${INITRD} \ |
420 |
|
${kernargs:+--args="${kernargs}"} \ |
421 |
|
${removeargs:+--remove-args="${removeargs}"} |
422 |
|
else |
423 |
|
[[ -n ${verbose} ]] && echo "${grub2Config} does not exist, not running grubby" |
424 |
|
fi |
425 |
|
|
426 |
|
if [[ -n ${cfgGrub2Efi} ]] |
427 |
|
then |
428 |
|
[[ -n ${verbose} ]] && echo "updating ${version} from ${grub2EfiConfig}" |
429 |
|
${grubby} --grub2 -c ${grub2EfiConfig} \ |
430 |
|
--update-kernel=${bootPrefix}/${kernelName}-${version} \ |
431 |
|
${INITRD} \ |
432 |
|
${kernargs:+--args="${kernargs}"} \ |
433 |
|
${removeargs:+--remove-args="${removeargs}"} |
434 |
|
else |
435 |
|
[[ -n ${verbose} ]] && echo "${grub2EfiConfig} does not exist, not running grubby" |
436 |
|
fi |
437 |
|
|
438 |
|
if [[ -n ${cfgLilo} ]] |
439 |
|
then |
440 |
|
[[ -n ${verbose} ]] && echo "updating ${version} from ${liloConfig}" |
441 |
|
${grubby} --update-kernel=${bootPrefix}/${kernelName}-${version} \ |
442 |
|
${INITRD} \ |
443 |
|
${kernargs:+--args="${kernargs}"} \ |
444 |
|
${removeargs:+--remove-args="${removeargs}"} \ |
445 |
|
--${liloFlag} |
446 |
|
|
447 |
|
if [[ -n ${runLilo} ]] |
448 |
|
then |
449 |
|
[[ -n ${verbose} ]] && echo "running ${lilo}" |
450 |
|
if [ ! -x ${lilo} ] |
451 |
|
then |
452 |
|
[[ -n ${verbose} ]] && echo "${lilo} does not exist" |
453 |
|
else |
454 |
|
${lilo} > /dev/null |
455 |
|
fi |
456 |
|
fi |
457 |
|
else |
458 |
|
[[ -n ${verbose} ]] && echo "${liloConfig} does not exist, not running grubby" |
459 |
|
fi |
460 |
|
|
461 |
|
if [[ -n ${cfguBoot} ]] |
462 |
|
then |
463 |
|
[[ -n ${verbose} ]] && echo "adding $version to ${ubootDir}..." |
464 |
|
|
465 |
|
[[ -n ${verbose} ]] && echo "creating uImage-${version}" |
466 |
|
mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 \ |
467 |
|
-n ${version} -d ${bootPrefix}/${kernelName}-${version} ${ubootDir}/uImage-${version} |
468 |
|
|
469 |
|
[[ -n ${verbose} ]] && echo "creating uInitrd-${version}" |
470 |
|
mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 \ |
471 |
|
-n initramfs -d ${initrdfile} ${ubootDir}/uInitrd-${version} |
472 |
|
|
473 |
|
if [ -f ${ubootDir}/uImage-${version} ] && [ -f ${ubootDir}/uInitrd-${version} ] |
474 |
|
then |
475 |
|
cp -fp ${ubootDir}/uImage-${version} ${ubootDir}/${ubootDefaultImage} |
476 |
|
if [ $? -ne 0 ] |
477 |
|
then |
478 |
|
[[ -n ${verbose} ]] && echo "copy uImage-${version} error, kernel not installed!" && exit |
479 |
|
fi |
480 |
|
cp -fp ${ubootDir}/uInitrd-${version} ${ubootDir}/${ubootDefaultInitrd} |
481 |
|
if [ $? -ne 0 ] |
482 |
|
then |
483 |
|
[[ -n ${verbose} ]] && echo "copy uInitrd-${version} error, kernel not installed!" && exit |
484 |
|
fi |
485 |
|
echo ${version} >> ${ubootDir}/${ubootKList} |
486 |
|
else |
487 |
|
[[ -n ${verbose} ]] && echo "cannot make ${version} the default" |
488 |
|
fi |
489 |
|
else |
490 |
|
[[ -n ${verbose} ]] && echo "${ubootScript} does not exist, not setting up ${ubootDir}" |
491 |
|
fi |
492 |
} |
} |
493 |
|
|
494 |
mkinitrd() { |
mkinitrd() |
495 |
[ -n "$verbose" ] && echo "creating initrd $initrdfile using $version" |
{ |
496 |
/sbin/mkinitrd --allow-missing -f $initrdfile $version |
if [[ -n ${dracut} ]] |
497 |
rc=$? |
then |
498 |
if [ $rc != 0 ]; then |
tool="/sbin/dracut ${dracuthostonly} -f ${initrdfile} ${version}" |
499 |
echo "mkinitrd failed" >&2 |
else |
500 |
exit 1 |
tool="/sbin/mkinitrd --allow-missing -f ${initrdfile} ${version}" |
501 |
fi |
fi |
502 |
|
[[ -n ${verbose} ]] && echo "creating initrd ${initrdfile} using ${version}" |
503 |
|
${tool} |
504 |
|
rc=$? |
505 |
|
if [ ${rc} != 0 ] |
506 |
|
then |
507 |
|
echo "mkinitrd failed" >&2 |
508 |
|
exit 1 |
509 |
|
fi |
510 |
} |
} |
511 |
|
|
512 |
rminitrd() { |
rminitrd() |
513 |
[ -n "$verbose" ] && echo "removing initrd $initrdfile" |
{ |
514 |
[ -f $initrdfile ] && rm -f $initrdfile |
[[ -n ${verbose} ]] && echo "removing initrd ${initrdfile}" |
515 |
|
[ -f ${initrdfile} ] && rm -f ${initrdfile} |
516 |
} |
} |
517 |
|
|
518 |
doDepmod() { |
doDepmod() |
519 |
[ -n "$verbose" ] && echo "running depmod for $version" |
{ |
520 |
depmod -ae -F /boot/System.map-$version $version |
[[ -n ${verbose} ]] && echo "running depmod for ${version}" |
521 |
|
depmod -ae -F /boot/System.map-${version} ${version} |
522 |
} |
} |
523 |
|
|
524 |
doRmmoddep() { |
doRmmoddep() |
525 |
[ -n "$verbose" ] && echo "removing modules.dep info for $version" |
{ |
526 |
[ -d /lib/modules/$version ] && rm -f /lib/modules/$version/modules.* |
[[ -n ${verbose} ]] && echo "removing modules.dep info for ${version}" |
527 |
|
[ -d /lib/modules/${version} ] && rm -f /lib/modules/${version}/modules.* |
528 |
} |
} |
529 |
|
|
530 |
|
|
531 |
while [ $# -gt 0 ]; do |
while [ $# -gt 0 ] |
532 |
case $1 in |
do |
533 |
--mkinitrd) |
case $1 in |
534 |
initrd="make" |
--mkinitrd) |
535 |
;; |
initrd="make" |
536 |
|
;; |
537 |
--rminitrd) |
|
538 |
initrd="remove" |
--rminitrd) |
539 |
;; |
initrd="remove" |
540 |
|
;; |
541 |
--initrdfile*) |
|
542 |
if echo $1 | grep '=' >/dev/null ; then |
--dracut) |
543 |
initrdfile=`echo $1 | sed 's/^--initrdfile=//'` |
dracut=--dracut |
544 |
else |
;; |
545 |
initrdfile=$2 |
|
546 |
shift |
--host-only) |
547 |
fi |
dracuthostonly=-H |
548 |
;; |
;; |
549 |
|
|
550 |
--kernel-args*) |
--initrdfile*) |
551 |
if echo $1 | grep '=' >/dev/null ; then |
if echo $1 | grep '=' >/dev/null |
552 |
kernargs=`echo $1 | sed 's/^--kernel-args=//'` |
then |
553 |
else |
initrdfile=$(echo $1 | sed 's/^--initrdfile=//') |
554 |
kernargs=$2 |
else |
555 |
shift |
initrdfile=$2 |
556 |
fi |
shift |
557 |
;; |
fi |
558 |
|
;; |
559 |
--remove-args*) |
|
560 |
if echo $1 | grep '=' >/dev/null ; then |
--kernel-args*) |
561 |
removeargs=`echo $1 | sed 's/^--remove-args=//'` |
if echo $1 | grep '=' >/dev/null |
562 |
else |
then |
563 |
removeargs=$2 |
kernargs=$(echo $1 | sed 's/^--kernel-args=//') |
564 |
shift |
else |
565 |
fi |
kernargs=$2 |
566 |
;; |
shift |
567 |
|
fi |
568 |
--banner*) |
;; |
569 |
if echo $1 | grep '=' >/dev/null ; then |
|
570 |
banner=`echo $1 | sed 's/^--banner=//'` |
--remove-args*) |
571 |
else |
if echo $1 | grep '=' >/dev/null |
572 |
banner=$2 |
then |
573 |
shift |
removeargs=$(echo $1 | sed 's/^--remove-args=//') |
574 |
fi |
else |
575 |
;; |
removeargs=$2 |
576 |
|
shift |
577 |
--multiboot*) |
fi |
578 |
if echo $1 |grep '=' >/dev/null; then |
;; |
579 |
mbkernel=`echo $1 | sed 's/^--multiboot=//'` |
|
580 |
else |
--banner*) |
581 |
# can't really support having an optional second arg here |
if echo $1 | grep '=' >/dev/null |
582 |
# sorry! |
then |
583 |
mbkernel="/boot/xen.gz" |
banner=$(echo $1 | sed 's/^--banner=//') |
584 |
fi |
else |
585 |
;; |
banner=$2 |
586 |
|
shift |
587 |
--mbargs*) |
fi |
588 |
if echo $1 |grep '=' >/dev/null; then |
;; |
589 |
mbargs=`echo $1 | sed 's/^--mbargs=//'` |
|
590 |
else |
--multiboot*) |
591 |
mbargs="$2" |
if echo $1 |grep '=' >/dev/null |
592 |
shift |
then |
593 |
fi |
mbkernel=$(echo $1 | sed 's/^--multiboot=//') |
594 |
;; |
else |
595 |
|
# can't really support having an optional second arg here |
596 |
--depmod) |
# sorry! |
597 |
moddep="make" |
mbkernel="/boot/xen.gz" |
598 |
;; |
fi |
599 |
|
;; |
600 |
--rmmoddep) |
|
601 |
moddep="remove" |
--mbargs*) |
602 |
;; |
if echo $1 |grep '=' >/dev/null |
603 |
|
then |
604 |
--make-default) |
mbargs=$(echo $1 | sed 's/^--mbargs=//') |
605 |
makedefault="--make-default" |
else |
606 |
;; |
mbargs="$2" |
607 |
|
shift |
608 |
--package) |
fi |
609 |
if echo $1 | grep '=' >/dev/null ; then |
;; |
610 |
package=`echo $1 | sed 's/^--package=//'` |
|
611 |
else |
--depmod) |
612 |
package=$2 |
moddep="make" |
613 |
shift |
;; |
614 |
fi |
|
615 |
;; |
--rmmoddep) |
616 |
|
moddep="remove" |
617 |
-v) |
;; |
618 |
verbose=-v |
|
619 |
;; |
--make-default) |
620 |
|
makedefault="--make-default" |
621 |
*) |
;; |
622 |
if [ -z "$mode" ]; then |
|
623 |
mode=$1 |
--package) |
624 |
elif [ -z "$version" ]; then |
if echo $1 | grep '=' >/dev/null |
625 |
version=$1 |
then |
626 |
else |
package=$(echo $1 | sed 's/^--package=//') |
627 |
usage |
else |
628 |
fi |
package=$2 |
629 |
;; |
shift |
630 |
esac |
fi |
631 |
|
;; |
632 |
|
|
633 |
|
--add-dracut-args) |
634 |
|
adddracutargs=--add-dracut-args |
635 |
|
;; |
636 |
|
|
637 |
|
--add-plymouth-initrd) |
638 |
|
addplymouthinitrd=--add-plymouth-initrd |
639 |
|
;; |
640 |
|
|
641 |
|
-v) |
642 |
|
verbose=-v |
643 |
|
;; |
644 |
|
|
645 |
|
*) |
646 |
|
if [[ -z ${mode} ]] |
647 |
|
then |
648 |
|
mode=$1 |
649 |
|
elif [[ -z ${version} ]] |
650 |
|
then |
651 |
|
version=$1 |
652 |
|
else |
653 |
|
usage |
654 |
|
fi |
655 |
|
;; |
656 |
|
esac |
657 |
|
|
658 |
shift |
shift |
659 |
done |
done |
660 |
|
|
661 |
# make sure the mode is valid |
# make sure the mode is valid |
662 |
if [ "$mode" != "--install" -a "$mode" != "--remove" -a "$mode" != "--update" ] ; then |
if [[ ${mode} != --install ]] && [[ ${mode} != --remove ]] && [[ ${mode} != --update ]] |
663 |
usage |
then |
664 |
|
usage |
665 |
fi |
fi |
666 |
|
|
667 |
if [ -z "$version" ]; then |
if [[ -z ${version} ]] |
668 |
usage |
then |
669 |
|
usage |
670 |
fi |
fi |
671 |
|
|
672 |
if [ "$mode" != "--install" -a "$makedefault" ]; then |
if [ "${mode}" != "--install" -a "${makedefault}" ] |
673 |
usage |
then |
674 |
|
usage |
675 |
fi |
fi |
676 |
|
|
677 |
kernelmajor=`echo $kernel | cut -d . -f 1,2` |
kernelmajor=$(echo ${kernel} | cut -d . -f 1,2) |
678 |
|
|
679 |
# kernel image for 2.4 is vmlinux |
# kernel image for 2.4 is kernel |
680 |
if [ $ARCH = 'ppc64' -o $ARCH = 'ppc' ]; then |
if [[ ${ARCH} = ppc64 ]] || [[ ${ARCH} = ppc ]] |
681 |
if [ "$kernelmajor" == "2.4" ]; then |
then |
682 |
kernelName=kernel |
if [[ ${kernelmajor} = 2.4 ]] |
683 |
fi |
then |
684 |
|
kernelName=kernel |
685 |
|
fi |
686 |
fi |
fi |
687 |
|
|
|
|
|
688 |
# set the initrd file based on arch; ia64 is the only currently known oddball |
# set the initrd file based on arch; ia64 is the only currently known oddball |
689 |
if [ -z "$initrdfile" ]; then |
if [[ -z ${initrdfile} ]] |
690 |
INITRD_NAME_PREFIX="initrd" |
then |
691 |
|
INITRD_NAME_PREFIX="initrd" |
692 |
if [ `uname -m` = "ia64" ]; then |
if [[ -n ${dracut} ]] |
693 |
initrdfile="/boot/efi/EFI/redhat/$INITRD_NAME_PREFIX-$version.img" |
then |
694 |
else |
INITRD_NAME_PREFIX="initramfs" |
695 |
initrdfile="/boot/$INITRD_NAME_PREFIX-$version.img" |
fi |
|
fi |
|
|
|
|
|
fi |
|
|
[ -n "$verbose" ] && echo "initrdfile is $initrdfile" |
|
696 |
|
|
697 |
# set this as the default if we have the package and it matches |
if [[ $(uname -m) = ia64 ]] |
698 |
if [ "$mode" == "--install" -a "$UPDATEDEFAULT" == "yes" -a -n "$package" -a -n "$DEFAULTKERNEL" -a "$package" == "$DEFAULTKERNEL" ]; then |
then |
699 |
makedefault="--make-default" |
initrdfile="/boot/efi/EFI/redhat/${INITRD_NAME_PREFIX}-${version}.img" |
700 |
[ -n "$verbose" ] && echo "making it the default based on config" |
else |
701 |
|
initrdfile="/boot/${INITRD_NAME_PREFIX}-${version}.img" |
702 |
|
fi |
703 |
fi |
fi |
704 |
|
[[ -n ${verbose} ]] && echo "initrdfile is ${initrdfile}" |
705 |
|
|
706 |
if [ "$moddep" == "make" ]; then |
# add dracut i18n, keyboard and plymouth kernel args if requested |
707 |
doDepmod |
if [[ -n ${dracut} ]] || [[ -n ${adddracutargs} ]] |
708 |
elif [ "$moddep" == "remove" ]; then |
then |
709 |
doRmmoddep |
[ -r /etc/conf.d/keymap ] && . /etc/conf.d/keymap |
710 |
fi |
[ -r /etc/conf.d/consolefont ] && . /etc/conf.d/consolefont |
711 |
|
|
712 |
|
if [[ -n ${KEYMAP} ]] |
713 |
|
then |
714 |
|
kernargs="${kernargs} KEYTABLE=${KEYMAP}" |
715 |
|
fi |
716 |
|
|
717 |
if [ "$initrd" == "make" ]; then |
if [[ -n ${CONSOLEFONT} ]] |
718 |
mkinitrd |
then |
719 |
elif [ "$initrd" == "remove" ]; then |
kernargs="${kernargs} SYSFONT=${CONSOLEFONT}" |
720 |
rminitrd |
fi |
721 |
fi |
fi |
722 |
|
|
723 |
if [ ! -x $grubby ] ; then |
# set this as the default if we have the package and it matches |
724 |
[ -n "$verbose" ] && echo "$grubby does not exist" |
if [[ ${mode} = --install ]] && [[ ${UPDATEDEFAULT} = yes ]] && [[ -n ${package} ]] && |
725 |
exit 0 |
[[ -n ${DEFAULTKERNEL} ]] && [[ ${package} = ${DEFAULTKERNEL} ]] |
726 |
|
then |
727 |
|
makedefault="--make-default" |
728 |
|
[[ -n ${verbose} ]] && echo "making it the default based on config" |
729 |
|
fi |
730 |
|
|
731 |
|
if [[ ${moddep} = make ]] |
732 |
|
then |
733 |
|
doDepmod |
734 |
|
elif [[ ${moddep} = remove ]] |
735 |
|
then |
736 |
|
doRmmoddep |
737 |
|
fi |
738 |
|
|
739 |
|
if [[ ${initrd} = make ]] |
740 |
|
then |
741 |
|
mkinitrd |
742 |
|
elif [[ ${initrd} = remove ]] |
743 |
|
then |
744 |
|
rminitrd |
745 |
|
fi |
746 |
|
|
747 |
|
if [ ! -x ${grubby} ] |
748 |
|
then |
749 |
|
[[ -n ${verbose} ]] && echo "${grubby} does not exist" |
750 |
|
exit 0 |
751 |
|
fi |
752 |
|
|
753 |
|
[[ -n ${grubConfig} ]] && [ -f ${grubConfig} ] && cfgGrub=1 |
754 |
|
[[ -n ${grub2Config} ]] && [ -f ${grub2Config} ] && cfgGrub2=1 |
755 |
|
[[ -n ${grub2EfiConfig} ]] && [ -f ${grub2EfiConfig} ] && cfgGrub2Efi=1 |
756 |
|
[[ -n ${liloConfig} ]] && [ -f ${liloConfig} ] && cfgLilo=1 |
757 |
|
|
758 |
|
# if we have a uBoot directory, check if it is mounted. |
759 |
|
# if not, mount it. Then check if a boot script exists. |
760 |
|
if [[ -n ${ubootDir} ]] |
761 |
|
then |
762 |
|
mountEntry=$(mount | grep ${ubootDir}) |
763 |
|
if [[ -z ${mountEntry} ]] |
764 |
|
then |
765 |
|
mount ${ubootDevice} ${ubootDir} |
766 |
|
mounted=1 |
767 |
|
fi |
768 |
|
[ -f ${ubootScript} ] && cfguBoot=1 |
769 |
fi |
fi |
770 |
|
|
|
[ -n "$grubConfig" ] && [ -f "$grubConfig" ] && cfgGrub=1; |
|
|
[ -n "$liloConfig" ] && [ -f "$liloConfig" ] && cfgLilo=1; |
|
|
|
|
771 |
# if we have a lilo config on an x86 box, see if the default boot loader |
# if we have a lilo config on an x86 box, see if the default boot loader |
772 |
# is lilo to determine if it should be run |
# is lilo to determine if it should be run |
773 |
if [ -n "$cfgLilo" -a -n "$isx86" ]; then |
if [[ -n ${cfgLilo} ]] && [[ -n ${isx86} ]] |
774 |
runLilo=$($grubby --bootloader-probe | grep lilo) |
then |
775 |
|
runLilo=$(${grubby} --bootloader-probe | grep lilo) |
776 |
fi |
fi |
777 |
|
|
778 |
if [ "$mode" == "--install" ]; then |
if [[ ${mode} = --install ]] |
779 |
install |
then |
780 |
elif [ "$mode" == "--remove" ]; then |
install |
781 |
remove |
elif [[ ${mode} = --remove ]] |
782 |
elif [ "$mode" == "--update" ]; then |
then |
783 |
update |
remove |
784 |
|
elif [[ ${mode} = --update ]] |
785 |
|
then |
786 |
|
update |
787 |
fi |
fi |
788 |
|
|
789 |
exit 0 |
exit 0 |