Files
new_install/operation/copy_kernels.sh
fling 570574b1e5 bug 4.3/875
modified:   copy_kernels.sh
2011-04-19 12:47:49 +08:00

101 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
#
# DESCRIPTION: copying kernel and modules to system
#
# SCRIPT NAME: copy_kernel.sh
#
# Input: stdin
# NULL
#
# Output:
# NULL
# Return value:
# 1 kernel directory/modules directory/initrd.gz/makeinitrd doesn't exist
#
# AUTHOR: Qin Bo
#
# EMAIL: bqin@linx-info.com
#
# DATE: 2010-08-23
#
# HISTORY:
# REVISOR DATE MODIFICATION
# Qin Bo 2010-08-23 create
#
#
#
source ./functions
main ()
{
info "copy $MODULES/* to $TARGET/lib/modules/"
if [ -d "$MODULES" ];then
cp -r "$MODULES"/* "$TARGET/lib/modules/" 2>>$DEV_LOG
else
err "$MODULES directory doesn't exist "
exit 1
fi
case `uname -m` in
x86_64 | i686)
info "copy $KERNELS/* to $TARGET/boot/"
if [ -d "$KERNELS" ];then
cp -r "$KERNELS"/* "$TARGET/boot/" 2>>$DEV_LOG
else
err "$KERNELS directory doesn't exist "
exit 1
fi
info "copy $INITRD/initrd.gz to $TARGET/boot/initrd.gz.old"
if [ -e "$INITRD/initrd.gz" ];then
cp "$INITRD/initrd.gz" "$TARGET/boot/initrd.gz.old" 2>>$DEV_LOG
else
err "$INITRD/initrd.gz doesn't exist "
exit 1
fi
info "copy $FIRMWARE to $TARGET/lib/"
if [ -d $FIRMWARE ];then
cp -r "$FIRMWARE" $TARGET/lib/
fi
info "runing makeinitrd"
if [ -e ./makeinitrd ];then
./makeinitrd 2>>$DEV_LOG
else
err "makeinitrd doesn't exist "
exit 1
fi
;;
ia64)
info "copy $KERNELS/* to /tmp/tmppoint"
if [ -d "$KERNELS" ];then
cp -r "$KERNELS"/* "/tmp/tmppoint/" 2>>$DEV_LOG
else
err "$KERNELS directory doesn't exist "
exit 1
fi
info "copy $FIRMWARE to $TARGET/lib/"
if [ -d $FIRMWARE ];then
cp -r "$FIRMWARE" $TARGET/lib/
fi
;;
*)
err "architecture is not allowing"
exit 1
;;
esac
}
KERNELS="/Rocky/kernels"
MODULES="/Rocky/modules"
FIRMWARE="/Rocky/firmware"
INITRD="/Rocky/initrd"
main "$@"