aboutsummaryrefslogtreecommitdiffstats
path: root/create_arm_img_urpmi.sh
diff options
context:
space:
mode:
authorDaniel Tartavel <contact@librepc.com>2019-09-29 06:50:44 +0200
committerDaniel Tartavel <contact@librepc.com>2019-09-29 06:50:44 +0200
commit2a82e889e8fc50d72be705ded4a50292c02b38b0 (patch)
treee6cd9365a439db56f8f69fc107243185be48a49d /create_arm_img_urpmi.sh
parent22115e7251b4526913948ab0b8780c8419cb6682 (diff)
downloadmageia4arm-2a82e889e8fc50d72be705ded4a50292c02b38b0.tar
mageia4arm-2a82e889e8fc50d72be705ded4a50292c02b38b0.tar.gz
mageia4arm-2a82e889e8fc50d72be705ded4a50292c02b38b0.tar.bz2
mageia4arm-2a82e889e8fc50d72be705ded4a50292c02b38b0.tar.xz
mageia4arm-2a82e889e8fc50d72be705ded4a50292c02b38b0.zip
added platform dir
Diffstat (limited to 'create_arm_img_urpmi.sh')
-rwxr-xr-xcreate_arm_img_urpmi.sh80
1 files changed, 43 insertions, 37 deletions
diff --git a/create_arm_img_urpmi.sh b/create_arm_img_urpmi.sh
index 84a10e3..eb4aa37 100755
--- a/create_arm_img_urpmi.sh
+++ b/create_arm_img_urpmi.sh
@@ -36,10 +36,13 @@ function error()
echo -e "\e[1;31m$1\e[0m"
}
+info $0
+
SOURCE_PATH="$(/bin/dirname "$(readlink -f "$0")")"
INSTALL_PATH="$SOURCE_PATH/arm"
FILES_PATH="$SOURCE_PATH/files"
-info $0
+PLATFORMS_PATH="$SOURCE_PATH/platforms"
+
CMDNAME=$(/bin/basename "$0")
#while read -r;do
@@ -277,10 +280,10 @@ function preparechroot()
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 --preserve=mode "$SOURCE_PATH/$CONFIG_PATH/second_stage_install.sh" "$BUILD_PATH/second_stage_install.sh"
+ echo "/bin/cp $CONFIG_PATH/second_stage_install.sh $BUILD_PATH/"
+ cp --preserve=mode "$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"
+ error "line $LINENO error copying $CONFIG_PATH/second_stage_install.sh : exiting"
exit 1
fi
@@ -306,12 +309,12 @@ EOF" >>"$BUILD_PATH/second_stage_install.sh"
#TEMPORARY CODE
#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 --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 --preserve=mode "$SOURCE_PATH/$CONFIG_PATH/u-boot-20180507-3.mga7.armv7hl.rpm" "$BUILD_PATH/root/"
+ echo "/bin/cp $CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm $BUILD_PATH/root/"
+ /usr/bin/cp --preserve=mode "$CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm" "$BUILD_PATH/root/"
+ echo "/bin/cp $CONFIG_PATH/u-boot-20180507-3.mga7.armv7hl.rpm $BUILD_PATH/root/"
+ /usr/bin/cp --preserve=mode "$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"
+ error "line $LINENO error copying $CONFIG_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm : exiting"
exit 1
fi
;;
@@ -454,9 +457,9 @@ createimage()
DEVICE=$(/sbin/losetup -f --show "$INSTALL_PATH/$IMAGE")
if [ $TARGET = "odroid" ];then
info "installing blobs"
- pushd "$SOURCE_PATH/$CONFIG_PATH/sd_fuse"
+ pushd "$CONFIG_PATH/sd_fuse"
if [ $? -ne 0 ];then
- error "line $LINENO error directory $SOURCE_PATH/$CONFIG_PATH/sd_fuse does not exists : exiting"
+ error "line $LINENO error directory $CONFIG_PATH/sd_fuse does not exists : exiting"
exit 1
else
./sd_fusing.sh "$DEVICE"
@@ -556,7 +559,7 @@ UUID=$ROOT_UUID / ext4 defaults 0 0" > "$BUILD_PA
mkdir -p "$BUILD_PATH/boot/extlinux"
fi
if [ ! -f "$BUILD_PATH/boot/extlinux/extlinux.conf" ];then
- sed -e s/\<UUID\>/$ROOT_UUID/g $SOURCE_PATH/$CONFIG_PATH/extlinux.conf >"$BUILD_PATH/boot/extlinux/extlinux.conf"
+ sed -e s/\<UUID\>/$ROOT_UUID/g $CONFIG_PATH/extlinux.conf >"$BUILD_PATH/boot/extlinux/extlinux.conf"
KERNEL_ID=`basename $BUILD_PATH/usr/lib/linux-*`
sed -i -e s/\<FDTDIR\>/$KERNEL_ID/g "$BUILD_PATH/boot/extlinux/extlinux.conf"
fi
@@ -564,7 +567,7 @@ UUID=$ROOT_UUID / ext4 defaults 0 0" > "$BUILD_PA
rpi)
info "copying 10-vchiq-permissions.rules"
- cp --preserve=mode "$SOURCE_PATH/$CONFIG_PATH/10-vchiq-permissions.rules" "$BUILD_PATH/etc/udev/rules.d/"
+ cp --preserve=mode "$CONFIG_PATH/10-vchiq-permissions.rules" "$BUILD_PATH/etc/udev/rules.d/"
info "Making /etc/modules"
echo "vchiq
snd_bcm2835
@@ -576,7 +579,7 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules
mkdir -p "$ARM_BOOT"
fi
info "copying modprobe.conf"
- /usr/bin/cp -v --preserve=mode "$SOURCE_PATH/$CONFIG_PATH/modprobe.conf" "$BUILD_PATH/etc/"
+ /usr/bin/cp -v --preserve=mode "$CONFIG_PATH/modprobe.conf" "$BUILD_PATH/etc/"
chown root:root "$BUILD_PATH/etc/modprobe.conf"
info "copying firmware, overlays in rpi boot partition"
@@ -618,7 +621,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 --preserve=mode "$SOURCE_PATH/$CONFIG_PATH/brcmfmac434"* "$ROOT/usr/lib/firmware/brcm/"
+ /bin/cp --preserve=mode "$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
@@ -626,8 +629,8 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules
fi
info "copying Mageia image to root partition"
- /bin/rsync -rlptDH --exclude "$ARM_BOOT/" --exclude "qemu-arm-static*" "$BUILD_PATH/" "$ROOT/"
- /bin/rsync -rlptDH "$ARM_BOOT/" "$BOOT/"
+ /bin/rsync -rlptogDH --exclude "$ARM_BOOT/" --exclude "qemu-arm-static*" "$BUILD_PATH/" "$ROOT/"
+ /bin/rsync -rlptogDH "$ARM_BOOT/" "$BOOT/"
;;
odroid)
ODROID_BOOT="$BUILD_PATH/mnt/odroid_boot"
@@ -645,8 +648,8 @@ brcmfmac" >> "$BUILD_PATH"/etc/modules
info "Copying extlinux.conf on $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/"
+ /bin/rsync -rlptogDH --exclude "$ODROID_BOOT/" --exclude "qemu-arm-static*" "$BUILD_PATH/" "$ROOT/"
+ /bin/rsync -rlptogDH "$ODROID_BOOT/" "$BOOT/"
;;
esac
@@ -768,7 +771,7 @@ do
shift 2
;;
--config)
- CONFIG_PATH="$2"
+ CONFIG_PATH="$PLATFORMS_PATH/$2"
shift 2
;;
--bootfs)
@@ -792,33 +795,36 @@ done
# path of config file
-if ! [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then
- info " Config path does not exists, defaulting to ./$TARGET"
- CONFIG_PATH="$TARGET"
+if ! [ -d "$CONFIG_PATH" ];then
+ info " Config path does not exists, defaulting to ./platforms/$TARGET"
+ CONFIG_PATH="$PLATFORMS_PATH/$TARGET"
+ warning "Do you want i make it and copy the template file in? [Y|n] "
+ read yn
+ if [ -z $yn ] || [ $yn = "Y" ] || [ $yn = "y" ];then
+ /usr/bin/mkdir "$CONFIG_PATH/"
+ /usr/bin/cp --preserve=mode "$SOURCE_PATH/config.template" "$CONFIG_PATH/mageia4arm.cfg"
+ warning "You need now to modify the config file ($CONFIG_PATH/mageia4arm.cfg) and relaunch the script"
+ exit 2
+ else
+ error( "Error: Can't continue without config file, exiting" )
+ exit 3
+ fi
fi
-if [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then
- if [ -e "$SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg" ];then
- info "using $SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg as config"
- . "$SOURCE_PATH/$CONFIG_PATH/mageia4arm.cfg"
+ if [ -e "$CONFIG_PATH/mageia4arm.cfg" ];then
+ info "using $CONFIG_PATH/mageia4arm.cfg as config"
+ . "$CONFIG_PATH/mageia4arm.cfg"
else
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 --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"
+ /usr/bin/cp --preserve=mode "$SOURCE_PATH/mageia4arm.cfg.template" "$CONFIG_PATH/mageia4arm.cfg"
+ warning "You need now to modify the config file ($CONFIG_PATH/mageia4arm.cfg) and relaunch the script"
exit 2
fi
fi
else
- warning "Config directory does not exists, do you want i make it and copy the template file in? [Y|n] "
- read yn
- if [ -z $yn ] || [ $yn = "Y" ] || [ $yn = "y" ];then
- /usr/bin/mkdir "$SOURCE_PATH/$CONFIG_PATH/"
- /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
+
fi
if ! [ -z "$IMAGE_SIZE_P" ];then