Modified command parameters
create config tree if not existing
This commit is contained in:
parent
78c432a294
commit
f1ff1b3d17
@ -38,7 +38,7 @@ function error()
|
||||
|
||||
SOURCE_PATH="`/bin/dirname \"$(readlink -f \"$0\")\"`"
|
||||
INSTALL_PATH="$SOURCE_PATH/raspi"
|
||||
|
||||
FILES_PATH="$SOURCE_PATH/files"
|
||||
CMDNAME=`/bin/basename -z "$0"`
|
||||
|
||||
#while read -r;do
|
||||
@ -67,9 +67,8 @@ function help()
|
||||
echo "--chroot chroot to arm directory and launch packages installation"
|
||||
echo "--create-image Create the image of Mageia $MAGEIA_VERSION"
|
||||
echo "--build-path Path to the build directory of the image of Mageia $MAGEIA_VERSION"
|
||||
echo "--config Path to config file to use"
|
||||
echo "--rpi Create Raspberry 2 and 3 image"
|
||||
echo "--xu4 Create Odroid XU3 and XU4 image"
|
||||
echo "--target target system (for now rpi, xu3, xu4)"
|
||||
echo "--config Path to config files"
|
||||
echo "--bootfs filesystem of boot partition (ext4 or vfat) default: etx4"
|
||||
echo "\nFor image size, make sure it fit on physical support. (Default size is 7 Go)"
|
||||
}
|
||||
@ -528,7 +527,7 @@ fi
|
||||
|
||||
|
||||
# parsing commandline
|
||||
TEMP=`getopt -o h,a --long all,help,clean,create-chroot,addmedia,create-image,rpi,xu3-4,config:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size: -n $CMDNAME -- "$@"`
|
||||
TEMP=`getopt -o h,a --long all,help,clean,create-chroot,addmedia,create-image,,config:,target:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size: -n $CMDNAME -- "$@"`
|
||||
if [ $? -ne 0 ] ; then error "line $LINENO Failed parsing options." >&2 ; exit 1 ; fi
|
||||
eval set -- "$TEMP"
|
||||
|
||||
@ -596,13 +595,9 @@ do
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
--xu3-4)
|
||||
TARGET="xu3-4"
|
||||
shift
|
||||
;;
|
||||
--rpi)
|
||||
TARGET="rpi"
|
||||
shift
|
||||
--system)
|
||||
SYSTEM=$2
|
||||
shift 2
|
||||
;;
|
||||
--config)
|
||||
CONFIG_PATH=$2
|
||||
@ -627,31 +622,36 @@ BOOT="/mnt/boot"
|
||||
ROOT="/mnt/root"
|
||||
BUILD_PATH="$INSTALL_PATH/build"
|
||||
ARM_VERSION="armv7hl"
|
||||
|
||||
if [ -e "./$CONFIG_PATH" ];then
|
||||
info "using $CONFIG_PATH as config"
|
||||
. "./$CONFIG_PATH"
|
||||
else
|
||||
$CONFIG_PATH="$SOURCE_PATH/config/`basename $CONFIG_PATH`"
|
||||
if [ -e "$CONFIG_PATH" ];then
|
||||
. "$CONFIG_PATH"
|
||||
info "using $CONFIG_PATH as config"
|
||||
else
|
||||
warning "$CONFIG_PATH do not exists"
|
||||
if [ -e "$SOURCE_PATH/config/config.txt" ];then
|
||||
. "$SOURCE_PATH/config.txt"
|
||||
warning "Using $SOURCE_PATH/config.txt as config file"
|
||||
else
|
||||
warning "config file does not exist !! Default config will be used"
|
||||
if [ -z $CONFIG_PATH ];then
|
||||
CONFIG_PATH="./$SYSTEM"
|
||||
fi
|
||||
|
||||
if [ -d "./$CONFIG_PATH" ];then
|
||||
if [-e "./$CONFIG_PATH/config.txt" ]
|
||||
info "using $CONFIG_PATH/config.txt as config"
|
||||
. "./$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 -eq "Y" || $yn -eq "y" ];then
|
||||
/usr/bin/cp ./config.template "./$CONFIG_PATH/config.txt"
|
||||
fi
|
||||
/usr/bin/cp ./config.template "./$CONFIG_PATH/config.txt"
|
||||
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 -eq "Y" || $yn -eq "y" ];then
|
||||
/usr/bin/mkdir ./$CONFIG_PATH/
|
||||
/usr/bin/cp ./config.template "./$CONFIG_PATH/config.txt"
|
||||
fi
|
||||
fi
|
||||
|
||||
# assign TARGET ( rpi or xu3-4 )
|
||||
if [ $CREATEIMAGE ];then
|
||||
case $TARGET in
|
||||
xu3-4)
|
||||
CREATEIMG="createxu3image"
|
||||
xu3||xu4)
|
||||
CREATEIMG="createxu3-4image"
|
||||
break;;
|
||||
rpi)
|
||||
CREATEIMG="createrpiimage"
|
||||
@ -661,7 +661,7 @@ if [ $CREATEIMAGE ];then
|
||||
break;;
|
||||
*)
|
||||
CREATEIMG="createxu3-4image"
|
||||
TARGET="xu3-4"
|
||||
TARGET="xu4"
|
||||
break;;
|
||||
esac
|
||||
fi
|
||||
|
Reference in New Issue
Block a user