25 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
26 |
# |
# |
27 |
|
|
28 |
|
read_os_release() |
29 |
|
{ |
30 |
|
local NAME |
31 |
|
local ID |
32 |
|
local Version |
33 |
|
local Version_ID |
34 |
|
local PRETTY_NAME |
35 |
|
local ANSI_COLOR |
36 |
|
local CPE_NAME |
37 |
|
|
38 |
|
if [[ -f /etc/os-release ]] |
39 |
|
then |
40 |
|
source /etc/os-release |
41 |
|
|
42 |
|
case $1 in |
43 |
|
name) echo "${NAME}" ;; |
44 |
|
id) echo "${ID}" ;; |
45 |
|
version) echo "${Version}" ;; |
46 |
|
version_id) echo "${Version_ID}" ;; |
47 |
|
pretty_name) echo "${PRETTY_NAME}" ;; |
48 |
|
ansi_color) echo "${ANSI_COLOR}" ;; |
49 |
|
cpe_name) echo "${CPE_NAME}" ;; |
50 |
|
esac |
51 |
|
fi |
52 |
|
} |
53 |
|
|
54 |
PATH=/sbin:/bin:$PATH |
PATH=/sbin:/bin:$PATH |
55 |
|
|
56 |
lilo=/sbin/lilo |
lilo=/sbin/lilo |
91 |
elif [[ ${ARCH} = ppc64 ]] || [[ ${ARCH} = ppc ]] |
elif [[ ${ARCH} = ppc64 ]] || [[ ${ARCH} = ppc ]] |
92 |
then |
then |
93 |
liloConfig=/etc/yaboot.conf |
liloConfig=/etc/yaboot.conf |
94 |
|
grub2Config=/boot/grub/grub.cfg |
95 |
bootPrefix=/boot |
bootPrefix=/boot |
96 |
lilo=/sbin/ybin |
lilo=/sbin/ybin |
97 |
liloFlag=yaboot |
liloFlag=yaboot |
112 |
lilo=/sbin/zipl |
lilo=/sbin/zipl |
113 |
runLilo="yes" |
runLilo="yes" |
114 |
isx86="" |
isx86="" |
115 |
elif [[ ${ARCH} = armv7l ]] || [[ ${ARCH} = armv7hl ]] || [[ ${ARCH} = armv5tel ]] |
elif [[ ${ARCH} =~ armv[5|7].*l ]] |
116 |
then |
then |
|
machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//') |
|
117 |
liloConfig="" |
liloConfig="" |
118 |
bootPrefix=/boot |
bootPrefix=/boot |
119 |
ubootDir=${UBOOT_DIR:-"/boot/uboot"} |
ubootDir=${UBOOT_DIR:-"/boot"} |
120 |
ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"} |
ubootScript=$ubootDir/${UBOOT_SCR:-"boot.scr"} |
121 |
ubootKList=${UBOOT_KLIST:-"klist.txt"} |
ubootKList=${UBOOT_KLIST:-"klist.txt"} |
122 |
ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"} |
ubootDevice=/dev/${UBOOT_DEVICE:-"mmcblk0p1"} |
125 |
mounted="" |
mounted="" |
126 |
liloFlag="" |
liloFlag="" |
127 |
isx86="" |
isx86="" |
128 |
if [[ ${machine} == "OMAP3 Beagle Board" ]] || [[ ${machine} == "OMAP4 Panda board" ]] |
if [[ -z ${UBOOT_IMGADDR} ]] |
129 |
then |
then |
130 |
ubootAddress=0x80008000 |
machine=${MACHINE:-$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')} |
131 |
|
# A few machines use an alternate kernel load address |
132 |
|
if [[ "${machine}" =~ ^OMAP[3|4].* ]] |
133 |
|
then |
134 |
|
ubootAddress=0x80008000 |
135 |
|
elif [[ "${machine}" =~ ^Efika\ MX.* ]] |
136 |
|
then |
137 |
|
ubootAddress=0x90008000 |
138 |
|
else |
139 |
|
ubootAddress=0x00008000 |
140 |
|
fi |
141 |
else |
else |
142 |
ubootAddress=0x00008000 |
ubootAddress="${UBOOT_IMGADDR}" |
143 |
fi |
fi |
144 |
else |
else |
145 |
# this leaves i?86 and x86_64 |
# this leaves i?86 and x86_64 |
238 |
elif [ -f /etc/mageversion ] |
elif [ -f /etc/mageversion ] |
239 |
then |
then |
240 |
title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" |
title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" |
241 |
|
elif [[ $(read_os_release id) = magellan ]] |
242 |
|
then |
243 |
|
title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]" |
244 |
else |
else |
245 |
title="Magellan Linux [ ${version} ]" |
title="Magellan Linux [ ${version} ]" |
246 |
fi |
fi |
262 |
elif [ -f /etc/mageversion ] |
elif [ -f /etc/mageversion ] |
263 |
then |
then |
264 |
title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" |
title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" |
265 |
|
elif [[ $(read_os_release id) = magellan ]] |
266 |
|
then |
267 |
|
title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]" |
268 |
else |
else |
269 |
title="Magellan Linux [ ${version} ]" |
title="Magellan Linux [ ${version} ]" |
270 |
fi |
fi |
287 |
elif [ -f /etc/mageversion ] |
elif [ -f /etc/mageversion ] |
288 |
then |
then |
289 |
title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" |
title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" |
290 |
|
elif [[ $(read_os_release id) = magellan ]] |
291 |
|
then |
292 |
|
title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]" |
293 |
else |
else |
294 |
title="Magellan Linux [ ${version} ]" |
title="Magellan Linux [ ${version} ]" |
295 |
fi |
fi |
337 |
elif [ -f /etc/mageversion ] |
elif [ -f /etc/mageversion ] |
338 |
then |
then |
339 |
title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" |
title="Magellan Linux $(< /etc/mageversion) [ ${version} ]" |
340 |
|
elif [[ $(read_os_release id) = magellan ]] |
341 |
|
then |
342 |
|
title="$(read_os_release name) $(read_os_release version_id) [ ${version} ]" |
343 |
else |
else |
344 |
title="Magellan Linux [ ${version} ]" |
title="Magellan Linux [ ${version} ]" |
345 |
fi |
fi |
415 |
then |
then |
416 |
tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX) |
tmpKList=$(mktemp ${ubootDir}/${ubootKList}.XXXX) |
417 |
curversion=$(tail -n1 ${ubootDir}/${ubootKList}) |
curversion=$(tail -n1 ${ubootDir}/${ubootKList}) |
418 |
sed "/${version}/d" ${ubootDir}/${ubootKList} > ${tmpKList} |
sed "/$version$/d" ${ubootDir}/${ubootKList} > ${tmpKList} |
419 |
newversion=$(tail -n1 ${tmpKList}) |
newversion=$(tail -n1 ${tmpKList}) |
420 |
if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ] |
if [ -f ${ubootDir}/uImage-${newversion} ] && [ -f ${ubootDir}/uInitrd-${newversion} ] |
421 |
then |
then |