1
0

- some bugs

This commit is contained in:
Daniel Tartavel 2018-07-16 09:58:28 +02:00
parent ec5799d4b9
commit 2741c53da1
2 changed files with 33 additions and 93 deletions

67
create_arm_img_urpmi.sh Normal file → Executable file
View File

@ -37,7 +37,7 @@ function error()
} }
SOURCE_PATH="`/bin/dirname \"$(readlink -f \"$0\")\"`" SOURCE_PATH="`/bin/dirname \"$(readlink -f \"$0\")\"`"
INSTALL_PATH="$SOURCE_PATH/raspi" INSTALL_PATH="$SOURCE_PATH/arm"
FILES_PATH="$SOURCE_PATH/files" FILES_PATH="$SOURCE_PATH/files"
CMDNAME=`/bin/basename -z "$0"` CMDNAME=`/bin/basename -z "$0"`
@ -248,20 +248,20 @@ function jumpchroot()
echo "$HOSTNAME" > "$BUILD_PATH"/etc/hostname echo "$HOSTNAME" > "$BUILD_PATH"/etc/hostname
info "copying second stage script in $BUILD_PATH" info "copying second stage script in $BUILD_PATH"
echo "/bin/cp $SOURCE_PATH/second_stage_install.sh $BUILD_PATH/" echo "/bin/cp $SOURCE_PATH/$CONFIG_PATH/second_stage_install.sh $BUILD_PATH/"
cp "$SOURCE_PATH/second_stage_install.sh" "$BUILD_PATH/second_stage_install.sh" cp "$SOURCE_PATH/$CONFIG_PATH/second_stage_install.sh" "$BUILD_PATH/second_stage_install.sh"
if [ $? -ne 0 ];then 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 exit 1
fi fi
info "copying kernel-odroid rpm in $BUILD_PATH" # info "copying kernel-odroid rpm in $BUILD_PATH"
echo "/bin/cp $SOURCE_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm $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/" # /usr/bin/cp "$SOURCE_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm" "$BUILD_PATH/"
if [ $? -ne 0 ];then # if [ $? -ne 0 ];then
error "line $LINENO error copying $SOURCE_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm : exiting" # error "line $LINENO error copying $SOURCE_PATH/kernel-odroid-4.14.y-1.armv7hl.rpm : exiting"
exit 1 # exit 1
fi # fi
info "creation of user account" info "creation of user account"
echo "/bin/passwd << EOF echo "/bin/passwd << EOF
@ -280,11 +280,11 @@ EOF" >>"$BUILD_PATH/second_stage_install.sh"
/bin/rsync -a /etc/skel/ "$BUILD_PATH/root/" /bin/rsync -a /etc/skel/ "$BUILD_PATH/root/"
title "chrooting to $BUILD_PATH" title "chrooting to $BUILD_PATH"
/sbin/chroot --userspec root:root "$BUILD_PATH" /bin/bash -v -c '/second_stage_install.sh' /sbin/chroot --userspec root:root "$BUILD_PATH" /bin/bash -v -c 'sh /second_stage_install.sh'
if [ $? -ne 0 ];then RET=$?
warning "line $LINENO Warning : chrooting to $BUILD_PATH" if [ $RET -ne 0 ];then
warning "line $LINENO Warning : chrooting to $BUILD_PATH retrurn an error $RET "
fi fi
info "unmounting dev, sys, proc" info "unmounting dev, sys, proc"
/bin/umount "$BUILD_PATH/dev" /bin/umount "$BUILD_PATH/dev"
if [ $? -ne 0 ];then if [ $? -ne 0 ];then
@ -545,9 +545,7 @@ do
shift 1 shift 1
;; ;;
--clean) --clean)
if [ -z $OPT ];then
OPT="clean" OPT="clean"
fi
shift shift
;; ;;
--size) --size)
@ -627,52 +625,51 @@ ARM_VERSION="armv7hl"
case $TARGET in case $TARGET in
xu3 | xu4) xu3 | xu4)
CREATEIMG="createxu3-4image" CREATEIMG="createxu3-4image"
break;; ;;
rpi) rpi)
CREATEIMG="createrpiimage" CREATEIMG="createrpiimage"
FIRMWARE_PATH="$SOURCE_PATH/.." FIRMWARE_PATH="$SOURCE_PATH/.."
FIRMWARE_DOWNLOAD_URL="https://github.com/raspberrypi/firmware/archive/stable.zip" FIRMWARE_DOWNLOAD_URL="https://github.com/raspberrypi/firmware/archive/stable.zip"
FIRMWARE_DIR="firmware-stable" FIRMWARE_DIR="firmware-stable"
break;; ;;
*) *)
CREATEIMG="createxu3-4image" CREATEIMG="createxu3-4image"
TARGET="xu4" TARGET="xu4"
break;; ;;
esac esac
info "target : $TARGET"
# path of config file # 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" info " Config path do not exists, defaulting to ./$TARGET"
CONFIG_PATH="./$TARGET" CONFIG_PATH="$SOURCE_PATH/$TARGET"
fi fi
if [ -d "./$CONFIG_PATH" ];then if [ -d "$SOURCE_PATH/$CONFIG_PATH" ];then
if [ -e "./$CONFIG_PATH/config.txt" ];then if [ -e "$SOURCE_PATH/$CONFIG_PATH/config.txt" ];then
info "using $CONFIG_PATH/config.txt as config" info "using $SOURCE_PATH/$CONFIG_PATH/config.txt as config"
. "./$CONFIG_PATH/config.txt" . "$SOURCE_PATH/$CONFIG_PATH/config.txt"
else else
warning "Config file does not exists, do you want i copy template ? [Y|n] " warning "Config file does not exists, do you want i copy template ? [Y|n] "
read yn read yn
if [ -z $yn ] || [ $yn = "Y" ] || [ $yn = "y" ];then 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 fi
/usr/bin/cp ./config.template "./$CONFIG_PATH/config.txt" /usr/bin/cp $SOURCE_PATH/config.template "$SOURCE_PATH/$CONFIG_PATH/config.txt"
warning "You need now to modify the config file (./$CONFIG_PATH/config.txt) and relaunch the script" warning "You need now to modify the config file ($SOURCE_PATH/$CONFIG_PATH/config.txt) and relaunch the script"
exit 1 exit 1
fi fi
else else
warning "Config directory does not exists, do you want i make it and copy the template file in? [Y|n] " warning "Config directory does not exists, do you want i make it and copy the template file in? [Y|n] "
read yn read yn
if [ -z $yn || $yn = "Y" || $yn = "y" ];then if [ -z $yn || $yn = "Y" || $yn = "y" ];then
/usr/bin/mkdir ./$CONFIG_PATH/ /usr/bin/mkdir $SOURCE_PATH/$CONFIG_PATH/
/usr/bin/cp ./config.template "./$CONFIG_PATH/config.txt" /usr/bin/cp $SOURCE_PATH/config.template "$SOURCE_PATH/$CONFIG_PATH/config.txt"
warning "You need now to modify the config file (./$CONFIG_PATH/config.txt) and relaunch the script" warning "You need now to modify the config file ($SOURCE_PATH/$CONFIG_PATH/config.txt) and relaunch the script"
exit
fi fi
fi fi
info "target : $TARGET"
info "source path: $SOURCE_PATH" info "source path: $SOURCE_PATH"
info "Install path: $INSTALL_PATH" info "Install path: $INSTALL_PATH"
info "Build path: $BUILD_PATH" info "Build path: $BUILD_PATH"

View File

@ -1,57 +0,0 @@
# Copyright (C) 2017-2018 Daniel Tartavel-jeannot <contact@librepc.com>
#
# 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 <http://www.gnu.org/licenses/>.
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/"