282 |
# setup modprobe conf too |
# setup modprobe conf too |
283 |
[[ ! -d $(dirname ${uvesafb_config}) ]] && install -d $(dirname ${uvesafb_config}) |
[[ ! -d $(dirname ${uvesafb_config}) ]] && install -d $(dirname ${uvesafb_config}) |
284 |
cat > ${uvesafb_config} << EOF |
cat > ${uvesafb_config} << EOF |
285 |
# This file sets the parameters for uvesafb module. |
# This file sets the parameters for uvesafb module. |
286 |
# The following format should be used: |
# The following format should be used: |
287 |
# options uvesafb mode_option=<xres>x<yres>[-<bpp>][@<refresh>] scroll=<ywrap|ypan|redraw> ... |
# options uvesafb mode_option=<xres>x<yres>[-<bpp>][@<refresh>] scroll=<ywrap|ypan|redraw> ... |
288 |
# |
# |
315 |
${chroot} mkinitrd -f ${initrd} ${kernel} |
${chroot} mkinitrd -f ${initrd} ${kernel} |
316 |
} |
} |
317 |
|
|
318 |
|
is_mounted() |
319 |
|
{ |
320 |
|
local item |
321 |
|
local mount |
322 |
|
local method |
323 |
|
method="$1" |
324 |
|
item="$2" |
325 |
|
|
326 |
|
[ -e /proc/mounts ] || return 1 |
327 |
|
|
328 |
|
case ${method} in |
329 |
|
--location) mount="$(grep "[[:space:]]${item}[[:space:]]" /proc/mounts | cut -d ' ' -f2)" ;; |
330 |
|
--device) mount="$(grep "^${item}[[:space:]]" /proc/mounts | cut -d ' ' -f1)" ;; |
331 |
|
--filesystem) mount="$(grep "[[:space:]]${item}[[:space:]]" /proc/mounts | cut -d ' ' -f3)" ;; |
332 |
|
*) echo "unknown method '${method}'"; return 1 ;; |
333 |
|
esac |
334 |
|
[[ ${mount} != ${item} ]] && return 1 |
335 |
|
|
336 |
|
return 0 |
337 |
|
} |
338 |
|
|
339 |
|
iface_has_link() |
340 |
|
{ |
341 |
|
local interface="$1" |
342 |
|
local flags |
343 |
|
|
344 |
|
[[ -n ${interface} ]] || return 2 |
345 |
|
interface="/sys/class/net/${interface}" |
346 |
|
[[ -d ${interface} ]] || return 2 |
347 |
|
flags=$(cat ${interface}/flags) |
348 |
|
echo $((${flags}|0x41)) > ${interface}/flags # 0x41: IFF_UP|IFF_RUNNING |
349 |
|
[[ $(cat ${interface}/carrier) = 1 ]] || return 1 |
350 |
|
} |
351 |
|
|
352 |
chrooted() |
chrooted() |
353 |
{ |
{ |
354 |
local cmd="$@" |
local cmd="$@" |
355 |
|
|
356 |
mount -t sysfs sysfs ${INSTALL_ROOT}/sys |
is_mounted --location ${INSTALLROOT}/sys || mount -t sysfs sysfs ${INSTALLROOT}/sys |
357 |
mount -t proc proc ${INSTALL_ROOT}/proc |
is_mounted --location ${INSTALLROOT}/proc || mount -t proc proc ${INSTALLROOT}/proc |
358 |
mount -o bind /dev ${INSTALL_ROOT}/dev |
is_mounted --location ${INSTALLROOT}/dev || mount -o bind /dev ${INSTALLROOT}/dev |
359 |
|
|
360 |
chroot ${INSTALL_ROOT} ${cmd} |
chroot ${INSTALLROOT} ${cmd} |
361 |
|
|
362 |
umount ${INSTALL_ROOT}/dev |
is_mounted --location ${INSTALLROOT}/dev && umount ${INSTALLROOT}/dev |
363 |
umount ${INSTALL_ROOT}/proc |
is_mounted --location ${INSTALLROOT}/proc && umount ${INSTALLROOT}/proc |
364 |
umount ${INSTALL_ROOT}/sys |
is_mounted --location ${INSTALLROOT}/sys && umount ${INSTALLROOT}/sys |
365 |
} |
} |