From 2741c53da16ef8b32013ff12107e6ee8cb3c4446 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Mon, 16 Jul 2018 09:58:28 +0200 Subject: [PATCH] - some bugs --- create_arm_img_urpmi.sh | 69 ++++++++++++++++++++--------------------- rpi/raspi.config | 57 ---------------------------------- 2 files changed, 33 insertions(+), 93 deletions(-) mode change 100644 => 100755 create_arm_img_urpmi.sh delete mode 100644 rpi/raspi.config diff --git a/create_arm_img_urpmi.sh b/create_arm_img_urpmi.sh old mode 100644 new mode 100755 index 2f2401e..c16cb9d --- a/create_arm_img_urpmi.sh +++ b/create_arm_img_urpmi.sh @@ -37,7 +37,7 @@ function error() } SOURCE_PATH="`/bin/dirname \"$(readlink -f \"$0\")\"`" -INSTALL_PATH="$SOURCE_PATH/raspi" +INSTALL_PATH="$SOURCE_PATH/arm" FILES_PATH="$SOURCE_PATH/files" CMDNAME=`/bin/basename -z "$0"` @@ -248,20 +248,20 @@ function jumpchroot() echo "$HOSTNAME" > "$BUILD_PATH"/etc/hostname info "copying second stage script in $BUILD_PATH" - echo "/bin/cp $SOURCE_PATH/second_stage_install.sh $BUILD_PATH/" - cp "$SOURCE_PATH/second_stage_install.sh" "$BUILD_PATH/second_stage_install.sh" + 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" if [ $? -ne 0 ];then - error "line $LINENO error copying $SOURCE_PATH/second_stage_install.sh : exiting" + error "line $LINENO error copying $SOURCE_PATH/$CONFIG_PATH/second_stage_install.sh : exiting" exit 1 fi - info "copying kernel-odroid rpm in $BUILD_PATH" - echo "/bin/cp $SOURCE_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm $BUILD_PATH/" - /usr/bin/cp "$SOURCE_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm" "$BUILD_PATH/" - if [ $? -ne 0 ];then - error "line $LINENO error copying $SOURCE_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm : exiting" - exit 1 - fi +# info "copying kernel-odroid rpm in $BUILD_PATH" +# echo "/bin/cp $SOURCE_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm $BUILD_PATH/" +# /usr/bin/cp "$SOURCE_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm" "$BUILD_PATH/" +# if [ $? -ne 0 ];then +# error "line $LINENO error copying $SOURCE_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm : exiting" +# exit 1 +# fi info "creation of user account" echo "/bin/passwd << EOF @@ -280,11 +280,11 @@ EOF" >>"$BUILD_PATH/second_stage_install.sh" /bin/rsync -a /etc/skel/ "$BUILD_PATH/root/" title "chrooting to $BUILD_PATH" - /sbin/chroot --userspec root:root "$BUILD_PATH" /bin/bash -v -c '/second_stage_install.sh' - if [ $? -ne 0 ];then - warning "line $LINENO Warning : chrooting to $BUILD_PATH" + /sbin/chroot --userspec root:root "$BUILD_PATH" /bin/bash -v -c 'sh /second_stage_install.sh' + RET=$? + if [ $RET -ne 0 ];then + warning "line $LINENO Warning : chrooting to $BUILD_PATH retrurn an error $RET " fi - info "unmounting dev, sys, proc" /bin/umount "$BUILD_PATH/dev" if [ $? -ne 0 ];then @@ -545,9 +545,7 @@ do shift 1 ;; --clean) - if [ -z $OPT ];then - OPT="clean" - fi + OPT="clean" shift ;; --size) @@ -627,52 +625,51 @@ ARM_VERSION="armv7hl" case $TARGET in xu3 | xu4) CREATEIMG="createxu3-4image" - break;; + ;; rpi) CREATEIMG="createrpiimage" FIRMWARE_PATH="$SOURCE_PATH/.." FIRMWARE_DOWNLOAD_URL="https://github.com/raspberrypi/firmware/archive/stable.zip" FIRMWARE_DIR="firmware-stable" - break;; + ;; *) CREATEIMG="createxu3-4image" TARGET="xu4" - break;; + ;; esac -info "target : $TARGET" # path of config file -if [ -z $CONFIG_PATH ];then +if [ -z $SOURCE_PATH/$CONFIG_PATH ];then info " Config path do not exists, defaulting to ./$TARGET" - CONFIG_PATH="./$TARGET" + CONFIG_PATH="$SOURCE_PATH/$TARGET" fi -if [ -d "./$CONFIG_PATH" ];then - if [ -e "./$CONFIG_PATH/config.txt" ];then - info "using $CONFIG_PATH/config.txt as config" - . "./$CONFIG_PATH/config.txt" +if [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then + if [ -e "$SOURCE_PATH/$CONFIG_PATH/config.txt" ];then + info "using $SOURCE_PATH/$CONFIG_PATH/config.txt as config" + . "$SOURCE_PATH/$CONFIG_PATH/config.txt" 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 ./config.template "./$CONFIG_PATH/config.txt" + /usr/bin/cp $SOURCE_PATH/config.template "$SOURCE_PATH/$CONFIG_PATH/config.txt" fi - /usr/bin/cp ./config.template "./$CONFIG_PATH/config.txt" - warning "You need now to modify the config file (./$CONFIG_PATH/config.txt) and relaunch the script" + /usr/bin/cp $SOURCE_PATH/config.template "$SOURCE_PATH/$CONFIG_PATH/config.txt" + warning "You need now to modify the config file ($SOURCE_PATH/$CONFIG_PATH/config.txt) and relaunch the script" exit 1 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 ./$CONFIG_PATH/ - /usr/bin/cp ./config.template "./$CONFIG_PATH/config.txt" - warning "You need now to modify the config file (./$CONFIG_PATH/config.txt) and relaunch the script" + /usr/bin/mkdir $SOURCE_PATH/$CONFIG_PATH/ + /usr/bin/cp $SOURCE_PATH/config.template "$SOURCE_PATH/$CONFIG_PATH/config.txt" + warning "You need now to modify the config file ($SOURCE_PATH/$CONFIG_PATH/config.txt) and relaunch the script" + exit fi fi - - +info "target : $TARGET" info "source path: $SOURCE_PATH" info "Install path: $INSTALL_PATH" info "Build path: $BUILD_PATH" diff --git a/rpi/raspi.config b/rpi/raspi.config deleted file mode 100644 index 3d9ef8d..0000000 --- a/rpi/raspi.config +++ /dev/null @@ -1,57 +0,0 @@ - -# Copyright (C) 2017-2018 Daniel Tartavel-jeannot -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -MAGEIA_VERSION="6" -ARM_VERSION="armv7hl" - -#target plateform (xu3-4 or rpi) -TARGET="raspi" - -# URL of the Mageia mirror used to install ( see mirrors.mageia.org ) -MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/$MAGEIA_VERSION/$ARM_VERSION" - -# image will be created here -INSTALL_PATH="/mnt/perso/raspi-test/" - -# Build directory will be created here -BUILD_PATH="$INSTALL_PATH/build" - -#name of the image -IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET.img" - -#Mount point of image's partitions -BOOT="/mnt/boot" -ROOT="/mnt/root" - -#Default user -ID_USER="user login" -PASSWORD="user password" - -#root password -ROOT_PWD="root password" - -#Hostname -HOSTNAME="$TARGET.$ID_USER" - -#Filesystem of boot partitions (default ext4 raspberry pi need vfat) -BOOTFS="vfat" - -#kernel package to install (just needed for odroid) -KERNEL="" - -#Path where the raspberry pi firmware is/will be installed -FIRMWARE_PATH="$INSTALL_PATH/"