resolved a bug creating chroot
This commit is contained in:
parent
48b451c6b8
commit
1b9bb7ed50
@ -169,34 +169,7 @@ function createchroot()
|
||||
fi
|
||||
fi
|
||||
|
||||
# Create Build path
|
||||
if ! [ -d "$BUILD_PATH" ];then
|
||||
warning "Build path ( $BUILD_PATH ) does not exists, do you want i create it ? [Y|n] "
|
||||
read yn
|
||||
if [ -z $yn ] || [ $yn = "Y" ] || [ $yn = "y" ];then
|
||||
title "Creating $BUILD_PATH"
|
||||
/bin/mkdir -p "$BUILD_PATH/usr/bin" "$BUILD_PATH/usr/lib/binfmt.d"
|
||||
if [ $? -ne 0 ];then
|
||||
error "line $LINENO can't create $BUILD_PATH : exiting"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
info "Build path exists"
|
||||
fi
|
||||
#Copying qemu
|
||||
/bin/cp /bin/qemu-arm-static "$BUILD_PATH/usr/bin/"
|
||||
if [ $? -ne 0 ];then
|
||||
error "line $LINENO can't copy /bin/qemu-user-static to $BUILD_PATH/usr/bin/ : exiting"
|
||||
exit 1
|
||||
fi
|
||||
/bin/cp /usr/lib/binfmt.d/qemu-arm-static.conf "$BUILD_PATH/usr/lib/binfmt.d"
|
||||
if [ $? -ne 0 ];then
|
||||
error "line $LINENO can't copy /usr/lib/binfmt.d/qemu-arm-static.conf to $BUILD_PATH/usr/lib/binfmt.d : exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# adding Mageia repositories
|
||||
@ -230,6 +203,25 @@ function updatemirror()
|
||||
|
||||
function installbasesystem()
|
||||
{
|
||||
|
||||
# Create Build path
|
||||
if ! [ -d "$BUILD_PATH" ];then
|
||||
warning "Build path ( $BUILD_PATH ) does not exists, do you want i create it ? [Y|n] "
|
||||
read yn
|
||||
if [ -z $yn ] || [ $yn = "Y" ] || [ $yn = "y" ];then
|
||||
title "Creating $BUILD_PATH"
|
||||
/bin/mkdir -p "$BUILD_PATH/usr/bin" "$BUILD_PATH/usr/lib/binfmt.d"
|
||||
if [ $? -ne 0 ];then
|
||||
error "line $LINENO can't create $BUILD_PATH : exiting"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
info "Build path exists"
|
||||
fi
|
||||
|
||||
title "installing basesystem"
|
||||
/sbin/urpmi --urpmi-root "$BUILD_PATH" --ignorearch --no-verify-rpm --auto --split-level 200 --split-length 200 shadow-utils basesystem-minimal
|
||||
if [ $? -ne 0 ];then
|
||||
@ -251,12 +243,27 @@ function installbasesystem()
|
||||
function preparechroot()
|
||||
{
|
||||
title "Preparing chrooting in $BUILD_PATH"
|
||||
|
||||
#Copying qemu
|
||||
|
||||
/bin/cp /bin/qemu-arm-static "$BUILD_PATH/usr/bin/"
|
||||
if [ $? -ne 0 ];then
|
||||
error "line $LINENO can't copy /bin/qemu-user-static to $BUILD_PATH/usr/bin/ : exiting"
|
||||
exit 1
|
||||
fi
|
||||
/bin/cp /usr/lib/binfmt.d/qemu-arm-static.conf "$BUILD_PATH/usr/lib/binfmt.d"
|
||||
if [ $? -ne 0 ];then
|
||||
error "line $LINENO can't copy /usr/lib/binfmt.d/qemu-arm-static.conf to $BUILD_PATH/usr/lib/binfmt.d : exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
info "making /etc/hostname"
|
||||
echo "$HOSTNAME" > "$BUILD_PATH/etc/hostname"
|
||||
|
||||
info "copying second stage script in $BUILD_PATH"
|
||||
echo "/bin/cp $SOURCE_PATH/$CONFIG_PATH/second_stage_install.sh $BUILD_PATH/"
|
||||
cp "$SOURCE_PATH/$CONFIG_PATH/second_stage_install.sh" "$BUILD_PATH/second_stage_install.sh"
|
||||
cp --preserve=mode "$SOURCE_PATH/$CONFIG_PATH/second_stage_install.sh" "$BUILD_PATH/second_stage_install.sh"
|
||||
if [ $? -ne 0 ];then
|
||||
error "line $LINENO error copying $SOURCE_PATH/$CONFIG_PATH/second_stage_install.sh : exiting"
|
||||
exit 1
|
||||
@ -285,9 +292,9 @@ EOF" >>"$BUILD_PATH/second_stage_install.sh"
|
||||
#copying kernel odroid not existing in mageia repos
|
||||
info "copying kernel-odroid and u-boot rpms in $BUILD_PATH/root"
|
||||
echo "/bin/cp $SOURCE_PATH/$CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm $BUILD_PATH/root/"
|
||||
/usr/bin/cp "$SOURCE_PATH/$CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm" "$BUILD_PATH/root/"
|
||||
/usr/bin/cp --preserve=mode "$SOURCE_PATH/$CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm" "$BUILD_PATH/root/"
|
||||
echo "/bin/cp $SOURCE_PATH/$CONFIG_PATH/u-boot-20180507-3.mga7.armv7hl.rpm $BUILD_PATH/root/"
|
||||
/usr/bin/cp "$SOURCE_PATH/$CONFIG_PATH/u-boot-20180507-3.mga7.armv7hl.rpm" "$BUILD_PATH/root/"
|
||||
/usr/bin/cp --preserve=mode "$SOURCE_PATH/$CONFIG_PATH/u-boot-20180507-3.mga7.armv7hl.rpm" "$BUILD_PATH/root/"
|
||||
if [ $? -ne 0 ];then
|
||||
error "line $LINENO error copying $SOURCE_PATH/$CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm : exiting"
|
||||
exit 1
|
||||
@ -318,7 +325,7 @@ function jumpchroot()
|
||||
exit 1
|
||||
fi
|
||||
info "Copying resolv.conf"
|
||||
/bin/cp -a /etc/resolv.conf "$BUILD_PATH/etc/"
|
||||
/bin/cp -v --preserve=mode /etc/resolv.conf "$BUILD_PATH/etc/"
|
||||
if [ $? -ne 0 ];then
|
||||
error "line $LINENO error copying $BUILD_PATH/etc/resolv.conf : exiting"
|
||||
exit 1
|
||||
@ -539,7 +546,7 @@ sed -i -e s/\<FDTDIR\>/$KERNEL_ID/g "$BUILD_PATH/boot/extlinux/extlinux.conf"
|
||||
rpi)
|
||||
|
||||
info "copying 10-vchiq-permissions.rules"
|
||||
cp "$SOURCE_PATH/$CONFIG_PATH/10-vchiq-permissions.rules" "$BUILD_PATH/etc/udev/rules.d/"
|
||||
cp --preserve=mode "$SOURCE_PATH/$CONFIG_PATH/10-vchiq-permissions.rules" "$BUILD_PATH/etc/udev/rules.d/"
|
||||
info "Making /etc/modules"
|
||||
echo "vchiq
|
||||
snd_bcm2835
|
||||
@ -551,37 +558,37 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules
|
||||
mkdir -p "$ARM_BOOT"
|
||||
fi
|
||||
info "copying modprobe.conf"
|
||||
/bin/cp -a "$SOURCE_PATH/$CONFIG_PATH/modprobe.conf" "$BUILD_PATH/etc/"
|
||||
/usr/bin/cp -v --preserve=mode "$SOURCE_PATH/$CONFIG_PATH/modprobe.conf" "$BUILD_PATH/etc/"
|
||||
chown root:root "$BUILD_PATH/etc/modprobe.conf"
|
||||
|
||||
info "copying firmware, overlays in rpi boot partition"
|
||||
# cp -a "$BUILD_PATH/usr/lib/linux-"* "$BOOT/dtb"
|
||||
cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/start"* "$ARM_BOOT/"
|
||||
cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/fixup"* "$ARM_BOOT/"
|
||||
cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/bootcode.bin"* "$ARM_BOOT/"
|
||||
cp -av "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/overlays" "$ARM_BOOT/"
|
||||
# cp -v --preserve=mode "$BUILD_PATH/usr/lib/linux-"* "$BOOT/dtb"
|
||||
cp -v --preserve=mode "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/start"* "$ARM_BOOT/"
|
||||
cp -v --preserve=mode "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/fixup"* "$ARM_BOOT/"
|
||||
cp -v --preserve=mode "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/bootcode.bin"* "$ARM_BOOT/"
|
||||
cp -v --preserve=mode "$FIRMWARE_PATH/$FIRMWARE_DIR/boot/overlays" "$ARM_BOOT/"
|
||||
|
||||
info "copying u-boot binary to $ARM_BOOT"
|
||||
case $TARGET_VERSION in
|
||||
2)
|
||||
info "copying u-boot for $TARGET 2"
|
||||
cp "$BUILD_PATH/usr/lib/u-boot/rpi_2/u-boot.bin" "$ARM_BOOT/kernel.img"
|
||||
cp --preserve=mode "$BUILD_PATH/usr/lib/u-boot/rpi_2/u-boot.bin" "$ARM_BOOT/kernel.img"
|
||||
;;
|
||||
0)
|
||||
info "copying u-boot for $TARGET 0"
|
||||
cp "$BUILD_PATH/usr/lib/u-boot/rpi_0_w/u-boot.bin" "$ARM_BOOT/kernel.img"
|
||||
cp --preserve=mode "$BUILD_PATH/usr/lib/u-boot/rpi_0_w/u-boot.bin" "$ARM_BOOT/kernel.img"
|
||||
;;
|
||||
1)
|
||||
info "copying u-boot for $TARGET 1"
|
||||
cp "$BUILD_PATH/usr/lib/u-boot/rpi/u-boot.bin" "$ARM_BOOT/kernel.img"
|
||||
cp --preserve=mode "$BUILD_PATH/usr/lib/u-boot/rpi/u-boot.bin" "$ARM_BOOT/kernel.img"
|
||||
;;
|
||||
3_32)
|
||||
info "copying u-boot for $TARGET 3 32 bits"
|
||||
cp "$BUILD_PATH/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "$ARM_BOOT/kernel.img"
|
||||
cp --preserve=mode "$BUILD_PATH/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "$ARM_BOOT/kernel.img"
|
||||
;;
|
||||
3+)
|
||||
info "copying u-boot for $TARGET 3b+ 32 bits"
|
||||
cp "$BUILD_PATH/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "$ARM_BOOT/kernel.img"
|
||||
cp --preserve=mode "$BUILD_PATH/usr/lib/u-boot/rpi_3_32b/u-boot.bin" "$ARM_BOOT/kernel.img"
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -593,7 +600,7 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules
|
||||
/bin/mkdir -p "$ROOT/usr/lib/firmware/brcm/"
|
||||
fi
|
||||
if ! [ -f "$ROOT/usr/lib/firmware/brcm/brcmfmac434"* ];then
|
||||
/bin/cp "$SOURCE_PATH/$CONFIG_PATH/brcmfmac434"* "$ROOT/usr/lib/firmware/brcm/"
|
||||
/bin/cp --preserve=mode "$SOURCE_PATH/$CONFIG_PATH/brcmfmac434"* "$ROOT/usr/lib/firmware/brcm/"
|
||||
if [ $? -ne 0 ];then
|
||||
error "line $LINENO error copying wifi firmware in $ROOTP/usr/lib/firmware/brcm/ : exiting"
|
||||
exit 1
|
||||
@ -612,13 +619,13 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules
|
||||
case $TARGET_VERSION in
|
||||
xu4)
|
||||
info "copying u-boot for $TARGET $TARGET_VERSION"
|
||||
cp "$BUILD_PATH/usr/lib/u-boot/$TARGET-$TARGET_VERSION/u-boot.bin" "$ARM_BOOT/"
|
||||
cp --preserve=mode "$BUILD_PATH/usr/lib/u-boot/$TARGET-$TARGET_VERSION/u-boot.bin" "$ARM_BOOT/"
|
||||
;;
|
||||
esac
|
||||
# temporary code waiting inclusion of xu4 in Mageia kernel and u-boot
|
||||
|
||||
info "Copying extlinux.conf on $ODROID_BOOT"
|
||||
cp -R "$BUILD_PATH/boot/extlinux" "$ODROID_BOOT/"
|
||||
cp --preserve=mode -R "$BUILD_PATH/boot/extlinux" "$ODROID_BOOT/"
|
||||
info "copying Mageia image to root partition"
|
||||
/bin/rsync -rlptDH --exclude "$ODROID_BOOT/" --exclude "qemu-arm-static*" "$BUILD_PATH/" "$ROOT/"
|
||||
/bin/rsync -rlptDH "$ODROID_BOOT/" "$BOOT/"
|
||||
@ -626,7 +633,7 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules
|
||||
esac
|
||||
|
||||
# info "copying tools in /usr/local/bin/"
|
||||
# /bin/cp -a "$SOURCE_PATH/tools/" "$BUILD_PATH/usr/local/bin/"
|
||||
# /bin/cp -v --preserve=mode "$SOURCE_PATH/tools/" "$BUILD_PATH/usr/local/bin/"
|
||||
# if ! [ $? -eq 0 ];then
|
||||
# error "line $LINENO error copying tools"
|
||||
# ERRORN=$((ERRORN++))
|
||||
@ -774,7 +781,7 @@ if [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then
|
||||
warning "Config file does not exists, do you want i copy template ? [Y|n] "
|
||||
read yn
|
||||
if [ -z $yn ] || [ $yn = "Y" ] || [ $yn = "y" ];then
|
||||
/usr/bin/cp "$SOURCE_PATH/mageia4arm.cfg.template" "$SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg"
|
||||
/usr/bin/cp --preserve=mode "$SOURCE_PATH/mageia4arm.cfg.template" "$SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg"
|
||||
warning "You need now to modify the config file ($SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg) and relaunch the script"
|
||||
exit 2
|
||||
fi
|
||||
@ -784,7 +791,7 @@ else
|
||||
read yn
|
||||
if [ -z $yn ] || [ $yn = "Y" ] || [ $yn = "y" ];then
|
||||
/usr/bin/mkdir "$SOURCE_PATH/$CONFIG_PATH/"
|
||||
/usr/bin/cp "$SOURCE_PATH/config.template" "$SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg"
|
||||
/usr/bin/cp --preserve=mode "$SOURCE_PATH/config.template" "$SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg"
|
||||
warning "You need now to modify the config file ($SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg) and relaunch the script"
|
||||
exit 2
|
||||
fi
|
||||
|
Reference in New Issue
Block a user